From 40e7f5b5263f1155b7e77603bbe310b128d40ef2 Mon Sep 17 00:00:00 2001 From: Owl Bot Date: Tue, 24 Jan 2023 19:12:17 +0000 Subject: [PATCH 1/2] chore: Update gapic-generator-python to v1.8.2 PiperOrigin-RevId: 504289125 Source-Link: https://github.com/googleapis/googleapis/commit/38a48a44a44279e9cf9f2f864b588958a2d87491 Source-Link: https://github.com/googleapis/googleapis-gen/commit/b2dc22663dbe47a972c8d8c2f8a4df013dafdcbc Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiYjJkYzIyNjYzZGJlNDdhOTcyYzhkOGMyZjhhNGRmMDEzZGFmZGNiYyJ9 --- owl-bot-staging/v1/.coveragerc | 13 + owl-bot-staging/v1/.flake8 | 33 + owl-bot-staging/v1/MANIFEST.in | 2 + owl-bot-staging/v1/README.rst | 49 + owl-bot-staging/v1/docs/conf.py | 376 + owl-bot-staging/v1/docs/index.rst | 7 + .../certificate_authority_service.rst | 10 + .../v1/docs/privateca_v1/services.rst | 6 + .../v1/docs/privateca_v1/types.rst | 6 + .../cloud/security/privateca/__init__.py | 139 + .../cloud/security/privateca/gapic_version.py | 16 + .../google/cloud/security/privateca/py.typed | 2 + .../cloud/security/privateca_v1/__init__.py | 140 + .../security/privateca_v1/gapic_metadata.json | 313 + .../security/privateca_v1/gapic_version.py | 16 + .../cloud/security/privateca_v1/py.typed | 2 + .../privateca_v1/services/__init__.py | 15 + .../certificate_authority_service/__init__.py | 22 + .../async_client.py | 3752 +++++++ .../certificate_authority_service/client.py | 3990 +++++++ .../certificate_authority_service/pagers.py | 624 ++ .../transports/__init__.py | 33 + .../transports/base.py | 548 + .../transports/grpc.py | 1071 ++ .../transports/grpc_asyncio.py | 1070 ++ .../security/privateca_v1/types/__init__.py | 134 + .../security/privateca_v1/types/resources.py | 2179 ++++ .../security/privateca_v1/types/service.py | 1671 +++ owl-bot-staging/v1/mypy.ini | 3 + owl-bot-staging/v1/noxfile.py | 184 + ...ce_activate_certificate_authority_async.py | 61 + ...ice_activate_certificate_authority_sync.py | 61 + ..._authority_service_create_ca_pool_async.py | 61 + ...e_authority_service_create_ca_pool_sync.py | 61 + ...hority_service_create_certificate_async.py | 56 + ...vice_create_certificate_authority_async.py | 62 + ...rvice_create_certificate_authority_sync.py | 62 + ...thority_service_create_certificate_sync.py | 56 + ...rvice_create_certificate_template_async.py | 57 + ...ervice_create_certificate_template_sync.py | 57 + ..._authority_service_delete_ca_pool_async.py | 56 + ...e_authority_service_delete_ca_pool_sync.py | 56 + ...vice_delete_certificate_authority_async.py | 56 + ...rvice_delete_certificate_authority_sync.py | 56 + ...rvice_delete_certificate_template_async.py | 56 + ...ervice_delete_certificate_template_sync.py | 56 + ...ice_disable_certificate_authority_async.py | 56 + ...vice_disable_certificate_authority_sync.py | 56 + ...vice_enable_certificate_authority_async.py | 56 + ...rvice_enable_certificate_authority_sync.py | 56 + ..._authority_service_fetch_ca_certs_async.py | 52 + ...e_authority_service_fetch_ca_certs_sync.py | 52 + ...e_fetch_certificate_authority_csr_async.py | 52 + ...ce_fetch_certificate_authority_csr_sync.py | 52 + ...ate_authority_service_get_ca_pool_async.py | 52 + ...cate_authority_service_get_ca_pool_sync.py | 52 + ...authority_service_get_certificate_async.py | 52 + ...service_get_certificate_authority_async.py | 52 + ..._service_get_certificate_authority_sync.py | 52 + ...e_get_certificate_revocation_list_async.py | 52 + ...ce_get_certificate_revocation_list_sync.py | 52 + ..._authority_service_get_certificate_sync.py | 52 + ..._service_get_certificate_template_async.py | 52 + ...y_service_get_certificate_template_sync.py | 52 + ...e_authority_service_list_ca_pools_async.py | 53 + ...te_authority_service_list_ca_pools_sync.py | 53 + ...vice_list_certificate_authorities_async.py | 53 + ...rvice_list_certificate_authorities_sync.py | 53 + ...list_certificate_revocation_lists_async.py | 53 + ..._list_certificate_revocation_lists_sync.py | 53 + ...ervice_list_certificate_templates_async.py | 53 + ...service_list_certificate_templates_sync.py | 53 + ...thority_service_list_certificates_async.py | 53 + ...uthority_service_list_certificates_sync.py | 53 + ...hority_service_revoke_certificate_async.py | 53 + ...thority_service_revoke_certificate_sync.py | 53 + ...ce_undelete_certificate_authority_async.py | 56 + ...ice_undelete_certificate_authority_sync.py | 56 + ..._authority_service_update_ca_pool_async.py | 59 + ...e_authority_service_update_ca_pool_sync.py | 59 + ...hority_service_update_certificate_async.py | 55 + ...vice_update_certificate_authority_async.py | 60 + ...rvice_update_certificate_authority_sync.py | 60 + ...pdate_certificate_revocation_list_async.py | 55 + ...update_certificate_revocation_list_sync.py | 55 + ...thority_service_update_certificate_sync.py | 55 + ...rvice_update_certificate_template_async.py | 55 + ...ervice_update_certificate_template_sync.py | 55 + ...ta_google.cloud.security.privateca.v1.json | 4788 +++++++++ .../v1/scripts/fixup_privateca_v1_keywords.py | 204 + owl-bot-staging/v1/setup.py | 92 + .../v1/testing/constraints-3.10.txt | 6 + .../v1/testing/constraints-3.11.txt | 6 + .../v1/testing/constraints-3.12.txt | 6 + .../v1/testing/constraints-3.7.txt | 9 + .../v1/testing/constraints-3.8.txt | 6 + .../v1/testing/constraints-3.9.txt | 6 + owl-bot-staging/v1/tests/__init__.py | 16 + owl-bot-staging/v1/tests/unit/__init__.py | 16 + .../v1/tests/unit/gapic/__init__.py | 16 + .../tests/unit/gapic/privateca_v1/__init__.py | 16 + .../test_certificate_authority_service.py | 9247 +++++++++++++++++ owl-bot-staging/v1beta1/.coveragerc | 13 + owl-bot-staging/v1beta1/.flake8 | 33 + owl-bot-staging/v1beta1/MANIFEST.in | 2 + owl-bot-staging/v1beta1/README.rst | 49 + owl-bot-staging/v1beta1/docs/conf.py | 376 + owl-bot-staging/v1beta1/docs/index.rst | 7 + .../certificate_authority_service.rst | 10 + .../docs/privateca_v1beta1/services.rst | 6 + .../v1beta1/docs/privateca_v1beta1/types.rst | 6 + .../cloud/security/privateca/__init__.py | 111 + .../cloud/security/privateca/gapic_version.py | 16 + .../google/cloud/security/privateca/py.typed | 2 + .../security/privateca_v1beta1/__init__.py | 112 + .../privateca_v1beta1/gapic_metadata.json | 223 + .../privateca_v1beta1/gapic_version.py | 16 + .../cloud/security/privateca_v1beta1/py.typed | 2 + .../privateca_v1beta1/services/__init__.py | 15 + .../certificate_authority_service/__init__.py | 22 + .../async_client.py | 2618 +++++ .../certificate_authority_service/client.py | 2847 +++++ .../certificate_authority_service/pagers.py | 503 + .../transports/__init__.py | 33 + .../transports/base.py | 422 + .../transports/grpc.py | 830 ++ .../transports/grpc_asyncio.py | 829 ++ .../privateca_v1beta1/types/__init__.py | 106 + .../privateca_v1beta1/types/resources.py | 1861 ++++ .../privateca_v1beta1/types/service.py | 1124 ++ owl-bot-staging/v1beta1/mypy.ini | 3 + owl-bot-staging/v1beta1/noxfile.py | 184 + ...ce_activate_certificate_authority_async.py | 61 + ...ice_activate_certificate_authority_sync.py | 61 + ...hority_service_create_certificate_async.py | 56 + ...vice_create_certificate_authority_async.py | 64 + ...rvice_create_certificate_authority_sync.py | 64 + ...thority_service_create_certificate_sync.py | 56 + ...ice_disable_certificate_authority_async.py | 56 + ...vice_disable_certificate_authority_sync.py | 56 + ...vice_enable_certificate_authority_async.py | 56 + ...rvice_enable_certificate_authority_sync.py | 56 + ...e_fetch_certificate_authority_csr_async.py | 52 + ...ce_fetch_certificate_authority_csr_sync.py | 52 + ...authority_service_get_certificate_async.py | 52 + ...service_get_certificate_authority_async.py | 52 + ..._service_get_certificate_authority_sync.py | 52 + ...e_get_certificate_revocation_list_async.py | 52 + ...ce_get_certificate_revocation_list_sync.py | 52 + ..._authority_service_get_certificate_sync.py | 52 + ...ority_service_get_reusable_config_async.py | 52 + ...hority_service_get_reusable_config_sync.py | 52 + ...vice_list_certificate_authorities_async.py | 53 + ...rvice_list_certificate_authorities_sync.py | 53 + ...list_certificate_revocation_lists_async.py | 53 + ..._list_certificate_revocation_lists_sync.py | 53 + ...thority_service_list_certificates_async.py | 53 + ...uthority_service_list_certificates_sync.py | 53 + ...ity_service_list_reusable_configs_async.py | 53 + ...rity_service_list_reusable_configs_sync.py | 53 + ...ice_restore_certificate_authority_async.py | 56 + ...vice_restore_certificate_authority_sync.py | 56 + ...hority_service_revoke_certificate_async.py | 53 + ...thority_service_revoke_certificate_sync.py | 53 + ...dule_delete_certificate_authority_async.py | 56 + ...edule_delete_certificate_authority_sync.py | 56 + ...hority_service_update_certificate_async.py | 55 + ...vice_update_certificate_authority_async.py | 62 + ...rvice_update_certificate_authority_sync.py | 62 + ...pdate_certificate_revocation_list_async.py | 55 + ...update_certificate_revocation_list_sync.py | 55 + ...thority_service_update_certificate_sync.py | 55 + ...ogle.cloud.security.privateca.v1beta1.json | 3291 ++++++ .../fixup_privateca_v1beta1_keywords.py | 195 + owl-bot-staging/v1beta1/setup.py | 92 + .../v1beta1/testing/constraints-3.10.txt | 6 + .../v1beta1/testing/constraints-3.11.txt | 6 + .../v1beta1/testing/constraints-3.12.txt | 6 + .../v1beta1/testing/constraints-3.7.txt | 9 + .../v1beta1/testing/constraints-3.8.txt | 6 + .../v1beta1/testing/constraints-3.9.txt | 6 + owl-bot-staging/v1beta1/tests/__init__.py | 16 + .../v1beta1/tests/unit/__init__.py | 16 + .../v1beta1/tests/unit/gapic/__init__.py | 16 + .../unit/gapic/privateca_v1beta1/__init__.py | 16 + .../test_certificate_authority_service.py | 6833 ++++++++++++ 186 files changed, 59157 insertions(+) create mode 100644 owl-bot-staging/v1/.coveragerc create mode 100644 owl-bot-staging/v1/.flake8 create mode 100644 owl-bot-staging/v1/MANIFEST.in create mode 100644 owl-bot-staging/v1/README.rst create mode 100644 owl-bot-staging/v1/docs/conf.py create mode 100644 owl-bot-staging/v1/docs/index.rst create mode 100644 owl-bot-staging/v1/docs/privateca_v1/certificate_authority_service.rst create mode 100644 owl-bot-staging/v1/docs/privateca_v1/services.rst create mode 100644 owl-bot-staging/v1/docs/privateca_v1/types.rst create mode 100644 owl-bot-staging/v1/google/cloud/security/privateca/__init__.py create mode 100644 owl-bot-staging/v1/google/cloud/security/privateca/gapic_version.py create mode 100644 owl-bot-staging/v1/google/cloud/security/privateca/py.typed create mode 100644 owl-bot-staging/v1/google/cloud/security/privateca_v1/__init__.py create mode 100644 owl-bot-staging/v1/google/cloud/security/privateca_v1/gapic_metadata.json create mode 100644 owl-bot-staging/v1/google/cloud/security/privateca_v1/gapic_version.py create mode 100644 owl-bot-staging/v1/google/cloud/security/privateca_v1/py.typed create mode 100644 owl-bot-staging/v1/google/cloud/security/privateca_v1/services/__init__.py create mode 100644 owl-bot-staging/v1/google/cloud/security/privateca_v1/services/certificate_authority_service/__init__.py create mode 100644 owl-bot-staging/v1/google/cloud/security/privateca_v1/services/certificate_authority_service/async_client.py create mode 100644 owl-bot-staging/v1/google/cloud/security/privateca_v1/services/certificate_authority_service/client.py create mode 100644 owl-bot-staging/v1/google/cloud/security/privateca_v1/services/certificate_authority_service/pagers.py create mode 100644 owl-bot-staging/v1/google/cloud/security/privateca_v1/services/certificate_authority_service/transports/__init__.py create mode 100644 owl-bot-staging/v1/google/cloud/security/privateca_v1/services/certificate_authority_service/transports/base.py create mode 100644 owl-bot-staging/v1/google/cloud/security/privateca_v1/services/certificate_authority_service/transports/grpc.py create mode 100644 owl-bot-staging/v1/google/cloud/security/privateca_v1/services/certificate_authority_service/transports/grpc_asyncio.py create mode 100644 owl-bot-staging/v1/google/cloud/security/privateca_v1/types/__init__.py create mode 100644 owl-bot-staging/v1/google/cloud/security/privateca_v1/types/resources.py create mode 100644 owl-bot-staging/v1/google/cloud/security/privateca_v1/types/service.py create mode 100644 owl-bot-staging/v1/mypy.ini create mode 100644 owl-bot-staging/v1/noxfile.py create mode 100644 owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_activate_certificate_authority_async.py create mode 100644 owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_activate_certificate_authority_sync.py create mode 100644 owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_create_ca_pool_async.py create mode 100644 owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_create_ca_pool_sync.py create mode 100644 owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_create_certificate_async.py create mode 100644 owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_create_certificate_authority_async.py create mode 100644 owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_create_certificate_authority_sync.py create mode 100644 owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_create_certificate_sync.py create mode 100644 owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_create_certificate_template_async.py create mode 100644 owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_create_certificate_template_sync.py create mode 100644 owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_delete_ca_pool_async.py create mode 100644 owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_delete_ca_pool_sync.py create mode 100644 owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_delete_certificate_authority_async.py create mode 100644 owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_delete_certificate_authority_sync.py create mode 100644 owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_delete_certificate_template_async.py create mode 100644 owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_delete_certificate_template_sync.py create mode 100644 owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_disable_certificate_authority_async.py create mode 100644 owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_disable_certificate_authority_sync.py create mode 100644 owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_enable_certificate_authority_async.py create mode 100644 owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_enable_certificate_authority_sync.py create mode 100644 owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_fetch_ca_certs_async.py create mode 100644 owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_fetch_ca_certs_sync.py create mode 100644 owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_fetch_certificate_authority_csr_async.py create mode 100644 owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_fetch_certificate_authority_csr_sync.py create mode 100644 owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_get_ca_pool_async.py create mode 100644 owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_get_ca_pool_sync.py create mode 100644 owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_get_certificate_async.py create mode 100644 owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_get_certificate_authority_async.py create mode 100644 owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_get_certificate_authority_sync.py create mode 100644 owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_get_certificate_revocation_list_async.py create mode 100644 owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_get_certificate_revocation_list_sync.py create mode 100644 owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_get_certificate_sync.py create mode 100644 owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_get_certificate_template_async.py create mode 100644 owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_get_certificate_template_sync.py create mode 100644 owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_list_ca_pools_async.py create mode 100644 owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_list_ca_pools_sync.py create mode 100644 owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_list_certificate_authorities_async.py create mode 100644 owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_list_certificate_authorities_sync.py create mode 100644 owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_list_certificate_revocation_lists_async.py create mode 100644 owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_list_certificate_revocation_lists_sync.py create mode 100644 owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_list_certificate_templates_async.py create mode 100644 owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_list_certificate_templates_sync.py create mode 100644 owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_list_certificates_async.py create mode 100644 owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_list_certificates_sync.py create mode 100644 owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_revoke_certificate_async.py create mode 100644 owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_revoke_certificate_sync.py create mode 100644 owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_undelete_certificate_authority_async.py create mode 100644 owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_undelete_certificate_authority_sync.py create mode 100644 owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_update_ca_pool_async.py create mode 100644 owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_update_ca_pool_sync.py create mode 100644 owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_update_certificate_async.py create mode 100644 owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_update_certificate_authority_async.py create mode 100644 owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_update_certificate_authority_sync.py create mode 100644 owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_update_certificate_revocation_list_async.py create mode 100644 owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_update_certificate_revocation_list_sync.py create mode 100644 owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_update_certificate_sync.py create mode 100644 owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_update_certificate_template_async.py create mode 100644 owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_update_certificate_template_sync.py create mode 100644 owl-bot-staging/v1/samples/generated_samples/snippet_metadata_google.cloud.security.privateca.v1.json create mode 100644 owl-bot-staging/v1/scripts/fixup_privateca_v1_keywords.py create mode 100644 owl-bot-staging/v1/setup.py create mode 100644 owl-bot-staging/v1/testing/constraints-3.10.txt create mode 100644 owl-bot-staging/v1/testing/constraints-3.11.txt create mode 100644 owl-bot-staging/v1/testing/constraints-3.12.txt create mode 100644 owl-bot-staging/v1/testing/constraints-3.7.txt create mode 100644 owl-bot-staging/v1/testing/constraints-3.8.txt create mode 100644 owl-bot-staging/v1/testing/constraints-3.9.txt create mode 100644 owl-bot-staging/v1/tests/__init__.py create mode 100644 owl-bot-staging/v1/tests/unit/__init__.py create mode 100644 owl-bot-staging/v1/tests/unit/gapic/__init__.py create mode 100644 owl-bot-staging/v1/tests/unit/gapic/privateca_v1/__init__.py create mode 100644 owl-bot-staging/v1/tests/unit/gapic/privateca_v1/test_certificate_authority_service.py create mode 100644 owl-bot-staging/v1beta1/.coveragerc create mode 100644 owl-bot-staging/v1beta1/.flake8 create mode 100644 owl-bot-staging/v1beta1/MANIFEST.in create mode 100644 owl-bot-staging/v1beta1/README.rst create mode 100644 owl-bot-staging/v1beta1/docs/conf.py create mode 100644 owl-bot-staging/v1beta1/docs/index.rst create mode 100644 owl-bot-staging/v1beta1/docs/privateca_v1beta1/certificate_authority_service.rst create mode 100644 owl-bot-staging/v1beta1/docs/privateca_v1beta1/services.rst create mode 100644 owl-bot-staging/v1beta1/docs/privateca_v1beta1/types.rst create mode 100644 owl-bot-staging/v1beta1/google/cloud/security/privateca/__init__.py create mode 100644 owl-bot-staging/v1beta1/google/cloud/security/privateca/gapic_version.py create mode 100644 owl-bot-staging/v1beta1/google/cloud/security/privateca/py.typed create mode 100644 owl-bot-staging/v1beta1/google/cloud/security/privateca_v1beta1/__init__.py create mode 100644 owl-bot-staging/v1beta1/google/cloud/security/privateca_v1beta1/gapic_metadata.json create mode 100644 owl-bot-staging/v1beta1/google/cloud/security/privateca_v1beta1/gapic_version.py create mode 100644 owl-bot-staging/v1beta1/google/cloud/security/privateca_v1beta1/py.typed create mode 100644 owl-bot-staging/v1beta1/google/cloud/security/privateca_v1beta1/services/__init__.py create mode 100644 owl-bot-staging/v1beta1/google/cloud/security/privateca_v1beta1/services/certificate_authority_service/__init__.py create mode 100644 owl-bot-staging/v1beta1/google/cloud/security/privateca_v1beta1/services/certificate_authority_service/async_client.py create mode 100644 owl-bot-staging/v1beta1/google/cloud/security/privateca_v1beta1/services/certificate_authority_service/client.py create mode 100644 owl-bot-staging/v1beta1/google/cloud/security/privateca_v1beta1/services/certificate_authority_service/pagers.py create mode 100644 owl-bot-staging/v1beta1/google/cloud/security/privateca_v1beta1/services/certificate_authority_service/transports/__init__.py create mode 100644 owl-bot-staging/v1beta1/google/cloud/security/privateca_v1beta1/services/certificate_authority_service/transports/base.py create mode 100644 owl-bot-staging/v1beta1/google/cloud/security/privateca_v1beta1/services/certificate_authority_service/transports/grpc.py create mode 100644 owl-bot-staging/v1beta1/google/cloud/security/privateca_v1beta1/services/certificate_authority_service/transports/grpc_asyncio.py create mode 100644 owl-bot-staging/v1beta1/google/cloud/security/privateca_v1beta1/types/__init__.py create mode 100644 owl-bot-staging/v1beta1/google/cloud/security/privateca_v1beta1/types/resources.py create mode 100644 owl-bot-staging/v1beta1/google/cloud/security/privateca_v1beta1/types/service.py create mode 100644 owl-bot-staging/v1beta1/mypy.ini create mode 100644 owl-bot-staging/v1beta1/noxfile.py create mode 100644 owl-bot-staging/v1beta1/samples/generated_samples/privateca_v1beta1_generated_certificate_authority_service_activate_certificate_authority_async.py create mode 100644 owl-bot-staging/v1beta1/samples/generated_samples/privateca_v1beta1_generated_certificate_authority_service_activate_certificate_authority_sync.py create mode 100644 owl-bot-staging/v1beta1/samples/generated_samples/privateca_v1beta1_generated_certificate_authority_service_create_certificate_async.py create mode 100644 owl-bot-staging/v1beta1/samples/generated_samples/privateca_v1beta1_generated_certificate_authority_service_create_certificate_authority_async.py create mode 100644 owl-bot-staging/v1beta1/samples/generated_samples/privateca_v1beta1_generated_certificate_authority_service_create_certificate_authority_sync.py create mode 100644 owl-bot-staging/v1beta1/samples/generated_samples/privateca_v1beta1_generated_certificate_authority_service_create_certificate_sync.py create mode 100644 owl-bot-staging/v1beta1/samples/generated_samples/privateca_v1beta1_generated_certificate_authority_service_disable_certificate_authority_async.py create mode 100644 owl-bot-staging/v1beta1/samples/generated_samples/privateca_v1beta1_generated_certificate_authority_service_disable_certificate_authority_sync.py create mode 100644 owl-bot-staging/v1beta1/samples/generated_samples/privateca_v1beta1_generated_certificate_authority_service_enable_certificate_authority_async.py create mode 100644 owl-bot-staging/v1beta1/samples/generated_samples/privateca_v1beta1_generated_certificate_authority_service_enable_certificate_authority_sync.py create mode 100644 owl-bot-staging/v1beta1/samples/generated_samples/privateca_v1beta1_generated_certificate_authority_service_fetch_certificate_authority_csr_async.py create mode 100644 owl-bot-staging/v1beta1/samples/generated_samples/privateca_v1beta1_generated_certificate_authority_service_fetch_certificate_authority_csr_sync.py create mode 100644 owl-bot-staging/v1beta1/samples/generated_samples/privateca_v1beta1_generated_certificate_authority_service_get_certificate_async.py create mode 100644 owl-bot-staging/v1beta1/samples/generated_samples/privateca_v1beta1_generated_certificate_authority_service_get_certificate_authority_async.py create mode 100644 owl-bot-staging/v1beta1/samples/generated_samples/privateca_v1beta1_generated_certificate_authority_service_get_certificate_authority_sync.py create mode 100644 owl-bot-staging/v1beta1/samples/generated_samples/privateca_v1beta1_generated_certificate_authority_service_get_certificate_revocation_list_async.py create mode 100644 owl-bot-staging/v1beta1/samples/generated_samples/privateca_v1beta1_generated_certificate_authority_service_get_certificate_revocation_list_sync.py create mode 100644 owl-bot-staging/v1beta1/samples/generated_samples/privateca_v1beta1_generated_certificate_authority_service_get_certificate_sync.py create mode 100644 owl-bot-staging/v1beta1/samples/generated_samples/privateca_v1beta1_generated_certificate_authority_service_get_reusable_config_async.py create mode 100644 owl-bot-staging/v1beta1/samples/generated_samples/privateca_v1beta1_generated_certificate_authority_service_get_reusable_config_sync.py create mode 100644 owl-bot-staging/v1beta1/samples/generated_samples/privateca_v1beta1_generated_certificate_authority_service_list_certificate_authorities_async.py create mode 100644 owl-bot-staging/v1beta1/samples/generated_samples/privateca_v1beta1_generated_certificate_authority_service_list_certificate_authorities_sync.py create mode 100644 owl-bot-staging/v1beta1/samples/generated_samples/privateca_v1beta1_generated_certificate_authority_service_list_certificate_revocation_lists_async.py create mode 100644 owl-bot-staging/v1beta1/samples/generated_samples/privateca_v1beta1_generated_certificate_authority_service_list_certificate_revocation_lists_sync.py create mode 100644 owl-bot-staging/v1beta1/samples/generated_samples/privateca_v1beta1_generated_certificate_authority_service_list_certificates_async.py create mode 100644 owl-bot-staging/v1beta1/samples/generated_samples/privateca_v1beta1_generated_certificate_authority_service_list_certificates_sync.py create mode 100644 owl-bot-staging/v1beta1/samples/generated_samples/privateca_v1beta1_generated_certificate_authority_service_list_reusable_configs_async.py create mode 100644 owl-bot-staging/v1beta1/samples/generated_samples/privateca_v1beta1_generated_certificate_authority_service_list_reusable_configs_sync.py create mode 100644 owl-bot-staging/v1beta1/samples/generated_samples/privateca_v1beta1_generated_certificate_authority_service_restore_certificate_authority_async.py create mode 100644 owl-bot-staging/v1beta1/samples/generated_samples/privateca_v1beta1_generated_certificate_authority_service_restore_certificate_authority_sync.py create mode 100644 owl-bot-staging/v1beta1/samples/generated_samples/privateca_v1beta1_generated_certificate_authority_service_revoke_certificate_async.py create mode 100644 owl-bot-staging/v1beta1/samples/generated_samples/privateca_v1beta1_generated_certificate_authority_service_revoke_certificate_sync.py create mode 100644 owl-bot-staging/v1beta1/samples/generated_samples/privateca_v1beta1_generated_certificate_authority_service_schedule_delete_certificate_authority_async.py create mode 100644 owl-bot-staging/v1beta1/samples/generated_samples/privateca_v1beta1_generated_certificate_authority_service_schedule_delete_certificate_authority_sync.py create mode 100644 owl-bot-staging/v1beta1/samples/generated_samples/privateca_v1beta1_generated_certificate_authority_service_update_certificate_async.py create mode 100644 owl-bot-staging/v1beta1/samples/generated_samples/privateca_v1beta1_generated_certificate_authority_service_update_certificate_authority_async.py create mode 100644 owl-bot-staging/v1beta1/samples/generated_samples/privateca_v1beta1_generated_certificate_authority_service_update_certificate_authority_sync.py create mode 100644 owl-bot-staging/v1beta1/samples/generated_samples/privateca_v1beta1_generated_certificate_authority_service_update_certificate_revocation_list_async.py create mode 100644 owl-bot-staging/v1beta1/samples/generated_samples/privateca_v1beta1_generated_certificate_authority_service_update_certificate_revocation_list_sync.py create mode 100644 owl-bot-staging/v1beta1/samples/generated_samples/privateca_v1beta1_generated_certificate_authority_service_update_certificate_sync.py create mode 100644 owl-bot-staging/v1beta1/samples/generated_samples/snippet_metadata_google.cloud.security.privateca.v1beta1.json create mode 100644 owl-bot-staging/v1beta1/scripts/fixup_privateca_v1beta1_keywords.py create mode 100644 owl-bot-staging/v1beta1/setup.py create mode 100644 owl-bot-staging/v1beta1/testing/constraints-3.10.txt create mode 100644 owl-bot-staging/v1beta1/testing/constraints-3.11.txt create mode 100644 owl-bot-staging/v1beta1/testing/constraints-3.12.txt create mode 100644 owl-bot-staging/v1beta1/testing/constraints-3.7.txt create mode 100644 owl-bot-staging/v1beta1/testing/constraints-3.8.txt create mode 100644 owl-bot-staging/v1beta1/testing/constraints-3.9.txt create mode 100644 owl-bot-staging/v1beta1/tests/__init__.py create mode 100644 owl-bot-staging/v1beta1/tests/unit/__init__.py create mode 100644 owl-bot-staging/v1beta1/tests/unit/gapic/__init__.py create mode 100644 owl-bot-staging/v1beta1/tests/unit/gapic/privateca_v1beta1/__init__.py create mode 100644 owl-bot-staging/v1beta1/tests/unit/gapic/privateca_v1beta1/test_certificate_authority_service.py diff --git a/owl-bot-staging/v1/.coveragerc b/owl-bot-staging/v1/.coveragerc new file mode 100644 index 0000000..eeab431 --- /dev/null +++ b/owl-bot-staging/v1/.coveragerc @@ -0,0 +1,13 @@ +[run] +branch = True + +[report] +show_missing = True +omit = + google/cloud/security/privateca/__init__.py + google/cloud/security/privateca/gapic_version.py +exclude_lines = + # Re-enable the standard pragma + pragma: NO COVER + # Ignore debug-only repr + def __repr__ diff --git a/owl-bot-staging/v1/.flake8 b/owl-bot-staging/v1/.flake8 new file mode 100644 index 0000000..29227d4 --- /dev/null +++ b/owl-bot-staging/v1/.flake8 @@ -0,0 +1,33 @@ +# -*- 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 +# +# https://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. + +# Generated by synthtool. DO NOT EDIT! +[flake8] +ignore = E203, E266, E501, W503 +exclude = + # Exclude generated code. + **/proto/** + **/gapic/** + **/services/** + **/types/** + *_pb2.py + + # Standard linting exemptions. + **/.nox/** + __pycache__, + .git, + *.pyc, + conf.py diff --git a/owl-bot-staging/v1/MANIFEST.in b/owl-bot-staging/v1/MANIFEST.in new file mode 100644 index 0000000..3b6449c --- /dev/null +++ b/owl-bot-staging/v1/MANIFEST.in @@ -0,0 +1,2 @@ +recursive-include google/cloud/security/privateca *.py +recursive-include google/cloud/security/privateca_v1 *.py diff --git a/owl-bot-staging/v1/README.rst b/owl-bot-staging/v1/README.rst new file mode 100644 index 0000000..d1e676b --- /dev/null +++ b/owl-bot-staging/v1/README.rst @@ -0,0 +1,49 @@ +Python Client for Google Cloud Security Privateca API +================================================= + +Quick Start +----------- + +In order to use this library, you first need to go through the following steps: + +1. `Select or create a Cloud Platform project.`_ +2. `Enable billing for your project.`_ +3. Enable the Google Cloud Security Privateca API. +4. `Setup Authentication.`_ + +.. _Select or create a Cloud Platform project.: https://console.cloud.google.com/project +.. _Enable billing for your project.: https://cloud.google.com/billing/docs/how-to/modify-project#enable_billing_for_a_project +.. _Setup Authentication.: https://googleapis.dev/python/google-api-core/latest/auth.html + +Installation +~~~~~~~~~~~~ + +Install this library in a `virtualenv`_ using pip. `virtualenv`_ is a tool to +create isolated Python environments. The basic problem it addresses is one of +dependencies and versions, and indirectly permissions. + +With `virtualenv`_, it's possible to install this library without needing system +install permissions, and without clashing with the installed system +dependencies. + +.. _`virtualenv`: https://virtualenv.pypa.io/en/latest/ + + +Mac/Linux +^^^^^^^^^ + +.. code-block:: console + + python3 -m venv + source /bin/activate + /bin/pip install /path/to/library + + +Windows +^^^^^^^ + +.. code-block:: console + + python3 -m venv + \Scripts\activate + \Scripts\pip.exe install \path\to\library diff --git a/owl-bot-staging/v1/docs/conf.py b/owl-bot-staging/v1/docs/conf.py new file mode 100644 index 0000000..529fb70 --- /dev/null +++ b/owl-bot-staging/v1/docs/conf.py @@ -0,0 +1,376 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# +# google-cloud-private-ca documentation build configuration file +# +# This file is execfile()d with the current directory set to its +# containing dir. +# +# Note that not all possible configuration values are present in this +# autogenerated file. +# +# All configuration values have a default; values that are commented out +# serve to show the default. + +import sys +import os +import shlex + +# If extensions (or modules to document with autodoc) are in another directory, +# add these directories to sys.path here. If the directory is relative to the +# documentation root, use os.path.abspath to make it absolute, like shown here. +sys.path.insert(0, os.path.abspath("..")) + +__version__ = "0.1.0" + +# -- General configuration ------------------------------------------------ + +# If your documentation needs a minimal Sphinx version, state it here. +needs_sphinx = "4.0.1" + +# Add any Sphinx extension module names here, as strings. They can be +# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom +# ones. +extensions = [ + "sphinx.ext.autodoc", + "sphinx.ext.autosummary", + "sphinx.ext.intersphinx", + "sphinx.ext.coverage", + "sphinx.ext.napoleon", + "sphinx.ext.todo", + "sphinx.ext.viewcode", +] + +# autodoc/autosummary flags +autoclass_content = "both" +autodoc_default_flags = ["members"] +autosummary_generate = True + + +# Add any paths that contain templates here, relative to this directory. +templates_path = ["_templates"] + +# Allow markdown includes (so releases.md can include CHANGLEOG.md) +# http://www.sphinx-doc.org/en/master/markdown.html +source_parsers = {".md": "recommonmark.parser.CommonMarkParser"} + +# The suffix(es) of source filenames. +# You can specify multiple suffix as a list of string: +source_suffix = [".rst", ".md"] + +# The encoding of source files. +# source_encoding = 'utf-8-sig' + +# The root toctree document. +root_doc = "index" + +# General information about the project. +project = u"google-cloud-private-ca" +copyright = u"2022, Google, LLC" +author = u"Google APIs" # TODO: autogenerate this bit + +# The version info for the project you're documenting, acts as replacement for +# |version| and |release|, also used in various other places throughout the +# built documents. +# +# The full version, including alpha/beta/rc tags. +release = __version__ +# The short X.Y version. +version = ".".join(release.split(".")[0:2]) + +# The language for content autogenerated by Sphinx. Refer to documentation +# for a list of supported languages. +# +# This is also used if you do content translation via gettext catalogs. +# Usually you set "language" from the command line for these cases. +language = None + +# There are two options for replacing |today|: either, you set today to some +# non-false value, then it is used: +# today = '' +# Else, today_fmt is used as the format for a strftime call. +# today_fmt = '%B %d, %Y' + +# List of patterns, relative to source directory, that match files and +# directories to ignore when looking for source files. +exclude_patterns = ["_build"] + +# The reST default role (used for this markup: `text`) to use for all +# documents. +# default_role = None + +# If true, '()' will be appended to :func: etc. cross-reference text. +# add_function_parentheses = True + +# If true, the current module name will be prepended to all description +# unit titles (such as .. function::). +# add_module_names = True + +# If true, sectionauthor and moduleauthor directives will be shown in the +# output. They are ignored by default. +# show_authors = False + +# The name of the Pygments (syntax highlighting) style to use. +pygments_style = "sphinx" + +# A list of ignored prefixes for module index sorting. +# modindex_common_prefix = [] + +# If true, keep warnings as "system message" paragraphs in the built documents. +# keep_warnings = False + +# If true, `todo` and `todoList` produce output, else they produce nothing. +todo_include_todos = True + + +# -- Options for HTML output ---------------------------------------------- + +# The theme to use for HTML and HTML Help pages. See the documentation for +# a list of builtin themes. +html_theme = "alabaster" + +# Theme options are theme-specific and customize the look and feel of a theme +# further. For a list of options available for each theme, see the +# documentation. +html_theme_options = { + "description": "Google Cloud Security Client Libraries for Python", + "github_user": "googleapis", + "github_repo": "google-cloud-python", + "github_banner": True, + "font_family": "'Roboto', Georgia, sans", + "head_font_family": "'Roboto', Georgia, serif", + "code_font_family": "'Roboto Mono', 'Consolas', monospace", +} + +# Add any paths that contain custom themes here, relative to this directory. +# html_theme_path = [] + +# The name for this set of Sphinx documents. If None, it defaults to +# " v documentation". +# html_title = None + +# A shorter title for the navigation bar. Default is the same as html_title. +# html_short_title = None + +# The name of an image file (relative to this directory) to place at the top +# of the sidebar. +# html_logo = None + +# The name of an image file (within the static path) to use as favicon of the +# docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32 +# pixels large. +# html_favicon = None + +# Add any paths that contain custom static files (such as style sheets) here, +# relative to this directory. They are copied after the builtin static files, +# so a file named "default.css" will overwrite the builtin "default.css". +html_static_path = ["_static"] + +# Add any extra paths that contain custom files (such as robots.txt or +# .htaccess) here, relative to this directory. These files are copied +# directly to the root of the documentation. +# html_extra_path = [] + +# If not '', a 'Last updated on:' timestamp is inserted at every page bottom, +# using the given strftime format. +# html_last_updated_fmt = '%b %d, %Y' + +# If true, SmartyPants will be used to convert quotes and dashes to +# typographically correct entities. +# html_use_smartypants = True + +# Custom sidebar templates, maps document names to template names. +# html_sidebars = {} + +# Additional templates that should be rendered to pages, maps page names to +# template names. +# html_additional_pages = {} + +# If false, no module index is generated. +# html_domain_indices = True + +# If false, no index is generated. +# html_use_index = True + +# If true, the index is split into individual pages for each letter. +# html_split_index = False + +# If true, links to the reST sources are added to the pages. +# html_show_sourcelink = True + +# If true, "Created using Sphinx" is shown in the HTML footer. Default is True. +# html_show_sphinx = True + +# If true, "(C) Copyright ..." is shown in the HTML footer. Default is True. +# html_show_copyright = True + +# If true, an OpenSearch description file will be output, and all pages will +# contain a tag referring to it. The value of this option must be the +# base URL from which the finished HTML is served. +# html_use_opensearch = '' + +# This is the file name suffix for HTML files (e.g. ".xhtml"). +# html_file_suffix = None + +# Language to be used for generating the HTML full-text search index. +# Sphinx supports the following languages: +# 'da', 'de', 'en', 'es', 'fi', 'fr', 'hu', 'it', 'ja' +# 'nl', 'no', 'pt', 'ro', 'ru', 'sv', 'tr' +# html_search_language = 'en' + +# A dictionary with options for the search language support, empty by default. +# Now only 'ja' uses this config value +# html_search_options = {'type': 'default'} + +# The name of a javascript file (relative to the configuration directory) that +# implements a search results scorer. If empty, the default will be used. +# html_search_scorer = 'scorer.js' + +# Output file base name for HTML help builder. +htmlhelp_basename = "google-cloud-private-ca-doc" + +# -- Options for warnings ------------------------------------------------------ + + +suppress_warnings = [ + # Temporarily suppress this to avoid "more than one target found for + # cross-reference" warning, which are intractable for us to avoid while in + # a mono-repo. + # See https://github.com/sphinx-doc/sphinx/blob + # /2a65ffeef5c107c19084fabdd706cdff3f52d93c/sphinx/domains/python.py#L843 + "ref.python" +] + +# -- Options for LaTeX output --------------------------------------------- + +latex_elements = { + # The paper size ('letterpaper' or 'a4paper'). + # 'papersize': 'letterpaper', + # The font size ('10pt', '11pt' or '12pt'). + # 'pointsize': '10pt', + # Additional stuff for the LaTeX preamble. + # 'preamble': '', + # Latex figure (float) alignment + # 'figure_align': 'htbp', +} + +# Grouping the document tree into LaTeX files. List of tuples +# (source start file, target name, title, +# author, documentclass [howto, manual, or own class]). +latex_documents = [ + ( + root_doc, + "google-cloud-private-ca.tex", + u"google-cloud-private-ca Documentation", + author, + "manual", + ) +] + +# The name of an image file (relative to this directory) to place at the top of +# the title page. +# latex_logo = None + +# For "manual" documents, if this is true, then toplevel headings are parts, +# not chapters. +# latex_use_parts = False + +# If true, show page references after internal links. +# latex_show_pagerefs = False + +# If true, show URL addresses after external links. +# latex_show_urls = False + +# Documents to append as an appendix to all manuals. +# latex_appendices = [] + +# If false, no module index is generated. +# latex_domain_indices = True + + +# -- Options for manual page output --------------------------------------- + +# One entry per manual page. List of tuples +# (source start file, name, description, authors, manual section). +man_pages = [ + ( + root_doc, + "google-cloud-private-ca", + u"Google Cloud Security Privateca Documentation", + [author], + 1, + ) +] + +# If true, show URL addresses after external links. +# man_show_urls = False + + +# -- Options for Texinfo output ------------------------------------------- + +# Grouping the document tree into Texinfo files. List of tuples +# (source start file, target name, title, author, +# dir menu entry, description, category) +texinfo_documents = [ + ( + root_doc, + "google-cloud-private-ca", + u"google-cloud-private-ca Documentation", + author, + "google-cloud-private-ca", + "GAPIC library for Google Cloud Security Privateca API", + "APIs", + ) +] + +# Documents to append as an appendix to all manuals. +# texinfo_appendices = [] + +# If false, no module index is generated. +# texinfo_domain_indices = True + +# How to display URL addresses: 'footnote', 'no', or 'inline'. +# texinfo_show_urls = 'footnote' + +# If true, do not generate a @detailmenu in the "Top" node's menu. +# texinfo_no_detailmenu = False + + +# Example configuration for intersphinx: refer to the Python standard library. +intersphinx_mapping = { + "python": ("http://python.readthedocs.org/en/latest/", None), + "gax": ("https://gax-python.readthedocs.org/en/latest/", None), + "google-auth": ("https://google-auth.readthedocs.io/en/stable", None), + "google-gax": ("https://gax-python.readthedocs.io/en/latest/", None), + "google.api_core": ("https://googleapis.dev/python/google-api-core/latest/", None), + "grpc": ("https://grpc.io/grpc/python/", None), + "requests": ("http://requests.kennethreitz.org/en/stable/", None), + "proto": ("https://proto-plus-python.readthedocs.io/en/stable", None), + "protobuf": ("https://googleapis.dev/python/protobuf/latest/", None), +} + + +# Napoleon settings +napoleon_google_docstring = True +napoleon_numpy_docstring = True +napoleon_include_private_with_doc = False +napoleon_include_special_with_doc = True +napoleon_use_admonition_for_examples = False +napoleon_use_admonition_for_notes = False +napoleon_use_admonition_for_references = False +napoleon_use_ivar = False +napoleon_use_param = True +napoleon_use_rtype = True diff --git a/owl-bot-staging/v1/docs/index.rst b/owl-bot-staging/v1/docs/index.rst new file mode 100644 index 0000000..eadcd6d --- /dev/null +++ b/owl-bot-staging/v1/docs/index.rst @@ -0,0 +1,7 @@ +API Reference +------------- +.. toctree:: + :maxdepth: 2 + + privateca_v1/services + privateca_v1/types diff --git a/owl-bot-staging/v1/docs/privateca_v1/certificate_authority_service.rst b/owl-bot-staging/v1/docs/privateca_v1/certificate_authority_service.rst new file mode 100644 index 0000000..00601bc --- /dev/null +++ b/owl-bot-staging/v1/docs/privateca_v1/certificate_authority_service.rst @@ -0,0 +1,10 @@ +CertificateAuthorityService +--------------------------------------------- + +.. automodule:: google.cloud.security.privateca_v1.services.certificate_authority_service + :members: + :inherited-members: + +.. automodule:: google.cloud.security.privateca_v1.services.certificate_authority_service.pagers + :members: + :inherited-members: diff --git a/owl-bot-staging/v1/docs/privateca_v1/services.rst b/owl-bot-staging/v1/docs/privateca_v1/services.rst new file mode 100644 index 0000000..6b8d380 --- /dev/null +++ b/owl-bot-staging/v1/docs/privateca_v1/services.rst @@ -0,0 +1,6 @@ +Services for Google Cloud Security Privateca v1 API +=================================================== +.. toctree:: + :maxdepth: 2 + + certificate_authority_service diff --git a/owl-bot-staging/v1/docs/privateca_v1/types.rst b/owl-bot-staging/v1/docs/privateca_v1/types.rst new file mode 100644 index 0000000..feda2ff --- /dev/null +++ b/owl-bot-staging/v1/docs/privateca_v1/types.rst @@ -0,0 +1,6 @@ +Types for Google Cloud Security Privateca v1 API +================================================ + +.. automodule:: google.cloud.security.privateca_v1.types + :members: + :show-inheritance: diff --git a/owl-bot-staging/v1/google/cloud/security/privateca/__init__.py b/owl-bot-staging/v1/google/cloud/security/privateca/__init__.py new file mode 100644 index 0000000..38ab9b6 --- /dev/null +++ b/owl-bot-staging/v1/google/cloud/security/privateca/__init__.py @@ -0,0 +1,139 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +from google.cloud.security.privateca import gapic_version as package_version + +__version__ = package_version.__version__ + + +from google.cloud.security.privateca_v1.services.certificate_authority_service.client import CertificateAuthorityServiceClient +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_v1.types.service import CreateCaPoolRequest +from google.cloud.security.privateca_v1.types.service import CreateCertificateAuthorityRequest +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_v1.types.service import DeleteCertificateTemplateRequest +from google.cloud.security.privateca_v1.types.service import DisableCertificateAuthorityRequest +from google.cloud.security.privateca_v1.types.service import EnableCertificateAuthorityRequest +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_v1.types.service import FetchCertificateAuthorityCsrResponse +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_v1.types.service import GetCertificateRequest +from google.cloud.security.privateca_v1.types.service import GetCertificateRevocationListRequest +from google.cloud.security.privateca_v1.types.service import GetCertificateTemplateRequest +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_v1.types.service import ListCertificateAuthoritiesResponse +from google.cloud.security.privateca_v1.types.service import ListCertificateRevocationListsRequest +from google.cloud.security.privateca_v1.types.service import ListCertificateRevocationListsResponse +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_v1.types.service import ListCertificateTemplatesResponse +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_v1.types.service import UpdateCaPoolRequest +from google.cloud.security.privateca_v1.types.service import UpdateCertificateAuthorityRequest +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__ = ('CertificateAuthorityServiceClient', + 'CertificateAuthorityServiceAsyncClient', + 'CaPool', + 'Certificate', + 'CertificateAuthority', + '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', + 'GetCertificateTemplateRequest', + 'ListCaPoolsRequest', + 'ListCaPoolsResponse', + 'ListCertificateAuthoritiesRequest', + 'ListCertificateAuthoritiesResponse', + 'ListCertificateRevocationListsRequest', + 'ListCertificateRevocationListsResponse', + 'ListCertificatesRequest', + 'ListCertificatesResponse', + 'ListCertificateTemplatesRequest', + 'ListCertificateTemplatesResponse', + 'OperationMetadata', + 'RevokeCertificateRequest', + 'UndeleteCertificateAuthorityRequest', + 'UpdateCaPoolRequest', + 'UpdateCertificateAuthorityRequest', + 'UpdateCertificateRequest', + 'UpdateCertificateRevocationListRequest', + 'UpdateCertificateTemplateRequest', +) diff --git a/owl-bot-staging/v1/google/cloud/security/privateca/gapic_version.py b/owl-bot-staging/v1/google/cloud/security/privateca/gapic_version.py new file mode 100644 index 0000000..405b1ce --- /dev/null +++ b/owl-bot-staging/v1/google/cloud/security/privateca/gapic_version.py @@ -0,0 +1,16 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +__version__ = "0.1.0" # {x-release-please-version} diff --git a/owl-bot-staging/v1/google/cloud/security/privateca/py.typed b/owl-bot-staging/v1/google/cloud/security/privateca/py.typed new file mode 100644 index 0000000..2803606 --- /dev/null +++ b/owl-bot-staging/v1/google/cloud/security/privateca/py.typed @@ -0,0 +1,2 @@ +# Marker file for PEP 561. +# The google-cloud-private-ca package uses inline types. diff --git a/owl-bot-staging/v1/google/cloud/security/privateca_v1/__init__.py b/owl-bot-staging/v1/google/cloud/security/privateca_v1/__init__.py new file mode 100644 index 0000000..eb16df3 --- /dev/null +++ b/owl-bot-staging/v1/google/cloud/security/privateca_v1/__init__.py @@ -0,0 +1,140 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +from google.cloud.security.privateca_v1 import gapic_version as package_version + +__version__ = package_version.__version__ + + +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 +from .types.resources import CertificateConfig +from .types.resources import CertificateDescription +from .types.resources import CertificateExtensionConstraints +from .types.resources import CertificateIdentityConstraints +from .types.resources import CertificateRevocationList +from .types.resources import CertificateTemplate +from .types.resources import KeyUsage +from .types.resources import ObjectId +from .types.resources import PublicKey +from .types.resources import Subject +from .types.resources import SubjectAltNames +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 +from .types.service import CreateCertificateRequest +from .types.service import CreateCertificateTemplateRequest +from .types.service import DeleteCaPoolRequest +from .types.service import DeleteCertificateAuthorityRequest +from .types.service import DeleteCertificateTemplateRequest +from .types.service import DisableCertificateAuthorityRequest +from .types.service import EnableCertificateAuthorityRequest +from .types.service import FetchCaCertsRequest +from .types.service import FetchCaCertsResponse +from .types.service import FetchCertificateAuthorityCsrRequest +from .types.service import FetchCertificateAuthorityCsrResponse +from .types.service import GetCaPoolRequest +from .types.service import GetCertificateAuthorityRequest +from .types.service import GetCertificateRequest +from .types.service import GetCertificateRevocationListRequest +from .types.service import GetCertificateTemplateRequest +from .types.service import ListCaPoolsRequest +from .types.service import ListCaPoolsResponse +from .types.service import ListCertificateAuthoritiesRequest +from .types.service import ListCertificateAuthoritiesResponse +from .types.service import ListCertificateRevocationListsRequest +from .types.service import ListCertificateRevocationListsResponse +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 +from .types.service import UpdateCaPoolRequest +from .types.service import UpdateCertificateAuthorityRequest +from .types.service import UpdateCertificateRequest +from .types.service import UpdateCertificateRevocationListRequest +from .types.service import UpdateCertificateTemplateRequest + +__all__ = ( + 'CertificateAuthorityServiceAsyncClient', +'ActivateCertificateAuthorityRequest', +'CaPool', +'Certificate', +'CertificateAuthority', +'CertificateAuthorityServiceClient', +'CertificateConfig', +'CertificateDescription', +'CertificateExtensionConstraints', +'CertificateIdentityConstraints', +'CertificateRevocationList', +'CertificateTemplate', +'CreateCaPoolRequest', +'CreateCertificateAuthorityRequest', +'CreateCertificateRequest', +'CreateCertificateTemplateRequest', +'DeleteCaPoolRequest', +'DeleteCertificateAuthorityRequest', +'DeleteCertificateTemplateRequest', +'DisableCertificateAuthorityRequest', +'EnableCertificateAuthorityRequest', +'FetchCaCertsRequest', +'FetchCaCertsResponse', +'FetchCertificateAuthorityCsrRequest', +'FetchCertificateAuthorityCsrResponse', +'GetCaPoolRequest', +'GetCertificateAuthorityRequest', +'GetCertificateRequest', +'GetCertificateRevocationListRequest', +'GetCertificateTemplateRequest', +'KeyUsage', +'ListCaPoolsRequest', +'ListCaPoolsResponse', +'ListCertificateAuthoritiesRequest', +'ListCertificateAuthoritiesResponse', +'ListCertificateRevocationListsRequest', +'ListCertificateRevocationListsResponse', +'ListCertificateTemplatesRequest', +'ListCertificateTemplatesResponse', +'ListCertificatesRequest', +'ListCertificatesResponse', +'ObjectId', +'OperationMetadata', +'PublicKey', +'RevocationReason', +'RevokeCertificateRequest', +'Subject', +'SubjectAltNames', +'SubjectRequestMode', +'SubordinateConfig', +'UndeleteCertificateAuthorityRequest', +'UpdateCaPoolRequest', +'UpdateCertificateAuthorityRequest', +'UpdateCertificateRequest', +'UpdateCertificateRevocationListRequest', +'UpdateCertificateTemplateRequest', +'X509Extension', +'X509Parameters', +) diff --git a/owl-bot-staging/v1/google/cloud/security/privateca_v1/gapic_metadata.json b/owl-bot-staging/v1/google/cloud/security/privateca_v1/gapic_metadata.json new file mode 100644 index 0000000..9eb6757 --- /dev/null +++ b/owl-bot-staging/v1/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/owl-bot-staging/v1/google/cloud/security/privateca_v1/gapic_version.py b/owl-bot-staging/v1/google/cloud/security/privateca_v1/gapic_version.py new file mode 100644 index 0000000..405b1ce --- /dev/null +++ b/owl-bot-staging/v1/google/cloud/security/privateca_v1/gapic_version.py @@ -0,0 +1,16 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +__version__ = "0.1.0" # {x-release-please-version} diff --git a/owl-bot-staging/v1/google/cloud/security/privateca_v1/py.typed b/owl-bot-staging/v1/google/cloud/security/privateca_v1/py.typed new file mode 100644 index 0000000..2803606 --- /dev/null +++ b/owl-bot-staging/v1/google/cloud/security/privateca_v1/py.typed @@ -0,0 +1,2 @@ +# Marker file for PEP 561. +# The google-cloud-private-ca package uses inline types. diff --git a/owl-bot-staging/v1/google/cloud/security/privateca_v1/services/__init__.py b/owl-bot-staging/v1/google/cloud/security/privateca_v1/services/__init__.py new file mode 100644 index 0000000..e8e1c38 --- /dev/null +++ b/owl-bot-staging/v1/google/cloud/security/privateca_v1/services/__init__.py @@ -0,0 +1,15 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# diff --git a/owl-bot-staging/v1/google/cloud/security/privateca_v1/services/certificate_authority_service/__init__.py b/owl-bot-staging/v1/google/cloud/security/privateca_v1/services/certificate_authority_service/__init__.py new file mode 100644 index 0000000..713bfd9 --- /dev/null +++ b/owl-bot-staging/v1/google/cloud/security/privateca_v1/services/certificate_authority_service/__init__.py @@ -0,0 +1,22 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +from .client import CertificateAuthorityServiceClient +from .async_client import CertificateAuthorityServiceAsyncClient + +__all__ = ( + 'CertificateAuthorityServiceClient', + 'CertificateAuthorityServiceAsyncClient', +) diff --git a/owl-bot-staging/v1/google/cloud/security/privateca_v1/services/certificate_authority_service/async_client.py b/owl-bot-staging/v1/google/cloud/security/privateca_v1/services/certificate_authority_service/async_client.py new file mode 100644 index 0000000..f46cfa8 --- /dev/null +++ b/owl-bot-staging/v1/google/cloud/security/privateca_v1/services/certificate_authority_service/async_client.py @@ -0,0 +1,3752 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +from collections import OrderedDict +import functools +import re +from typing import Dict, Mapping, MutableMapping, MutableSequence, Optional, Sequence, Tuple, Type, Union + +from google.cloud.security.privateca_v1 import gapic_version as package_version + +from google.api_core.client_options import ClientOptions +from google.api_core import exceptions as core_exceptions +from google.api_core import gapic_v1 +from google.api_core import retry as retries +from google.auth import credentials as ga_credentials # type: ignore +from google.oauth2 import service_account # type: ignore + +try: + OptionalRetry = Union[retries.Retry, gapic_v1.method._MethodDefault] +except AttributeError: # pragma: NO COVER + OptionalRetry = Union[retries.Retry, object] # type: ignore + +from google.api_core import operation # type: ignore +from google.api_core import operation_async # type: ignore +from google.cloud.security.privateca_v1.services.certificate_authority_service import pagers +from google.cloud.security.privateca_v1.types import resources +from google.cloud.security.privateca_v1.types import service +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 + + +class CertificateAuthorityServiceAsyncClient: + """[Certificate Authority + Service][google.cloud.security.privateca.v1.CertificateAuthorityService] + manages private certificate authorities and issued certificates. + """ + + _client: CertificateAuthorityServiceClient + + DEFAULT_ENDPOINT = CertificateAuthorityServiceClient.DEFAULT_ENDPOINT + DEFAULT_MTLS_ENDPOINT = CertificateAuthorityServiceClient.DEFAULT_MTLS_ENDPOINT + + ca_pool_path = staticmethod(CertificateAuthorityServiceClient.ca_pool_path) + parse_ca_pool_path = staticmethod(CertificateAuthorityServiceClient.parse_ca_pool_path) + certificate_path = staticmethod(CertificateAuthorityServiceClient.certificate_path) + parse_certificate_path = staticmethod(CertificateAuthorityServiceClient.parse_certificate_path) + certificate_authority_path = staticmethod(CertificateAuthorityServiceClient.certificate_authority_path) + parse_certificate_authority_path = staticmethod(CertificateAuthorityServiceClient.parse_certificate_authority_path) + certificate_revocation_list_path = staticmethod(CertificateAuthorityServiceClient.certificate_revocation_list_path) + parse_certificate_revocation_list_path = staticmethod(CertificateAuthorityServiceClient.parse_certificate_revocation_list_path) + certificate_template_path = staticmethod(CertificateAuthorityServiceClient.certificate_template_path) + 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) + parse_common_location_path = staticmethod(CertificateAuthorityServiceClient.parse_common_location_path) + + @classmethod + def from_service_account_info(cls, info: dict, *args, **kwargs): + """Creates an instance of this client using the provided credentials + info. + + Args: + info (dict): The service account private key info. + args: Additional arguments to pass to the constructor. + kwargs: Additional arguments to pass to the constructor. + + Returns: + CertificateAuthorityServiceAsyncClient: The constructed client. + """ + return CertificateAuthorityServiceClient.from_service_account_info.__func__(CertificateAuthorityServiceAsyncClient, info, *args, **kwargs) # type: ignore + + @classmethod + def from_service_account_file(cls, filename: str, *args, **kwargs): + """Creates an instance of this client using the provided credentials + file. + + Args: + filename (str): The path to the service account private key json + file. + args: Additional arguments to pass to the constructor. + kwargs: Additional arguments to pass to the constructor. + + Returns: + CertificateAuthorityServiceAsyncClient: The constructed client. + """ + return CertificateAuthorityServiceClient.from_service_account_file.__func__(CertificateAuthorityServiceAsyncClient, filename, *args, **kwargs) # type: ignore + + from_service_account_json = from_service_account_file + + @classmethod + def get_mtls_endpoint_and_cert_source(cls, client_options: Optional[ClientOptions] = None): + """Return the API endpoint and client cert source for mutual TLS. + + The client cert source is determined in the following order: + (1) if `GOOGLE_API_USE_CLIENT_CERTIFICATE` environment variable is not "true", the + client cert source is None. + (2) if `client_options.client_cert_source` is provided, use the provided one; if the + default client cert source exists, use the default one; otherwise the client cert + source is None. + + The API endpoint is determined in the following order: + (1) if `client_options.api_endpoint` if provided, use the provided one. + (2) if `GOOGLE_API_USE_CLIENT_CERTIFICATE` environment variable is "always", use the + default mTLS endpoint; if the environment variable is "never", use the default API + endpoint; otherwise if client cert source exists, use the default mTLS endpoint, otherwise + use the default API endpoint. + + More details can be found at https://google.aip.dev/auth/4114. + + Args: + client_options (google.api_core.client_options.ClientOptions): Custom options for the + client. Only the `api_endpoint` and `client_cert_source` properties may be used + in this method. + + Returns: + Tuple[str, Callable[[], Tuple[bytes, bytes]]]: returns the API endpoint and the + client cert source to use. + + Raises: + google.auth.exceptions.MutualTLSChannelError: If any errors happen. + """ + return CertificateAuthorityServiceClient.get_mtls_endpoint_and_cert_source(client_options) # type: ignore + + @property + def transport(self) -> CertificateAuthorityServiceTransport: + """Returns the transport used by the client instance. + + Returns: + CertificateAuthorityServiceTransport: The transport used by the client instance. + """ + return self._client.transport + + get_transport_class = functools.partial(type(CertificateAuthorityServiceClient).get_transport_class, type(CertificateAuthorityServiceClient)) + + def __init__(self, *, + credentials: Optional[ga_credentials.Credentials] = None, + transport: Union[str, CertificateAuthorityServiceTransport] = "grpc_asyncio", + client_options: Optional[ClientOptions] = None, + client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, + ) -> None: + """Instantiates the certificate authority service client. + + Args: + credentials (Optional[google.auth.credentials.Credentials]): The + authorization credentials to attach to requests. These + credentials identify the application to the service; if none + are specified, the client will attempt to ascertain the + credentials from the environment. + transport (Union[str, ~.CertificateAuthorityServiceTransport]): The + transport to use. If set to None, a transport is chosen + automatically. + client_options (ClientOptions): Custom options for the client. It + won't take effect if a ``transport`` instance is provided. + (1) The ``api_endpoint`` property can be used to override the + default endpoint provided by the client. GOOGLE_API_USE_MTLS_ENDPOINT + environment variable can also be used to override the endpoint: + "always" (always use the default mTLS endpoint), "never" (always + use the default regular endpoint) and "auto" (auto switch to the + default mTLS endpoint if client certificate is present, this is + the default value). However, the ``api_endpoint`` property takes + precedence if provided. + (2) If GOOGLE_API_USE_CLIENT_CERTIFICATE environment variable + is "true", then the ``client_cert_source`` property can be used + to provide client certificate for mutual TLS transport. If + not provided, the default SSL client certificate will be used if + present. If GOOGLE_API_USE_CLIENT_CERTIFICATE is "false" or not + set, no client certificate will be used. + + Raises: + google.auth.exceptions.MutualTlsChannelError: If mutual TLS transport + creation failed for any reason. + """ + self._client = CertificateAuthorityServiceClient( + credentials=credentials, + transport=transport, + client_options=client_options, + client_info=client_info, + + ) + + async def create_certificate(self, + request: Optional[Union[service.CreateCertificateRequest, dict]] = None, + *, + parent: Optional[str] = None, + certificate: Optional[resources.Certificate] = None, + certificate_id: Optional[str] = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, str]] = (), + ) -> resources.Certificate: + r"""Create a new + [Certificate][google.cloud.security.privateca.v1.Certificate] in + a given Project, Location from a particular + [CaPool][google.cloud.security.privateca.v1.CaPool]. + + .. code-block:: python + + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html + from google.cloud.security import privateca_v1 + + async def sample_create_certificate(): + # Create a client + client = privateca_v1.CertificateAuthorityServiceAsyncClient() + + # Initialize request argument(s) + certificate = privateca_v1.Certificate() + certificate.pem_csr = "pem_csr_value" + + request = privateca_v1.CreateCertificateRequest( + parent="parent_value", + certificate=certificate, + ) + + # Make the request + response = await client.create_certificate(request=request) + + # Handle the response + print(response) + + Args: + request (Optional[Union[google.cloud.security.privateca_v1.types.CreateCertificateRequest, dict]]): + The request object. Request message for + [CertificateAuthorityService.CreateCertificate][google.cloud.security.privateca.v1.CertificateAuthorityService.CreateCertificate]. + parent (:class:`str`): + Required. The resource name of the + [CaPool][google.cloud.security.privateca.v1.CaPool] + associated with the + [Certificate][google.cloud.security.privateca.v1.Certificate], + in the format ``projects/*/locations/*/caPools/*``. + + This corresponds to the ``parent`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + certificate (:class:`google.cloud.security.privateca_v1.types.Certificate`): + Required. A + [Certificate][google.cloud.security.privateca.v1.Certificate] + with initial field values. + + This corresponds to the ``certificate`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + certificate_id (:class:`str`): + Optional. It must be unique within a location and match + the regular expression ``[a-zA-Z0-9_-]{1,63}``. This + field is required when using a + [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority] + in the Enterprise [CertificateAuthority.Tier][], but is + optional and its value is ignored otherwise. + + 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. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.cloud.security.privateca_v1.types.Certificate: + A [Certificate][google.cloud.security.privateca.v1.Certificate] corresponds to a signed X.509 certificate issued by a + [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority]. + + """ + # Create or coerce a protobuf request object. + # Quick check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([parent, certificate, certificate_id]) + if request is not None and has_flattened_params: + raise ValueError("If the `request` argument is set, then none of " + "the individual field arguments should be set.") + + 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: + request.certificate = certificate + if certificate_id is not None: + request.certificate_id = certificate_id + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method_async.wrap_method( + self._client._transport.create_certificate, + default_timeout=None, + client_info=DEFAULT_CLIENT_INFO, + ) + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata(( + ("parent", request.parent), + )), + ) + + # Send the request. + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Done; return the response. + return response + + async def get_certificate(self, + request: Optional[Union[service.GetCertificateRequest, dict]] = None, + *, + name: Optional[str] = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, str]] = (), + ) -> resources.Certificate: + r"""Returns a + [Certificate][google.cloud.security.privateca.v1.Certificate]. + + .. code-block:: python + + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html + from google.cloud.security import privateca_v1 + + async def sample_get_certificate(): + # Create a client + client = privateca_v1.CertificateAuthorityServiceAsyncClient() + + # Initialize request argument(s) + request = privateca_v1.GetCertificateRequest( + name="name_value", + ) + + # Make the request + response = await client.get_certificate(request=request) + + # Handle the response + print(response) + + Args: + request (Optional[Union[google.cloud.security.privateca_v1.types.GetCertificateRequest, dict]]): + The request object. Request message for + [CertificateAuthorityService.GetCertificate][google.cloud.security.privateca.v1.CertificateAuthorityService.GetCertificate]. + name (:class:`str`): + Required. The + [name][google.cloud.security.privateca.v1.Certificate.name] + of the + [Certificate][google.cloud.security.privateca.v1.Certificate] + to get. + + 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. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.cloud.security.privateca_v1.types.Certificate: + A [Certificate][google.cloud.security.privateca.v1.Certificate] corresponds to a signed X.509 certificate issued by a + [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority]. + + """ + # Create or coerce a protobuf request object. + # Quick check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([name]) + if request is not None and has_flattened_params: + raise ValueError("If the `request` argument is set, then none of " + "the individual field arguments should be set.") + + 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 + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method_async.wrap_method( + self._client._transport.get_certificate, + default_timeout=None, + client_info=DEFAULT_CLIENT_INFO, + ) + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata(( + ("name", request.name), + )), + ) + + # Send the request. + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Done; return the response. + return response + + async def list_certificates(self, + request: Optional[Union[service.ListCertificatesRequest, dict]] = None, + *, + parent: Optional[str] = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, str]] = (), + ) -> pagers.ListCertificatesAsyncPager: + r"""Lists + [Certificates][google.cloud.security.privateca.v1.Certificate]. + + .. code-block:: python + + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html + from google.cloud.security import privateca_v1 + + async def sample_list_certificates(): + # Create a client + client = privateca_v1.CertificateAuthorityServiceAsyncClient() + + # Initialize request argument(s) + request = privateca_v1.ListCertificatesRequest( + parent="parent_value", + ) + + # Make the request + page_result = client.list_certificates(request=request) + + # Handle the response + async for response in page_result: + print(response) + + Args: + request (Optional[Union[google.cloud.security.privateca_v1.types.ListCertificatesRequest, dict]]): + The request object. Request message for + [CertificateAuthorityService.ListCertificates][google.cloud.security.privateca.v1.CertificateAuthorityService.ListCertificates]. + parent (:class:`str`): + Required. The resource name of the location associated + with the + [Certificates][google.cloud.security.privateca.v1.Certificate], + in the format ``projects/*/locations/*/caPools/*``. + + 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. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.cloud.security.privateca_v1.services.certificate_authority_service.pagers.ListCertificatesAsyncPager: + Response message for + [CertificateAuthorityService.ListCertificates][google.cloud.security.privateca.v1.CertificateAuthorityService.ListCertificates]. + + Iterating over this object will yield results and + resolve additional pages automatically. + + """ + # Create or coerce a protobuf request object. + # Quick check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([parent]) + if request is not None and has_flattened_params: + raise ValueError("If the `request` argument is set, then none of " + "the individual field arguments should be set.") + + 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 + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method_async.wrap_method( + self._client._transport.list_certificates, + default_timeout=None, + client_info=DEFAULT_CLIENT_INFO, + ) + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata(( + ("parent", request.parent), + )), + ) + + # Send the request. + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # This method is paged; wrap the response in a pager, which provides + # an `__aiter__` convenience method. + response = pagers.ListCertificatesAsyncPager( + method=rpc, + request=request, + response=response, + metadata=metadata, + ) + + # Done; return the response. + return response + + async def revoke_certificate(self, + request: Optional[Union[service.RevokeCertificateRequest, dict]] = None, + *, + name: Optional[str] = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, str]] = (), + ) -> resources.Certificate: + r"""Revoke a + [Certificate][google.cloud.security.privateca.v1.Certificate]. + + .. code-block:: python + + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html + from google.cloud.security import privateca_v1 + + async def sample_revoke_certificate(): + # Create a client + client = privateca_v1.CertificateAuthorityServiceAsyncClient() + + # Initialize request argument(s) + request = privateca_v1.RevokeCertificateRequest( + name="name_value", + reason="ATTRIBUTE_AUTHORITY_COMPROMISE", + ) + + # Make the request + response = await client.revoke_certificate(request=request) + + # Handle the response + print(response) + + Args: + request (Optional[Union[google.cloud.security.privateca_v1.types.RevokeCertificateRequest, dict]]): + The request object. Request message for + [CertificateAuthorityService.RevokeCertificate][google.cloud.security.privateca.v1.CertificateAuthorityService.RevokeCertificate]. + name (:class:`str`): + Required. The resource name for this + [Certificate][google.cloud.security.privateca.v1.Certificate] + in the format + ``projects/*/locations/*/caPools/*/certificates/*``. + + 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. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.cloud.security.privateca_v1.types.Certificate: + A [Certificate][google.cloud.security.privateca.v1.Certificate] corresponds to a signed X.509 certificate issued by a + [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority]. + + """ + # Create or coerce a protobuf request object. + # Quick check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([name]) + if request is not None and has_flattened_params: + raise ValueError("If the `request` argument is set, then none of " + "the individual field arguments should be set.") + + 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 + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method_async.wrap_method( + self._client._transport.revoke_certificate, + default_timeout=None, + client_info=DEFAULT_CLIENT_INFO, + ) + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata(( + ("name", request.name), + )), + ) + + # Send the request. + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Done; return the response. + return response + + async def update_certificate(self, + request: Optional[Union[service.UpdateCertificateRequest, dict]] = None, + *, + certificate: Optional[resources.Certificate] = None, + update_mask: Optional[field_mask_pb2.FieldMask] = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, str]] = (), + ) -> resources.Certificate: + r"""Update a + [Certificate][google.cloud.security.privateca.v1.Certificate]. + Currently, the only field you can update is the + [labels][google.cloud.security.privateca.v1.Certificate.labels] + field. + + .. code-block:: python + + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html + from google.cloud.security import privateca_v1 + + async def sample_update_certificate(): + # Create a client + client = privateca_v1.CertificateAuthorityServiceAsyncClient() + + # Initialize request argument(s) + certificate = privateca_v1.Certificate() + certificate.pem_csr = "pem_csr_value" + + request = privateca_v1.UpdateCertificateRequest( + certificate=certificate, + ) + + # Make the request + response = await client.update_certificate(request=request) + + # Handle the response + print(response) + + Args: + request (Optional[Union[google.cloud.security.privateca_v1.types.UpdateCertificateRequest, dict]]): + The request object. Request message for + [CertificateAuthorityService.UpdateCertificate][google.cloud.security.privateca.v1.CertificateAuthorityService.UpdateCertificate]. + certificate (:class:`google.cloud.security.privateca_v1.types.Certificate`): + Required. + [Certificate][google.cloud.security.privateca.v1.Certificate] + with updated values. + + This corresponds to the ``certificate`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + update_mask (:class:`google.protobuf.field_mask_pb2.FieldMask`): + Required. A list of fields to be + updated in this request. + + 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. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.cloud.security.privateca_v1.types.Certificate: + A [Certificate][google.cloud.security.privateca.v1.Certificate] corresponds to a signed X.509 certificate issued by a + [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority]. + + """ + # Create or coerce a protobuf request object. + # Quick check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([certificate, update_mask]) + if request is not None and has_flattened_params: + raise ValueError("If the `request` argument is set, then none of " + "the individual field arguments should be set.") + + 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: + request.update_mask = update_mask + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method_async.wrap_method( + self._client._transport.update_certificate, + default_timeout=None, + client_info=DEFAULT_CLIENT_INFO, + ) + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata(( + ("certificate.name", request.certificate.name), + )), + ) + + # Send the request. + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Done; return the response. + return response + + async def activate_certificate_authority(self, + request: Optional[Union[service.ActivateCertificateAuthorityRequest, dict]] = None, + *, + name: Optional[str] = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, str]] = (), + ) -> operation_async.AsyncOperation: + r"""Activate a + [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority] + that is in state + [AWAITING_USER_ACTIVATION][google.cloud.security.privateca.v1.CertificateAuthority.State.AWAITING_USER_ACTIVATION] + and is of type + [SUBORDINATE][google.cloud.security.privateca.v1.CertificateAuthority.Type.SUBORDINATE]. + After the parent Certificate Authority signs a certificate + signing request from + [FetchCertificateAuthorityCsr][google.cloud.security.privateca.v1.CertificateAuthorityService.FetchCertificateAuthorityCsr], + this method can complete the activation process. + + .. code-block:: python + + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html + from google.cloud.security import privateca_v1 + + async def sample_activate_certificate_authority(): + # Create a client + client = privateca_v1.CertificateAuthorityServiceAsyncClient() + + # Initialize request argument(s) + subordinate_config = privateca_v1.SubordinateConfig() + subordinate_config.certificate_authority = "certificate_authority_value" + + request = privateca_v1.ActivateCertificateAuthorityRequest( + name="name_value", + pem_ca_certificate="pem_ca_certificate_value", + subordinate_config=subordinate_config, + ) + + # Make the request + operation = client.activate_certificate_authority(request=request) + + print("Waiting for operation to complete...") + + response = (await operation).result() + + # Handle the response + print(response) + + Args: + request (Optional[Union[google.cloud.security.privateca_v1.types.ActivateCertificateAuthorityRequest, dict]]): + The request object. Request message for + [CertificateAuthorityService.ActivateCertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthorityService.ActivateCertificateAuthority]. + name (:class:`str`): + Required. The resource name for this + [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority] + in the format + ``projects/*/locations/*/caPools/*/certificateAuthorities/*``. + + 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. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.api_core.operation_async.AsyncOperation: + An object representing a long-running operation. + + The result type for the operation will be :class:`google.cloud.security.privateca_v1.types.CertificateAuthority` A [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority] represents an individual Certificate Authority. + A + [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority] + can be used to create + [Certificates][google.cloud.security.privateca.v1.Certificate]. + + """ + # Create or coerce a protobuf request object. + # Quick check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([name]) + if request is not None and has_flattened_params: + raise ValueError("If the `request` argument is set, then none of " + "the individual field arguments should be set.") + + 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 + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method_async.wrap_method( + self._client._transport.activate_certificate_authority, + default_timeout=None, + client_info=DEFAULT_CLIENT_INFO, + ) + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata(( + ("name", request.name), + )), + ) + + # Send the request. + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Wrap the response in an operation future. + response = operation_async.from_gapic( + response, + self._client._transport.operations_client, + resources.CertificateAuthority, + metadata_type=service.OperationMetadata, + ) + + # Done; return the response. + return response + + async def create_certificate_authority(self, + request: Optional[Union[service.CreateCertificateAuthorityRequest, dict]] = None, + *, + parent: Optional[str] = None, + certificate_authority: Optional[resources.CertificateAuthority] = None, + certificate_authority_id: Optional[str] = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, str]] = (), + ) -> operation_async.AsyncOperation: + r"""Create a new + [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority] + in a given Project and Location. + + .. code-block:: python + + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html + from google.cloud.security import privateca_v1 + + async def sample_create_certificate_authority(): + # Create a client + client = privateca_v1.CertificateAuthorityServiceAsyncClient() + + # Initialize request argument(s) + certificate_authority = privateca_v1.CertificateAuthority() + certificate_authority.type_ = "SUBORDINATE" + certificate_authority.key_spec.cloud_kms_key_version = "cloud_kms_key_version_value" + + request = privateca_v1.CreateCertificateAuthorityRequest( + parent="parent_value", + certificate_authority_id="certificate_authority_id_value", + certificate_authority=certificate_authority, + ) + + # Make the request + operation = client.create_certificate_authority(request=request) + + print("Waiting for operation to complete...") + + response = (await operation).result() + + # Handle the response + print(response) + + Args: + request (Optional[Union[google.cloud.security.privateca_v1.types.CreateCertificateAuthorityRequest, dict]]): + The request object. Request message for + [CertificateAuthorityService.CreateCertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthorityService.CreateCertificateAuthority]. + parent (:class:`str`): + Required. The resource name of the + [CaPool][google.cloud.security.privateca.v1.CaPool] + associated with the + [CertificateAuthorities][google.cloud.security.privateca.v1.CertificateAuthority], + in the format ``projects/*/locations/*/caPools/*``. + + This corresponds to the ``parent`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + certificate_authority (:class:`google.cloud.security.privateca_v1.types.CertificateAuthority`): + Required. A + [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority] + with initial field values. + + This corresponds to the ``certificate_authority`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + certificate_authority_id (:class:`str`): + Required. It must be unique within a location and match + the regular expression ``[a-zA-Z0-9_-]{1,63}`` + + 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. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.api_core.operation_async.AsyncOperation: + An object representing a long-running operation. + + The result type for the operation will be :class:`google.cloud.security.privateca_v1.types.CertificateAuthority` A [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority] represents an individual Certificate Authority. + A + [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority] + can be used to create + [Certificates][google.cloud.security.privateca.v1.Certificate]. + + """ + # Create or coerce a protobuf request object. + # Quick check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([parent, certificate_authority, certificate_authority_id]) + if request is not None and has_flattened_params: + raise ValueError("If the `request` argument is set, then none of " + "the individual field arguments should be set.") + + 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: + request.certificate_authority = certificate_authority + if certificate_authority_id is not None: + request.certificate_authority_id = certificate_authority_id + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method_async.wrap_method( + self._client._transport.create_certificate_authority, + default_timeout=None, + client_info=DEFAULT_CLIENT_INFO, + ) + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata(( + ("parent", request.parent), + )), + ) + + # Send the request. + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Wrap the response in an operation future. + response = operation_async.from_gapic( + response, + self._client._transport.operations_client, + resources.CertificateAuthority, + metadata_type=service.OperationMetadata, + ) + + # Done; return the response. + return response + + async def disable_certificate_authority(self, + request: Optional[Union[service.DisableCertificateAuthorityRequest, dict]] = None, + *, + name: Optional[str] = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, str]] = (), + ) -> operation_async.AsyncOperation: + r"""Disable a + [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority]. + + .. code-block:: python + + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html + from google.cloud.security import privateca_v1 + + async def sample_disable_certificate_authority(): + # Create a client + client = privateca_v1.CertificateAuthorityServiceAsyncClient() + + # Initialize request argument(s) + request = privateca_v1.DisableCertificateAuthorityRequest( + name="name_value", + ) + + # Make the request + operation = client.disable_certificate_authority(request=request) + + print("Waiting for operation to complete...") + + response = (await operation).result() + + # Handle the response + print(response) + + Args: + request (Optional[Union[google.cloud.security.privateca_v1.types.DisableCertificateAuthorityRequest, dict]]): + The request object. Request message for + [CertificateAuthorityService.DisableCertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthorityService.DisableCertificateAuthority]. + name (:class:`str`): + Required. The resource name for this + [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority] + in the format + ``projects/*/locations/*/caPools/*/certificateAuthorities/*``. + + 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. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.api_core.operation_async.AsyncOperation: + An object representing a long-running operation. + + The result type for the operation will be :class:`google.cloud.security.privateca_v1.types.CertificateAuthority` A [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority] represents an individual Certificate Authority. + A + [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority] + can be used to create + [Certificates][google.cloud.security.privateca.v1.Certificate]. + + """ + # Create or coerce a protobuf request object. + # Quick check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([name]) + if request is not None and has_flattened_params: + raise ValueError("If the `request` argument is set, then none of " + "the individual field arguments should be set.") + + 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 + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method_async.wrap_method( + self._client._transport.disable_certificate_authority, + default_timeout=None, + client_info=DEFAULT_CLIENT_INFO, + ) + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata(( + ("name", request.name), + )), + ) + + # Send the request. + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Wrap the response in an operation future. + response = operation_async.from_gapic( + response, + self._client._transport.operations_client, + resources.CertificateAuthority, + metadata_type=service.OperationMetadata, + ) + + # Done; return the response. + return response + + async def enable_certificate_authority(self, + request: Optional[Union[service.EnableCertificateAuthorityRequest, dict]] = None, + *, + name: Optional[str] = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, str]] = (), + ) -> operation_async.AsyncOperation: + r"""Enable a + [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority]. + + .. code-block:: python + + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html + from google.cloud.security import privateca_v1 + + async def sample_enable_certificate_authority(): + # Create a client + client = privateca_v1.CertificateAuthorityServiceAsyncClient() + + # Initialize request argument(s) + request = privateca_v1.EnableCertificateAuthorityRequest( + name="name_value", + ) + + # Make the request + operation = client.enable_certificate_authority(request=request) + + print("Waiting for operation to complete...") + + response = (await operation).result() + + # Handle the response + print(response) + + Args: + request (Optional[Union[google.cloud.security.privateca_v1.types.EnableCertificateAuthorityRequest, dict]]): + The request object. Request message for + [CertificateAuthorityService.EnableCertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthorityService.EnableCertificateAuthority]. + name (:class:`str`): + Required. The resource name for this + [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority] + in the format + ``projects/*/locations/*/caPools/*/certificateAuthorities/*``. + + 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. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.api_core.operation_async.AsyncOperation: + An object representing a long-running operation. + + The result type for the operation will be :class:`google.cloud.security.privateca_v1.types.CertificateAuthority` A [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority] represents an individual Certificate Authority. + A + [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority] + can be used to create + [Certificates][google.cloud.security.privateca.v1.Certificate]. + + """ + # Create or coerce a protobuf request object. + # Quick check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([name]) + if request is not None and has_flattened_params: + raise ValueError("If the `request` argument is set, then none of " + "the individual field arguments should be set.") + + 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 + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method_async.wrap_method( + self._client._transport.enable_certificate_authority, + default_timeout=None, + client_info=DEFAULT_CLIENT_INFO, + ) + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata(( + ("name", request.name), + )), + ) + + # Send the request. + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Wrap the response in an operation future. + response = operation_async.from_gapic( + response, + self._client._transport.operations_client, + resources.CertificateAuthority, + metadata_type=service.OperationMetadata, + ) + + # Done; return the response. + return response + + async def fetch_certificate_authority_csr(self, + request: Optional[Union[service.FetchCertificateAuthorityCsrRequest, dict]] = None, + *, + name: Optional[str] = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, str]] = (), + ) -> service.FetchCertificateAuthorityCsrResponse: + r"""Fetch a certificate signing request (CSR) from a + [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority] + that is in state + [AWAITING_USER_ACTIVATION][google.cloud.security.privateca.v1.CertificateAuthority.State.AWAITING_USER_ACTIVATION] + and is of type + [SUBORDINATE][google.cloud.security.privateca.v1.CertificateAuthority.Type.SUBORDINATE]. + The CSR must then be signed by the desired parent Certificate + Authority, which could be another + [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority] + resource, or could be an on-prem certificate authority. See also + [ActivateCertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthorityService.ActivateCertificateAuthority]. + + .. code-block:: python + + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html + from google.cloud.security import privateca_v1 + + async def sample_fetch_certificate_authority_csr(): + # Create a client + client = privateca_v1.CertificateAuthorityServiceAsyncClient() + + # Initialize request argument(s) + request = privateca_v1.FetchCertificateAuthorityCsrRequest( + name="name_value", + ) + + # Make the request + response = await client.fetch_certificate_authority_csr(request=request) + + # Handle the response + print(response) + + Args: + request (Optional[Union[google.cloud.security.privateca_v1.types.FetchCertificateAuthorityCsrRequest, dict]]): + The request object. Request message for + [CertificateAuthorityService.FetchCertificateAuthorityCsr][google.cloud.security.privateca.v1.CertificateAuthorityService.FetchCertificateAuthorityCsr]. + name (:class:`str`): + Required. The resource name for this + [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority] + in the format + ``projects/*/locations/*/caPools/*/certificateAuthorities/*``. + + 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. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.cloud.security.privateca_v1.types.FetchCertificateAuthorityCsrResponse: + Response message for + [CertificateAuthorityService.FetchCertificateAuthorityCsr][google.cloud.security.privateca.v1.CertificateAuthorityService.FetchCertificateAuthorityCsr]. + + """ + # Create or coerce a protobuf request object. + # Quick check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([name]) + if request is not None and has_flattened_params: + raise ValueError("If the `request` argument is set, then none of " + "the individual field arguments should be set.") + + 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 + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method_async.wrap_method( + self._client._transport.fetch_certificate_authority_csr, + default_timeout=None, + client_info=DEFAULT_CLIENT_INFO, + ) + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata(( + ("name", request.name), + )), + ) + + # Send the request. + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Done; return the response. + return response + + async def get_certificate_authority(self, + request: Optional[Union[service.GetCertificateAuthorityRequest, dict]] = None, + *, + name: Optional[str] = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, str]] = (), + ) -> resources.CertificateAuthority: + r"""Returns a + [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority]. + + .. code-block:: python + + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html + from google.cloud.security import privateca_v1 + + async def sample_get_certificate_authority(): + # Create a client + client = privateca_v1.CertificateAuthorityServiceAsyncClient() + + # Initialize request argument(s) + request = privateca_v1.GetCertificateAuthorityRequest( + name="name_value", + ) + + # Make the request + response = await client.get_certificate_authority(request=request) + + # Handle the response + print(response) + + Args: + request (Optional[Union[google.cloud.security.privateca_v1.types.GetCertificateAuthorityRequest, dict]]): + The request object. Request message for + [CertificateAuthorityService.GetCertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthorityService.GetCertificateAuthority]. + name (:class:`str`): + Required. The + [name][google.cloud.security.privateca.v1.CertificateAuthority.name] + of the + [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority] + to get. + + 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. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.cloud.security.privateca_v1.types.CertificateAuthority: + A [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority] represents an individual Certificate Authority. + A + [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority] + can be used to create + [Certificates][google.cloud.security.privateca.v1.Certificate]. + + """ + # Create or coerce a protobuf request object. + # Quick check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([name]) + if request is not None and has_flattened_params: + raise ValueError("If the `request` argument is set, then none of " + "the individual field arguments should be set.") + + 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 + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method_async.wrap_method( + self._client._transport.get_certificate_authority, + default_timeout=None, + client_info=DEFAULT_CLIENT_INFO, + ) + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata(( + ("name", request.name), + )), + ) + + # Send the request. + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Done; return the response. + return response + + async def list_certificate_authorities(self, + request: Optional[Union[service.ListCertificateAuthoritiesRequest, dict]] = None, + *, + parent: Optional[str] = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, str]] = (), + ) -> pagers.ListCertificateAuthoritiesAsyncPager: + r"""Lists + [CertificateAuthorities][google.cloud.security.privateca.v1.CertificateAuthority]. + + .. code-block:: python + + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html + from google.cloud.security import privateca_v1 + + async def sample_list_certificate_authorities(): + # Create a client + client = privateca_v1.CertificateAuthorityServiceAsyncClient() + + # Initialize request argument(s) + request = privateca_v1.ListCertificateAuthoritiesRequest( + parent="parent_value", + ) + + # Make the request + page_result = client.list_certificate_authorities(request=request) + + # Handle the response + async for response in page_result: + print(response) + + Args: + request (Optional[Union[google.cloud.security.privateca_v1.types.ListCertificateAuthoritiesRequest, dict]]): + The request object. Request message for + [CertificateAuthorityService.ListCertificateAuthorities][google.cloud.security.privateca.v1.CertificateAuthorityService.ListCertificateAuthorities]. + parent (:class:`str`): + Required. The resource name of the + [CaPool][google.cloud.security.privateca.v1.CaPool] + associated with the + [CertificateAuthorities][google.cloud.security.privateca.v1.CertificateAuthority], + in the format ``projects/*/locations/*/caPools/*``. + + 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. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.cloud.security.privateca_v1.services.certificate_authority_service.pagers.ListCertificateAuthoritiesAsyncPager: + Response message for + [CertificateAuthorityService.ListCertificateAuthorities][google.cloud.security.privateca.v1.CertificateAuthorityService.ListCertificateAuthorities]. + + Iterating over this object will yield results and + resolve additional pages automatically. + + """ + # Create or coerce a protobuf request object. + # Quick check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([parent]) + if request is not None and has_flattened_params: + raise ValueError("If the `request` argument is set, then none of " + "the individual field arguments should be set.") + + 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 + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method_async.wrap_method( + self._client._transport.list_certificate_authorities, + default_timeout=None, + client_info=DEFAULT_CLIENT_INFO, + ) + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata(( + ("parent", request.parent), + )), + ) + + # Send the request. + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # This method is paged; wrap the response in a pager, which provides + # an `__aiter__` convenience method. + response = pagers.ListCertificateAuthoritiesAsyncPager( + method=rpc, + request=request, + response=response, + metadata=metadata, + ) + + # Done; return the response. + return response + + async def undelete_certificate_authority(self, + request: Optional[Union[service.UndeleteCertificateAuthorityRequest, dict]] = None, + *, + name: Optional[str] = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, str]] = (), + ) -> operation_async.AsyncOperation: + r"""Undelete a + [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority] + that has been deleted. + + .. code-block:: python + + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html + from google.cloud.security import privateca_v1 + + async def sample_undelete_certificate_authority(): + # Create a client + client = privateca_v1.CertificateAuthorityServiceAsyncClient() + + # Initialize request argument(s) + request = privateca_v1.UndeleteCertificateAuthorityRequest( + name="name_value", + ) + + # Make the request + operation = client.undelete_certificate_authority(request=request) + + print("Waiting for operation to complete...") + + response = (await operation).result() + + # Handle the response + print(response) + + Args: + request (Optional[Union[google.cloud.security.privateca_v1.types.UndeleteCertificateAuthorityRequest, dict]]): + The request object. Request message for + [CertificateAuthorityService.UndeleteCertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthorityService.UndeleteCertificateAuthority]. + name (:class:`str`): + Required. The resource name for this + [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority] + in the format + ``projects/*/locations/*/caPools/*/certificateAuthorities/*``. + + 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. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.api_core.operation_async.AsyncOperation: + An object representing a long-running operation. + + The result type for the operation will be :class:`google.cloud.security.privateca_v1.types.CertificateAuthority` A [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority] represents an individual Certificate Authority. + A + [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority] + can be used to create + [Certificates][google.cloud.security.privateca.v1.Certificate]. + + """ + # Create or coerce a protobuf request object. + # Quick check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([name]) + if request is not None and has_flattened_params: + raise ValueError("If the `request` argument is set, then none of " + "the individual field arguments should be set.") + + 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 + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method_async.wrap_method( + self._client._transport.undelete_certificate_authority, + default_timeout=None, + client_info=DEFAULT_CLIENT_INFO, + ) + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata(( + ("name", request.name), + )), + ) + + # Send the request. + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Wrap the response in an operation future. + response = operation_async.from_gapic( + response, + self._client._transport.operations_client, + resources.CertificateAuthority, + metadata_type=service.OperationMetadata, + ) + + # Done; return the response. + return response + + async def delete_certificate_authority(self, + request: Optional[Union[service.DeleteCertificateAuthorityRequest, dict]] = None, + *, + name: Optional[str] = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, str]] = (), + ) -> operation_async.AsyncOperation: + r"""Delete a + [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority]. + + .. code-block:: python + + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html + from google.cloud.security import privateca_v1 + + async def sample_delete_certificate_authority(): + # Create a client + client = privateca_v1.CertificateAuthorityServiceAsyncClient() + + # Initialize request argument(s) + request = privateca_v1.DeleteCertificateAuthorityRequest( + name="name_value", + ) + + # Make the request + operation = client.delete_certificate_authority(request=request) + + print("Waiting for operation to complete...") + + response = (await operation).result() + + # Handle the response + print(response) + + Args: + request (Optional[Union[google.cloud.security.privateca_v1.types.DeleteCertificateAuthorityRequest, dict]]): + The request object. Request message for + [CertificateAuthorityService.DeleteCertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthorityService.DeleteCertificateAuthority]. + name (:class:`str`): + Required. The resource name for this + [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority] + in the format + ``projects/*/locations/*/caPools/*/certificateAuthorities/*``. + + 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. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.api_core.operation_async.AsyncOperation: + An object representing a long-running operation. + + The result type for the operation will be :class:`google.cloud.security.privateca_v1.types.CertificateAuthority` A [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority] represents an individual Certificate Authority. + A + [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority] + can be used to create + [Certificates][google.cloud.security.privateca.v1.Certificate]. + + """ + # Create or coerce a protobuf request object. + # Quick check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([name]) + if request is not None and has_flattened_params: + raise ValueError("If the `request` argument is set, then none of " + "the individual field arguments should be set.") + + 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 + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method_async.wrap_method( + self._client._transport.delete_certificate_authority, + default_timeout=None, + client_info=DEFAULT_CLIENT_INFO, + ) + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata(( + ("name", request.name), + )), + ) + + # Send the request. + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Wrap the response in an operation future. + response = operation_async.from_gapic( + response, + self._client._transport.operations_client, + resources.CertificateAuthority, + metadata_type=service.OperationMetadata, + ) + + # Done; return the response. + return response + + async def update_certificate_authority(self, + request: Optional[Union[service.UpdateCertificateAuthorityRequest, dict]] = None, + *, + certificate_authority: Optional[resources.CertificateAuthority] = None, + update_mask: Optional[field_mask_pb2.FieldMask] = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, str]] = (), + ) -> operation_async.AsyncOperation: + r"""Update a + [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority]. + + .. code-block:: python + + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html + from google.cloud.security import privateca_v1 + + async def sample_update_certificate_authority(): + # Create a client + client = privateca_v1.CertificateAuthorityServiceAsyncClient() + + # Initialize request argument(s) + certificate_authority = privateca_v1.CertificateAuthority() + certificate_authority.type_ = "SUBORDINATE" + certificate_authority.key_spec.cloud_kms_key_version = "cloud_kms_key_version_value" + + request = privateca_v1.UpdateCertificateAuthorityRequest( + certificate_authority=certificate_authority, + ) + + # Make the request + operation = client.update_certificate_authority(request=request) + + print("Waiting for operation to complete...") + + response = (await operation).result() + + # Handle the response + print(response) + + Args: + request (Optional[Union[google.cloud.security.privateca_v1.types.UpdateCertificateAuthorityRequest, dict]]): + The request object. Request message for + [CertificateAuthorityService.UpdateCertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthorityService.UpdateCertificateAuthority]. + certificate_authority (:class:`google.cloud.security.privateca_v1.types.CertificateAuthority`): + Required. + [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority] + with updated values. + + This corresponds to the ``certificate_authority`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + update_mask (:class:`google.protobuf.field_mask_pb2.FieldMask`): + Required. A list of fields to be + updated in this request. + + 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. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.api_core.operation_async.AsyncOperation: + An object representing a long-running operation. + + The result type for the operation will be :class:`google.cloud.security.privateca_v1.types.CertificateAuthority` A [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority] represents an individual Certificate Authority. + A + [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority] + can be used to create + [Certificates][google.cloud.security.privateca.v1.Certificate]. + + """ + # Create or coerce a protobuf request object. + # Quick check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([certificate_authority, update_mask]) + if request is not None and has_flattened_params: + raise ValueError("If the `request` argument is set, then none of " + "the individual field arguments should be set.") + + 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: + request.update_mask = update_mask + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method_async.wrap_method( + self._client._transport.update_certificate_authority, + default_timeout=None, + client_info=DEFAULT_CLIENT_INFO, + ) + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata(( + ("certificate_authority.name", request.certificate_authority.name), + )), + ) + + # Send the request. + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Wrap the response in an operation future. + response = operation_async.from_gapic( + response, + self._client._transport.operations_client, + resources.CertificateAuthority, + metadata_type=service.OperationMetadata, + ) + + # Done; return the response. + return response + + async def create_ca_pool(self, + request: Optional[Union[service.CreateCaPoolRequest, dict]] = None, + *, + parent: Optional[str] = None, + ca_pool: Optional[resources.CaPool] = None, + ca_pool_id: Optional[str] = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, str]] = (), + ) -> operation_async.AsyncOperation: + r"""Create a [CaPool][google.cloud.security.privateca.v1.CaPool]. + + .. code-block:: python + + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html + from google.cloud.security import privateca_v1 + + async def sample_create_ca_pool(): + # Create a client + client = privateca_v1.CertificateAuthorityServiceAsyncClient() + + # Initialize request argument(s) + ca_pool = privateca_v1.CaPool() + ca_pool.tier = "DEVOPS" + + request = privateca_v1.CreateCaPoolRequest( + parent="parent_value", + ca_pool_id="ca_pool_id_value", + ca_pool=ca_pool, + ) + + # Make the request + operation = client.create_ca_pool(request=request) + + print("Waiting for operation to complete...") + + response = (await operation).result() + + # Handle the response + print(response) + + Args: + request (Optional[Union[google.cloud.security.privateca_v1.types.CreateCaPoolRequest, dict]]): + The request object. Request message for + [CertificateAuthorityService.CreateCaPool][google.cloud.security.privateca.v1.CertificateAuthorityService.CreateCaPool]. + parent (:class:`str`): + Required. The resource name of the location associated + with the + [CaPool][google.cloud.security.privateca.v1.CaPool], in + the format ``projects/*/locations/*``. + + This corresponds to the ``parent`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + ca_pool (:class:`google.cloud.security.privateca_v1.types.CaPool`): + Required. A + [CaPool][google.cloud.security.privateca.v1.CaPool] with + initial field values. + + This corresponds to the ``ca_pool`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + ca_pool_id (:class:`str`): + Required. It must be unique within a location and match + the regular expression ``[a-zA-Z0-9_-]{1,63}`` + + 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. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.api_core.operation_async.AsyncOperation: + An object representing a long-running operation. + + The result type for the operation will be :class:`google.cloud.security.privateca_v1.types.CaPool` A [CaPool][google.cloud.security.privateca.v1.CaPool] represents a group of + [CertificateAuthorities][google.cloud.security.privateca.v1.CertificateAuthority] + that form a trust anchor. A + [CaPool][google.cloud.security.privateca.v1.CaPool] + can be used to manage issuance policies for one or + more + [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority] + resources and to rotate CA certificates in and out of + the trust anchor. + + """ + # Create or coerce a protobuf request object. + # Quick check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([parent, ca_pool, ca_pool_id]) + if request is not None and has_flattened_params: + raise ValueError("If the `request` argument is set, then none of " + "the individual field arguments should be set.") + + 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: + request.ca_pool = ca_pool + if ca_pool_id is not None: + request.ca_pool_id = ca_pool_id + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method_async.wrap_method( + self._client._transport.create_ca_pool, + default_timeout=None, + client_info=DEFAULT_CLIENT_INFO, + ) + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata(( + ("parent", request.parent), + )), + ) + + # Send the request. + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Wrap the response in an operation future. + response = operation_async.from_gapic( + response, + self._client._transport.operations_client, + resources.CaPool, + metadata_type=service.OperationMetadata, + ) + + # Done; return the response. + return response + + async def update_ca_pool(self, + request: Optional[Union[service.UpdateCaPoolRequest, dict]] = None, + *, + ca_pool: Optional[resources.CaPool] = None, + update_mask: Optional[field_mask_pb2.FieldMask] = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, str]] = (), + ) -> operation_async.AsyncOperation: + r"""Update a [CaPool][google.cloud.security.privateca.v1.CaPool]. + + .. code-block:: python + + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html + from google.cloud.security import privateca_v1 + + async def sample_update_ca_pool(): + # Create a client + client = privateca_v1.CertificateAuthorityServiceAsyncClient() + + # Initialize request argument(s) + ca_pool = privateca_v1.CaPool() + ca_pool.tier = "DEVOPS" + + request = privateca_v1.UpdateCaPoolRequest( + ca_pool=ca_pool, + ) + + # Make the request + operation = client.update_ca_pool(request=request) + + print("Waiting for operation to complete...") + + response = (await operation).result() + + # Handle the response + print(response) + + Args: + request (Optional[Union[google.cloud.security.privateca_v1.types.UpdateCaPoolRequest, dict]]): + The request object. Request message for + [CertificateAuthorityService.UpdateCaPool][google.cloud.security.privateca.v1.CertificateAuthorityService.UpdateCaPool]. + ca_pool (:class:`google.cloud.security.privateca_v1.types.CaPool`): + Required. + [CaPool][google.cloud.security.privateca.v1.CaPool] with + updated values. + + This corresponds to the ``ca_pool`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + update_mask (:class:`google.protobuf.field_mask_pb2.FieldMask`): + Required. A list of fields to be + updated in this request. + + 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. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.api_core.operation_async.AsyncOperation: + An object representing a long-running operation. + + The result type for the operation will be :class:`google.cloud.security.privateca_v1.types.CaPool` A [CaPool][google.cloud.security.privateca.v1.CaPool] represents a group of + [CertificateAuthorities][google.cloud.security.privateca.v1.CertificateAuthority] + that form a trust anchor. A + [CaPool][google.cloud.security.privateca.v1.CaPool] + can be used to manage issuance policies for one or + more + [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority] + resources and to rotate CA certificates in and out of + the trust anchor. + + """ + # Create or coerce a protobuf request object. + # Quick check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([ca_pool, update_mask]) + if request is not None and has_flattened_params: + raise ValueError("If the `request` argument is set, then none of " + "the individual field arguments should be set.") + + 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: + request.update_mask = update_mask + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method_async.wrap_method( + self._client._transport.update_ca_pool, + default_timeout=None, + client_info=DEFAULT_CLIENT_INFO, + ) + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata(( + ("ca_pool.name", request.ca_pool.name), + )), + ) + + # Send the request. + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Wrap the response in an operation future. + response = operation_async.from_gapic( + response, + self._client._transport.operations_client, + resources.CaPool, + metadata_type=service.OperationMetadata, + ) + + # Done; return the response. + return response + + async def get_ca_pool(self, + request: Optional[Union[service.GetCaPoolRequest, dict]] = None, + *, + name: Optional[str] = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, str]] = (), + ) -> resources.CaPool: + r"""Returns a [CaPool][google.cloud.security.privateca.v1.CaPool]. + + .. code-block:: python + + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html + from google.cloud.security import privateca_v1 + + async def sample_get_ca_pool(): + # Create a client + client = privateca_v1.CertificateAuthorityServiceAsyncClient() + + # Initialize request argument(s) + request = privateca_v1.GetCaPoolRequest( + name="name_value", + ) + + # Make the request + response = await client.get_ca_pool(request=request) + + # Handle the response + print(response) + + Args: + request (Optional[Union[google.cloud.security.privateca_v1.types.GetCaPoolRequest, dict]]): + The request object. Request message for + [CertificateAuthorityService.GetCaPool][google.cloud.security.privateca.v1.CertificateAuthorityService.GetCaPool]. + name (:class:`str`): + Required. The + [name][google.cloud.security.privateca.v1.CaPool.name] + of the + [CaPool][google.cloud.security.privateca.v1.CaPool] to + get. + + 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. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.cloud.security.privateca_v1.types.CaPool: + A [CaPool][google.cloud.security.privateca.v1.CaPool] represents a group of + [CertificateAuthorities][google.cloud.security.privateca.v1.CertificateAuthority] + that form a trust anchor. A + [CaPool][google.cloud.security.privateca.v1.CaPool] + can be used to manage issuance policies for one or + more + [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority] + resources and to rotate CA certificates in and out of + the trust anchor. + + """ + # Create or coerce a protobuf request object. + # Quick check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([name]) + if request is not None and has_flattened_params: + raise ValueError("If the `request` argument is set, then none of " + "the individual field arguments should be set.") + + 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 + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method_async.wrap_method( + self._client._transport.get_ca_pool, + default_timeout=None, + client_info=DEFAULT_CLIENT_INFO, + ) + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata(( + ("name", request.name), + )), + ) + + # Send the request. + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Done; return the response. + return response + + async def list_ca_pools(self, + request: Optional[Union[service.ListCaPoolsRequest, dict]] = None, + *, + parent: Optional[str] = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, str]] = (), + ) -> pagers.ListCaPoolsAsyncPager: + r"""Lists [CaPools][google.cloud.security.privateca.v1.CaPool]. + + .. code-block:: python + + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html + from google.cloud.security import privateca_v1 + + async def sample_list_ca_pools(): + # Create a client + client = privateca_v1.CertificateAuthorityServiceAsyncClient() + + # Initialize request argument(s) + request = privateca_v1.ListCaPoolsRequest( + parent="parent_value", + ) + + # Make the request + page_result = client.list_ca_pools(request=request) + + # Handle the response + async for response in page_result: + print(response) + + Args: + request (Optional[Union[google.cloud.security.privateca_v1.types.ListCaPoolsRequest, dict]]): + The request object. Request message for + [CertificateAuthorityService.ListCaPools][google.cloud.security.privateca.v1.CertificateAuthorityService.ListCaPools]. + parent (:class:`str`): + Required. The resource name of the location associated + with the + [CaPools][google.cloud.security.privateca.v1.CaPool], in + the format ``projects/*/locations/*``. + + 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. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.cloud.security.privateca_v1.services.certificate_authority_service.pagers.ListCaPoolsAsyncPager: + Response message for + [CertificateAuthorityService.ListCaPools][google.cloud.security.privateca.v1.CertificateAuthorityService.ListCaPools]. + + Iterating over this object will yield results and + resolve additional pages automatically. + + """ + # Create or coerce a protobuf request object. + # Quick check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([parent]) + if request is not None and has_flattened_params: + raise ValueError("If the `request` argument is set, then none of " + "the individual field arguments should be set.") + + 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 + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method_async.wrap_method( + self._client._transport.list_ca_pools, + default_timeout=None, + client_info=DEFAULT_CLIENT_INFO, + ) + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata(( + ("parent", request.parent), + )), + ) + + # Send the request. + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # This method is paged; wrap the response in a pager, which provides + # an `__aiter__` convenience method. + response = pagers.ListCaPoolsAsyncPager( + method=rpc, + request=request, + response=response, + metadata=metadata, + ) + + # Done; return the response. + return response + + async def delete_ca_pool(self, + request: Optional[Union[service.DeleteCaPoolRequest, dict]] = None, + *, + name: Optional[str] = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, str]] = (), + ) -> operation_async.AsyncOperation: + r"""Delete a [CaPool][google.cloud.security.privateca.v1.CaPool]. + + .. code-block:: python + + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html + from google.cloud.security import privateca_v1 + + async def sample_delete_ca_pool(): + # Create a client + client = privateca_v1.CertificateAuthorityServiceAsyncClient() + + # Initialize request argument(s) + request = privateca_v1.DeleteCaPoolRequest( + name="name_value", + ) + + # Make the request + operation = client.delete_ca_pool(request=request) + + print("Waiting for operation to complete...") + + response = (await operation).result() + + # Handle the response + print(response) + + Args: + request (Optional[Union[google.cloud.security.privateca_v1.types.DeleteCaPoolRequest, dict]]): + The request object. Request message for + [CertificateAuthorityService.DeleteCaPool][google.cloud.security.privateca.v1.CertificateAuthorityService.DeleteCaPool]. + name (:class:`str`): + Required. The resource name for this + [CaPool][google.cloud.security.privateca.v1.CaPool] in + the format ``projects/*/locations/*/caPools/*``. + + 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. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.api_core.operation_async.AsyncOperation: + An object representing a long-running operation. + + The result type for the operation will be :class:`google.protobuf.empty_pb2.Empty` A generic empty message that you can re-use to avoid defining duplicated + empty messages in your APIs. A typical example is to + use it as the request or the response type of an API + method. For instance: + + service Foo { + rpc Bar(google.protobuf.Empty) returns + (google.protobuf.Empty); + + } + + """ + # Create or coerce a protobuf request object. + # Quick check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([name]) + if request is not None and has_flattened_params: + raise ValueError("If the `request` argument is set, then none of " + "the individual field arguments should be set.") + + 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 + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method_async.wrap_method( + self._client._transport.delete_ca_pool, + default_timeout=None, + client_info=DEFAULT_CLIENT_INFO, + ) + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata(( + ("name", request.name), + )), + ) + + # Send the request. + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Wrap the response in an operation future. + response = operation_async.from_gapic( + response, + self._client._transport.operations_client, + empty_pb2.Empty, + metadata_type=service.OperationMetadata, + ) + + # Done; return the response. + return response + + async def fetch_ca_certs(self, + request: Optional[Union[service.FetchCaCertsRequest, dict]] = None, + *, + ca_pool: Optional[str] = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, str]] = (), + ) -> service.FetchCaCertsResponse: + r"""FetchCaCerts returns the current trust anchor for the + [CaPool][google.cloud.security.privateca.v1.CaPool]. This will + include CA certificate chains for all ACTIVE + [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority] + resources in the + [CaPool][google.cloud.security.privateca.v1.CaPool]. + + .. code-block:: python + + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html + from google.cloud.security import privateca_v1 + + async def sample_fetch_ca_certs(): + # Create a client + client = privateca_v1.CertificateAuthorityServiceAsyncClient() + + # Initialize request argument(s) + request = privateca_v1.FetchCaCertsRequest( + ca_pool="ca_pool_value", + ) + + # Make the request + response = await client.fetch_ca_certs(request=request) + + # Handle the response + print(response) + + Args: + request (Optional[Union[google.cloud.security.privateca_v1.types.FetchCaCertsRequest, dict]]): + The request object. Request message for + [CertificateAuthorityService.FetchCaCerts][google.cloud.security.privateca.v1.CertificateAuthorityService.FetchCaCerts]. + ca_pool (:class:`str`): + Required. The resource name for the + [CaPool][google.cloud.security.privateca.v1.CaPool] in + the format ``projects/*/locations/*/caPools/*``. + + 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. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.cloud.security.privateca_v1.types.FetchCaCertsResponse: + Response message for + [CertificateAuthorityService.FetchCaCerts][google.cloud.security.privateca.v1.CertificateAuthorityService.FetchCaCerts]. + + """ + # Create or coerce a protobuf request object. + # Quick check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([ca_pool]) + if request is not None and has_flattened_params: + raise ValueError("If the `request` argument is set, then none of " + "the individual field arguments should be set.") + + 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 + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method_async.wrap_method( + self._client._transport.fetch_ca_certs, + default_timeout=None, + client_info=DEFAULT_CLIENT_INFO, + ) + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata(( + ("ca_pool", request.ca_pool), + )), + ) + + # Send the request. + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Done; return the response. + return response + + async def get_certificate_revocation_list(self, + request: Optional[Union[service.GetCertificateRevocationListRequest, dict]] = None, + *, + name: Optional[str] = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, str]] = (), + ) -> resources.CertificateRevocationList: + r"""Returns a + [CertificateRevocationList][google.cloud.security.privateca.v1.CertificateRevocationList]. + + .. code-block:: python + + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html + from google.cloud.security import privateca_v1 + + async def sample_get_certificate_revocation_list(): + # Create a client + client = privateca_v1.CertificateAuthorityServiceAsyncClient() + + # Initialize request argument(s) + request = privateca_v1.GetCertificateRevocationListRequest( + name="name_value", + ) + + # Make the request + response = await client.get_certificate_revocation_list(request=request) + + # Handle the response + print(response) + + Args: + request (Optional[Union[google.cloud.security.privateca_v1.types.GetCertificateRevocationListRequest, dict]]): + The request object. Request message for + [CertificateAuthorityService.GetCertificateRevocationList][google.cloud.security.privateca.v1.CertificateAuthorityService.GetCertificateRevocationList]. + name (:class:`str`): + Required. The + [name][google.cloud.security.privateca.v1.CertificateRevocationList.name] + of the + [CertificateRevocationList][google.cloud.security.privateca.v1.CertificateRevocationList] + to get. + + 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. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.cloud.security.privateca_v1.types.CertificateRevocationList: + A [CertificateRevocationList][google.cloud.security.privateca.v1.CertificateRevocationList] corresponds to a signed X.509 certificate + Revocation List (CRL). A CRL contains the serial + numbers of certificates that should no longer be + trusted. + + """ + # Create or coerce a protobuf request object. + # Quick check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([name]) + if request is not None and has_flattened_params: + raise ValueError("If the `request` argument is set, then none of " + "the individual field arguments should be set.") + + 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 + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method_async.wrap_method( + self._client._transport.get_certificate_revocation_list, + default_timeout=None, + client_info=DEFAULT_CLIENT_INFO, + ) + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata(( + ("name", request.name), + )), + ) + + # Send the request. + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Done; return the response. + return response + + async def list_certificate_revocation_lists(self, + request: Optional[Union[service.ListCertificateRevocationListsRequest, dict]] = None, + *, + parent: Optional[str] = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, str]] = (), + ) -> pagers.ListCertificateRevocationListsAsyncPager: + r"""Lists + [CertificateRevocationLists][google.cloud.security.privateca.v1.CertificateRevocationList]. + + .. code-block:: python + + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html + from google.cloud.security import privateca_v1 + + async def sample_list_certificate_revocation_lists(): + # Create a client + client = privateca_v1.CertificateAuthorityServiceAsyncClient() + + # Initialize request argument(s) + request = privateca_v1.ListCertificateRevocationListsRequest( + parent="parent_value", + ) + + # Make the request + page_result = client.list_certificate_revocation_lists(request=request) + + # Handle the response + async for response in page_result: + print(response) + + Args: + request (Optional[Union[google.cloud.security.privateca_v1.types.ListCertificateRevocationListsRequest, dict]]): + The request object. Request message for + [CertificateAuthorityService.ListCertificateRevocationLists][google.cloud.security.privateca.v1.CertificateAuthorityService.ListCertificateRevocationLists]. + parent (:class:`str`): + Required. The resource name of the location associated + with the + [CertificateRevocationLists][google.cloud.security.privateca.v1.CertificateRevocationList], + in the format + ``projects/*/locations/*/caPools/*/certificateAuthorities/*``. + + 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. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.cloud.security.privateca_v1.services.certificate_authority_service.pagers.ListCertificateRevocationListsAsyncPager: + Response message for + [CertificateAuthorityService.ListCertificateRevocationLists][google.cloud.security.privateca.v1.CertificateAuthorityService.ListCertificateRevocationLists]. + + Iterating over this object will yield results and + resolve additional pages automatically. + + """ + # Create or coerce a protobuf request object. + # Quick check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([parent]) + if request is not None and has_flattened_params: + raise ValueError("If the `request` argument is set, then none of " + "the individual field arguments should be set.") + + 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 + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method_async.wrap_method( + self._client._transport.list_certificate_revocation_lists, + default_timeout=None, + client_info=DEFAULT_CLIENT_INFO, + ) + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata(( + ("parent", request.parent), + )), + ) + + # Send the request. + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # This method is paged; wrap the response in a pager, which provides + # an `__aiter__` convenience method. + response = pagers.ListCertificateRevocationListsAsyncPager( + method=rpc, + request=request, + response=response, + metadata=metadata, + ) + + # Done; return the response. + return response + + async def update_certificate_revocation_list(self, + request: Optional[Union[service.UpdateCertificateRevocationListRequest, dict]] = None, + *, + certificate_revocation_list: Optional[resources.CertificateRevocationList] = None, + update_mask: Optional[field_mask_pb2.FieldMask] = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, str]] = (), + ) -> operation_async.AsyncOperation: + r"""Update a + [CertificateRevocationList][google.cloud.security.privateca.v1.CertificateRevocationList]. + + .. code-block:: python + + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html + from google.cloud.security import privateca_v1 + + async def sample_update_certificate_revocation_list(): + # Create a client + client = privateca_v1.CertificateAuthorityServiceAsyncClient() + + # Initialize request argument(s) + request = privateca_v1.UpdateCertificateRevocationListRequest( + ) + + # Make the request + operation = client.update_certificate_revocation_list(request=request) + + print("Waiting for operation to complete...") + + response = (await operation).result() + + # Handle the response + print(response) + + Args: + request (Optional[Union[google.cloud.security.privateca_v1.types.UpdateCertificateRevocationListRequest, dict]]): + The request object. Request message for + [CertificateAuthorityService.UpdateCertificateRevocationList][google.cloud.security.privateca.v1.CertificateAuthorityService.UpdateCertificateRevocationList]. + certificate_revocation_list (:class:`google.cloud.security.privateca_v1.types.CertificateRevocationList`): + Required. + [CertificateRevocationList][google.cloud.security.privateca.v1.CertificateRevocationList] + with updated values. + + This corresponds to the ``certificate_revocation_list`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + update_mask (:class:`google.protobuf.field_mask_pb2.FieldMask`): + Required. A list of fields to be + updated in this request. + + 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. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.api_core.operation_async.AsyncOperation: + An object representing a long-running operation. + + The result type for the operation will be :class:`google.cloud.security.privateca_v1.types.CertificateRevocationList` A [CertificateRevocationList][google.cloud.security.privateca.v1.CertificateRevocationList] corresponds to a signed X.509 certificate + Revocation List (CRL). A CRL contains the serial + numbers of certificates that should no longer be + trusted. + + """ + # Create or coerce a protobuf request object. + # Quick check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([certificate_revocation_list, update_mask]) + if request is not None and has_flattened_params: + raise ValueError("If the `request` argument is set, then none of " + "the individual field arguments should be set.") + + 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: + request.update_mask = update_mask + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method_async.wrap_method( + self._client._transport.update_certificate_revocation_list, + default_timeout=None, + client_info=DEFAULT_CLIENT_INFO, + ) + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata(( + ("certificate_revocation_list.name", request.certificate_revocation_list.name), + )), + ) + + # Send the request. + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Wrap the response in an operation future. + response = operation_async.from_gapic( + response, + self._client._transport.operations_client, + resources.CertificateRevocationList, + metadata_type=service.OperationMetadata, + ) + + # Done; return the response. + return response + + async def create_certificate_template(self, + request: Optional[Union[service.CreateCertificateTemplateRequest, dict]] = None, + *, + parent: Optional[str] = None, + certificate_template: Optional[resources.CertificateTemplate] = None, + certificate_template_id: Optional[str] = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, str]] = (), + ) -> operation_async.AsyncOperation: + r"""Create a new + [CertificateTemplate][google.cloud.security.privateca.v1.CertificateTemplate] + in a given Project and Location. + + .. code-block:: python + + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html + from google.cloud.security import privateca_v1 + + async def sample_create_certificate_template(): + # Create a client + client = privateca_v1.CertificateAuthorityServiceAsyncClient() + + # Initialize request argument(s) + request = privateca_v1.CreateCertificateTemplateRequest( + parent="parent_value", + certificate_template_id="certificate_template_id_value", + ) + + # Make the request + operation = client.create_certificate_template(request=request) + + print("Waiting for operation to complete...") + + response = (await operation).result() + + # Handle the response + print(response) + + Args: + request (Optional[Union[google.cloud.security.privateca_v1.types.CreateCertificateTemplateRequest, dict]]): + The request object. Request message for + [CertificateAuthorityService.CreateCertificateTemplate][google.cloud.security.privateca.v1.CertificateAuthorityService.CreateCertificateTemplate]. + parent (:class:`str`): + Required. The resource name of the location associated + with the + [CertificateTemplate][google.cloud.security.privateca.v1.CertificateTemplate], + in the format ``projects/*/locations/*``. + + This corresponds to the ``parent`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + certificate_template (:class:`google.cloud.security.privateca_v1.types.CertificateTemplate`): + Required. A + [CertificateTemplate][google.cloud.security.privateca.v1.CertificateTemplate] + with initial field values. + + This corresponds to the ``certificate_template`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + certificate_template_id (:class:`str`): + Required. It must be unique within a location and match + the regular expression ``[a-zA-Z0-9_-]{1,63}`` + + 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. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.api_core.operation_async.AsyncOperation: + An object representing a long-running operation. + + The result type for the operation will be :class:`google.cloud.security.privateca_v1.types.CertificateTemplate` A [CertificateTemplate][google.cloud.security.privateca.v1.CertificateTemplate] refers to a managed template for certificate + issuance. + + """ + # Create or coerce a protobuf request object. + # Quick check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([parent, certificate_template, certificate_template_id]) + if request is not None and has_flattened_params: + raise ValueError("If the `request` argument is set, then none of " + "the individual field arguments should be set.") + + 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: + request.certificate_template = certificate_template + if certificate_template_id is not None: + request.certificate_template_id = certificate_template_id + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method_async.wrap_method( + self._client._transport.create_certificate_template, + default_timeout=None, + client_info=DEFAULT_CLIENT_INFO, + ) + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata(( + ("parent", request.parent), + )), + ) + + # Send the request. + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Wrap the response in an operation future. + response = operation_async.from_gapic( + response, + self._client._transport.operations_client, + resources.CertificateTemplate, + metadata_type=service.OperationMetadata, + ) + + # Done; return the response. + return response + + async def delete_certificate_template(self, + request: Optional[Union[service.DeleteCertificateTemplateRequest, dict]] = None, + *, + name: Optional[str] = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, str]] = (), + ) -> operation_async.AsyncOperation: + r"""DeleteCertificateTemplate deletes a + [CertificateTemplate][google.cloud.security.privateca.v1.CertificateTemplate]. + + .. code-block:: python + + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html + from google.cloud.security import privateca_v1 + + async def sample_delete_certificate_template(): + # Create a client + client = privateca_v1.CertificateAuthorityServiceAsyncClient() + + # Initialize request argument(s) + request = privateca_v1.DeleteCertificateTemplateRequest( + name="name_value", + ) + + # Make the request + operation = client.delete_certificate_template(request=request) + + print("Waiting for operation to complete...") + + response = (await operation).result() + + # Handle the response + print(response) + + Args: + request (Optional[Union[google.cloud.security.privateca_v1.types.DeleteCertificateTemplateRequest, dict]]): + The request object. Request message for + [CertificateAuthorityService.DeleteCertificateTemplate][google.cloud.security.privateca.v1.CertificateAuthorityService.DeleteCertificateTemplate]. + name (:class:`str`): + Required. The resource name for this + [CertificateTemplate][google.cloud.security.privateca.v1.CertificateTemplate] + in the format + ``projects/*/locations/*/certificateTemplates/*``. + + 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. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.api_core.operation_async.AsyncOperation: + An object representing a long-running operation. + + The result type for the operation will be :class:`google.protobuf.empty_pb2.Empty` A generic empty message that you can re-use to avoid defining duplicated + empty messages in your APIs. A typical example is to + use it as the request or the response type of an API + method. For instance: + + service Foo { + rpc Bar(google.protobuf.Empty) returns + (google.protobuf.Empty); + + } + + """ + # Create or coerce a protobuf request object. + # Quick check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([name]) + if request is not None and has_flattened_params: + raise ValueError("If the `request` argument is set, then none of " + "the individual field arguments should be set.") + + 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 + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method_async.wrap_method( + self._client._transport.delete_certificate_template, + default_timeout=None, + client_info=DEFAULT_CLIENT_INFO, + ) + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata(( + ("name", request.name), + )), + ) + + # Send the request. + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Wrap the response in an operation future. + response = operation_async.from_gapic( + response, + self._client._transport.operations_client, + empty_pb2.Empty, + metadata_type=service.OperationMetadata, + ) + + # Done; return the response. + return response + + async def get_certificate_template(self, + request: Optional[Union[service.GetCertificateTemplateRequest, dict]] = None, + *, + name: Optional[str] = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, str]] = (), + ) -> resources.CertificateTemplate: + r"""Returns a + [CertificateTemplate][google.cloud.security.privateca.v1.CertificateTemplate]. + + .. code-block:: python + + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html + from google.cloud.security import privateca_v1 + + async def sample_get_certificate_template(): + # Create a client + client = privateca_v1.CertificateAuthorityServiceAsyncClient() + + # Initialize request argument(s) + request = privateca_v1.GetCertificateTemplateRequest( + name="name_value", + ) + + # Make the request + response = await client.get_certificate_template(request=request) + + # Handle the response + print(response) + + Args: + request (Optional[Union[google.cloud.security.privateca_v1.types.GetCertificateTemplateRequest, dict]]): + The request object. Request message for + [CertificateAuthorityService.GetCertificateTemplate][google.cloud.security.privateca.v1.CertificateAuthorityService.GetCertificateTemplate]. + name (:class:`str`): + Required. The + [name][google.cloud.security.privateca.v1.CertificateTemplate.name] + of the + [CertificateTemplate][google.cloud.security.privateca.v1.CertificateTemplate] + to get. + + 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. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.cloud.security.privateca_v1.types.CertificateTemplate: + A [CertificateTemplate][google.cloud.security.privateca.v1.CertificateTemplate] refers to a managed template for certificate + issuance. + + """ + # Create or coerce a protobuf request object. + # Quick check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([name]) + if request is not None and has_flattened_params: + raise ValueError("If the `request` argument is set, then none of " + "the individual field arguments should be set.") + + 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 + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method_async.wrap_method( + self._client._transport.get_certificate_template, + default_timeout=None, + client_info=DEFAULT_CLIENT_INFO, + ) + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata(( + ("name", request.name), + )), + ) + + # Send the request. + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Done; return the response. + return response + + async def list_certificate_templates(self, + request: Optional[Union[service.ListCertificateTemplatesRequest, dict]] = None, + *, + parent: Optional[str] = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, str]] = (), + ) -> pagers.ListCertificateTemplatesAsyncPager: + r"""Lists + [CertificateTemplates][google.cloud.security.privateca.v1.CertificateTemplate]. + + .. code-block:: python + + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html + from google.cloud.security import privateca_v1 + + async def sample_list_certificate_templates(): + # Create a client + client = privateca_v1.CertificateAuthorityServiceAsyncClient() + + # Initialize request argument(s) + request = privateca_v1.ListCertificateTemplatesRequest( + parent="parent_value", + ) + + # Make the request + page_result = client.list_certificate_templates(request=request) + + # Handle the response + async for response in page_result: + print(response) + + Args: + request (Optional[Union[google.cloud.security.privateca_v1.types.ListCertificateTemplatesRequest, dict]]): + The request object. Request message for + [CertificateAuthorityService.ListCertificateTemplates][google.cloud.security.privateca.v1.CertificateAuthorityService.ListCertificateTemplates]. + parent (:class:`str`): + Required. The resource name of the location associated + with the + [CertificateTemplates][google.cloud.security.privateca.v1.CertificateTemplate], + in the format ``projects/*/locations/*``. + + 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. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.cloud.security.privateca_v1.services.certificate_authority_service.pagers.ListCertificateTemplatesAsyncPager: + Response message for + [CertificateAuthorityService.ListCertificateTemplates][google.cloud.security.privateca.v1.CertificateAuthorityService.ListCertificateTemplates]. + + Iterating over this object will yield results and + resolve additional pages automatically. + + """ + # Create or coerce a protobuf request object. + # Quick check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([parent]) + if request is not None and has_flattened_params: + raise ValueError("If the `request` argument is set, then none of " + "the individual field arguments should be set.") + + 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 + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method_async.wrap_method( + self._client._transport.list_certificate_templates, + default_timeout=None, + client_info=DEFAULT_CLIENT_INFO, + ) + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata(( + ("parent", request.parent), + )), + ) + + # Send the request. + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # This method is paged; wrap the response in a pager, which provides + # an `__aiter__` convenience method. + response = pagers.ListCertificateTemplatesAsyncPager( + method=rpc, + request=request, + response=response, + metadata=metadata, + ) + + # Done; return the response. + return response + + async def update_certificate_template(self, + request: Optional[Union[service.UpdateCertificateTemplateRequest, dict]] = None, + *, + certificate_template: Optional[resources.CertificateTemplate] = None, + update_mask: Optional[field_mask_pb2.FieldMask] = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, str]] = (), + ) -> operation_async.AsyncOperation: + r"""Update a + [CertificateTemplate][google.cloud.security.privateca.v1.CertificateTemplate]. + + .. code-block:: python + + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html + from google.cloud.security import privateca_v1 + + async def sample_update_certificate_template(): + # Create a client + client = privateca_v1.CertificateAuthorityServiceAsyncClient() + + # Initialize request argument(s) + request = privateca_v1.UpdateCertificateTemplateRequest( + ) + + # Make the request + operation = client.update_certificate_template(request=request) + + print("Waiting for operation to complete...") + + response = (await operation).result() + + # Handle the response + print(response) + + Args: + request (Optional[Union[google.cloud.security.privateca_v1.types.UpdateCertificateTemplateRequest, dict]]): + The request object. Request message for + [CertificateAuthorityService.UpdateCertificateTemplate][google.cloud.security.privateca.v1.CertificateAuthorityService.UpdateCertificateTemplate]. + certificate_template (:class:`google.cloud.security.privateca_v1.types.CertificateTemplate`): + Required. + [CertificateTemplate][google.cloud.security.privateca.v1.CertificateTemplate] + with updated values. + + This corresponds to the ``certificate_template`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + update_mask (:class:`google.protobuf.field_mask_pb2.FieldMask`): + Required. A list of fields to be + updated in this request. + + 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. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.api_core.operation_async.AsyncOperation: + An object representing a long-running operation. + + The result type for the operation will be :class:`google.cloud.security.privateca_v1.types.CertificateTemplate` A [CertificateTemplate][google.cloud.security.privateca.v1.CertificateTemplate] refers to a managed template for certificate + issuance. + + """ + # Create or coerce a protobuf request object. + # Quick check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([certificate_template, update_mask]) + if request is not None and has_flattened_params: + raise ValueError("If the `request` argument is set, then none of " + "the individual field arguments should be set.") + + 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: + request.update_mask = update_mask + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method_async.wrap_method( + self._client._transport.update_certificate_template, + default_timeout=None, + client_info=DEFAULT_CLIENT_INFO, + ) + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata(( + ("certificate_template.name", request.certificate_template.name), + )), + ) + + # Send the request. + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Wrap the response in an operation future. + response = operation_async.from_gapic( + response, + self._client._transport.operations_client, + resources.CertificateTemplate, + metadata_type=service.OperationMetadata, + ) + + # Done; return the response. + return response + + async def __aenter__(self): + return self + + async def __aexit__(self, exc_type, exc, tb): + await self.transport.close() + +DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo(gapic_version=package_version.__version__) + + +__all__ = ( + "CertificateAuthorityServiceAsyncClient", +) diff --git a/owl-bot-staging/v1/google/cloud/security/privateca_v1/services/certificate_authority_service/client.py b/owl-bot-staging/v1/google/cloud/security/privateca_v1/services/certificate_authority_service/client.py new file mode 100644 index 0000000..b594b46 --- /dev/null +++ b/owl-bot-staging/v1/google/cloud/security/privateca_v1/services/certificate_authority_service/client.py @@ -0,0 +1,3990 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +from collections import OrderedDict +import os +import re +from typing import Dict, Mapping, MutableMapping, MutableSequence, Optional, Sequence, Tuple, Type, Union, cast + +from google.cloud.security.privateca_v1 import gapic_version as package_version + +from google.api_core import client_options as client_options_lib +from google.api_core import exceptions as core_exceptions +from google.api_core import gapic_v1 +from google.api_core import retry as retries +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 +from google.oauth2 import service_account # type: ignore + +try: + OptionalRetry = Union[retries.Retry, gapic_v1.method._MethodDefault] +except AttributeError: # pragma: NO COVER + OptionalRetry = Union[retries.Retry, object] # type: ignore + +from google.api_core import operation # type: ignore +from google.api_core import operation_async # type: ignore +from google.cloud.security.privateca_v1.services.certificate_authority_service import pagers +from google.cloud.security.privateca_v1.types import resources +from google.cloud.security.privateca_v1.types import service +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 + + +class CertificateAuthorityServiceClientMeta(type): + """Metaclass for the CertificateAuthorityService client. + + This provides class-level methods for building and retrieving + support objects (e.g. transport) without polluting the client instance + objects. + """ + _transport_registry = OrderedDict() # type: Dict[str, Type[CertificateAuthorityServiceTransport]] + _transport_registry["grpc"] = CertificateAuthorityServiceGrpcTransport + _transport_registry["grpc_asyncio"] = CertificateAuthorityServiceGrpcAsyncIOTransport + + def get_transport_class(cls, + label: Optional[str] = None, + ) -> Type[CertificateAuthorityServiceTransport]: + """Returns an appropriate transport class. + + Args: + label: The name of the desired transport. If none is + provided, then the first transport in the registry is used. + + Returns: + The transport class to use. + """ + # If a specific transport is requested, return that one. + if label: + return cls._transport_registry[label] + + # No transport is requested; return the default (that is, the first one + # in the dictionary). + return next(iter(cls._transport_registry.values())) + + +class CertificateAuthorityServiceClient(metaclass=CertificateAuthorityServiceClientMeta): + """[Certificate Authority + Service][google.cloud.security.privateca.v1.CertificateAuthorityService] + manages private certificate authorities and issued certificates. + """ + + @staticmethod + def _get_default_mtls_endpoint(api_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: + api_endpoint (Optional[str]): the api endpoint to convert. + Returns: + str: converted mTLS api endpoint. + """ + if not api_endpoint: + return api_endpoint + + mtls_endpoint_re = re.compile( + r"(?P[^.]+)(?P\.mtls)?(?P\.sandbox)?(?P\.googleapis\.com)?" + ) + + m = mtls_endpoint_re.match(api_endpoint) + name, mtls, sandbox, googledomain = m.groups() + if mtls or not googledomain: + return api_endpoint + + if sandbox: + return api_endpoint.replace( + "sandbox.googleapis.com", "mtls.sandbox.googleapis.com" + ) + + return api_endpoint.replace(".googleapis.com", ".mtls.googleapis.com") + + DEFAULT_ENDPOINT = "privateca.googleapis.com" + DEFAULT_MTLS_ENDPOINT = _get_default_mtls_endpoint.__func__( # type: ignore + DEFAULT_ENDPOINT + ) + + @classmethod + def from_service_account_info(cls, info: dict, *args, **kwargs): + """Creates an instance of this client using the provided credentials + info. + + Args: + info (dict): The service account private key info. + args: Additional arguments to pass to the constructor. + kwargs: Additional arguments to pass to the constructor. + + Returns: + CertificateAuthorityServiceClient: The constructed client. + """ + credentials = service_account.Credentials.from_service_account_info(info) + kwargs["credentials"] = credentials + return cls(*args, **kwargs) + + @classmethod + def from_service_account_file(cls, filename: str, *args, **kwargs): + """Creates an instance of this client using the provided credentials + file. + + Args: + filename (str): The path to the service account private key json + file. + args: Additional arguments to pass to the constructor. + kwargs: Additional arguments to pass to the constructor. + + Returns: + CertificateAuthorityServiceClient: The constructed client. + """ + credentials = service_account.Credentials.from_service_account_file( + filename) + kwargs["credentials"] = credentials + return cls(*args, **kwargs) + + from_service_account_json = from_service_account_file + + @property + def transport(self) -> CertificateAuthorityServiceTransport: + """Returns the transport used by the client instance. + + Returns: + CertificateAuthorityServiceTransport: The transport used by the client + instance. + """ + return self._transport + + @staticmethod + def ca_pool_path(project: str,location: str,ca_pool: str,) -> str: + """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]: + """Parses a ca_pool path into its component segments.""" + m = re.match(r"^projects/(?P.+?)/locations/(?P.+?)/caPools/(?P.+?)$", path) + return m.groupdict() if m else {} + + @staticmethod + def certificate_path(project: str,location: str,ca_pool: str,certificate: str,) -> str: + """Returns a fully-qualified certificate string.""" + return "projects/{project}/locations/{location}/caPools/{ca_pool}/certificates/{certificate}".format(project=project, location=location, ca_pool=ca_pool, certificate=certificate, ) + + @staticmethod + def parse_certificate_path(path: str) -> Dict[str,str]: + """Parses a certificate path into its component segments.""" + m = re.match(r"^projects/(?P.+?)/locations/(?P.+?)/caPools/(?P.+?)/certificates/(?P.+?)$", path) + return m.groupdict() if m else {} + + @staticmethod + def certificate_authority_path(project: str,location: str,ca_pool: str,certificate_authority: str,) -> str: + """Returns a fully-qualified certificate_authority string.""" + return "projects/{project}/locations/{location}/caPools/{ca_pool}/certificateAuthorities/{certificate_authority}".format(project=project, location=location, ca_pool=ca_pool, certificate_authority=certificate_authority, ) + + @staticmethod + def parse_certificate_authority_path(path: str) -> Dict[str,str]: + """Parses a certificate_authority path into its component segments.""" + m = re.match(r"^projects/(?P.+?)/locations/(?P.+?)/caPools/(?P.+?)/certificateAuthorities/(?P.+?)$", path) + return m.groupdict() if m else {} + + @staticmethod + def certificate_revocation_list_path(project: str,location: str,ca_pool: str,certificate_authority: str,certificate_revocation_list: str,) -> str: + """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, ca_pool=ca_pool, certificate_authority=certificate_authority, certificate_revocation_list=certificate_revocation_list, ) + + @staticmethod + def parse_certificate_revocation_list_path(path: str) -> Dict[str,str]: + """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) + return m.groupdict() if m else {} + + @staticmethod + def certificate_template_path(project: str,location: str,certificate_template: str,) -> str: + """Returns a fully-qualified certificate_template string.""" + return "projects/{project}/locations/{location}/certificateTemplates/{certificate_template}".format(project=project, location=location, certificate_template=certificate_template, ) + + @staticmethod + def parse_certificate_template_path(path: str) -> Dict[str,str]: + """Parses a certificate_template path into its component segments.""" + m = re.match(r"^projects/(?P.+?)/locations/(?P.+?)/certificateTemplates/(?P.+?)$", path) + return m.groupdict() if m else {} + + @staticmethod + def common_billing_account_path(billing_account: str, ) -> str: + """Returns a fully-qualified billing_account string.""" + return "billingAccounts/{billing_account}".format(billing_account=billing_account, ) + + @staticmethod + def parse_common_billing_account_path(path: str) -> Dict[str,str]: + """Parse a billing_account path into its component segments.""" + m = re.match(r"^billingAccounts/(?P.+?)$", path) + return m.groupdict() if m else {} + + @staticmethod + def common_folder_path(folder: str, ) -> str: + """Returns a fully-qualified folder string.""" + return "folders/{folder}".format(folder=folder, ) + + @staticmethod + def parse_common_folder_path(path: str) -> Dict[str,str]: + """Parse a folder path into its component segments.""" + m = re.match(r"^folders/(?P.+?)$", path) + return m.groupdict() if m else {} + + @staticmethod + def common_organization_path(organization: str, ) -> str: + """Returns a fully-qualified organization string.""" + return "organizations/{organization}".format(organization=organization, ) + + @staticmethod + def parse_common_organization_path(path: str) -> Dict[str,str]: + """Parse a organization path into its component segments.""" + m = re.match(r"^organizations/(?P.+?)$", path) + return m.groupdict() if m else {} + + @staticmethod + def common_project_path(project: str, ) -> str: + """Returns a fully-qualified project string.""" + return "projects/{project}".format(project=project, ) + + @staticmethod + def parse_common_project_path(path: str) -> Dict[str,str]: + """Parse a project path into its component segments.""" + m = re.match(r"^projects/(?P.+?)$", path) + return m.groupdict() if m else {} + + @staticmethod + def common_location_path(project: str, location: str, ) -> str: + """Returns a fully-qualified location string.""" + return "projects/{project}/locations/{location}".format(project=project, location=location, ) + + @staticmethod + def parse_common_location_path(path: str) -> Dict[str,str]: + """Parse a location path into its component segments.""" + m = re.match(r"^projects/(?P.+?)/locations/(?P.+?)$", path) + return m.groupdict() if m else {} + + @classmethod + def get_mtls_endpoint_and_cert_source(cls, client_options: Optional[client_options_lib.ClientOptions] = None): + """Return the API endpoint and client cert source for mutual TLS. + + The client cert source is determined in the following order: + (1) if `GOOGLE_API_USE_CLIENT_CERTIFICATE` environment variable is not "true", the + client cert source is None. + (2) if `client_options.client_cert_source` is provided, use the provided one; if the + default client cert source exists, use the default one; otherwise the client cert + source is None. + + The API endpoint is determined in the following order: + (1) if `client_options.api_endpoint` if provided, use the provided one. + (2) if `GOOGLE_API_USE_CLIENT_CERTIFICATE` environment variable is "always", use the + default mTLS endpoint; if the environment variable is "never", use the default API + endpoint; otherwise if client cert source exists, use the default mTLS endpoint, otherwise + use the default API endpoint. + + More details can be found at https://google.aip.dev/auth/4114. + + Args: + client_options (google.api_core.client_options.ClientOptions): Custom options for the + client. Only the `api_endpoint` and `client_cert_source` properties may be used + in this method. + + Returns: + Tuple[str, Callable[[], Tuple[bytes, bytes]]]: returns the API endpoint and the + client cert source to use. + + Raises: + google.auth.exceptions.MutualTLSChannelError: If any errors happen. + """ + if client_options is None: + client_options = client_options_lib.ClientOptions() + use_client_cert = os.getenv("GOOGLE_API_USE_CLIENT_CERTIFICATE", "false") + use_mtls_endpoint = os.getenv("GOOGLE_API_USE_MTLS_ENDPOINT", "auto") + if use_client_cert not in ("true", "false"): + raise ValueError("Environment variable `GOOGLE_API_USE_CLIENT_CERTIFICATE` must be either `true` or `false`") + if use_mtls_endpoint not in ("auto", "never", "always"): + raise MutualTLSChannelError("Environment variable `GOOGLE_API_USE_MTLS_ENDPOINT` must be `never`, `auto` or `always`") + + # Figure out the client cert source to use. + client_cert_source = None + if use_client_cert == "true": + if client_options.client_cert_source: + client_cert_source = client_options.client_cert_source + elif mtls.has_default_client_cert_source(): + client_cert_source = mtls.default_client_cert_source() + + # Figure out which api endpoint to use. + if client_options.api_endpoint is not None: + api_endpoint = client_options.api_endpoint + elif use_mtls_endpoint == "always" or (use_mtls_endpoint == "auto" and client_cert_source): + api_endpoint = cls.DEFAULT_MTLS_ENDPOINT + else: + api_endpoint = cls.DEFAULT_ENDPOINT + + return api_endpoint, client_cert_source + + def __init__(self, *, + credentials: Optional[ga_credentials.Credentials] = None, + transport: Optional[Union[str, CertificateAuthorityServiceTransport]] = None, + client_options: Optional[Union[client_options_lib.ClientOptions, dict]] = None, + client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, + ) -> None: + """Instantiates the certificate authority service client. + + Args: + credentials (Optional[google.auth.credentials.Credentials]): The + authorization credentials to attach to requests. These + credentials identify the application to the service; if none + are specified, the client will attempt to ascertain the + credentials from the environment. + transport (Union[str, CertificateAuthorityServiceTransport]): The + transport to use. If set to None, a transport is chosen + automatically. + client_options (Optional[Union[google.api_core.client_options.ClientOptions, dict]]): Custom options for the + client. It won't take effect if a ``transport`` instance is provided. + (1) The ``api_endpoint`` property can be used to override the + default endpoint provided by the client. GOOGLE_API_USE_MTLS_ENDPOINT + environment variable can also be used to override the endpoint: + "always" (always use the default mTLS endpoint), "never" (always + use the default regular endpoint) and "auto" (auto switch to the + default mTLS endpoint if client certificate is present, this is + the default value). However, the ``api_endpoint`` property takes + precedence if provided. + (2) If GOOGLE_API_USE_CLIENT_CERTIFICATE environment variable + is "true", then the ``client_cert_source`` property can be used + to provide client certificate for mutual TLS transport. If + not provided, the default SSL client certificate will be used if + present. If GOOGLE_API_USE_CLIENT_CERTIFICATE is "false" or not + set, no client certificate will be used. + client_info (google.api_core.gapic_v1.client_info.ClientInfo): + The client info used to send a user-agent string along with + API requests. If ``None``, then default info will be used. + Generally, you only need to set this if you're developing + your own client library. + + Raises: + google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport + creation failed for any reason. + """ + if isinstance(client_options, dict): + client_options = client_options_lib.from_dict(client_options) + if client_options is None: + client_options = client_options_lib.ClientOptions() + client_options = cast(client_options_lib.ClientOptions, client_options) + + api_endpoint, client_cert_source_func = self.get_mtls_endpoint_and_cert_source(client_options) + + api_key_value = getattr(client_options, "api_key", None) + if api_key_value and credentials: + raise ValueError("client_options.api_key and credentials are mutually exclusive") + + # Save or instantiate the transport. + # Ordinarily, we provide the transport, but allowing a custom transport + # instance provides an extensibility point for unusual situations. + if isinstance(transport, CertificateAuthorityServiceTransport): + # transport is a CertificateAuthorityServiceTransport instance. + if credentials or client_options.credentials_file or api_key_value: + raise ValueError("When providing a transport instance, " + "provide its credentials directly.") + if client_options.scopes: + raise ValueError( + "When providing a transport instance, provide its scopes " + "directly." + ) + self._transport = transport + else: + import google.auth._default # type: ignore + + if api_key_value and hasattr(google.auth._default, "get_api_key_credentials"): + credentials = google.auth._default.get_api_key_credentials(api_key_value) + + Transport = type(self).get_transport_class(transport) + self._transport = Transport( + credentials=credentials, + credentials_file=client_options.credentials_file, + host=api_endpoint, + scopes=client_options.scopes, + client_cert_source_for_mtls=client_cert_source_func, + quota_project_id=client_options.quota_project_id, + client_info=client_info, + always_use_jwt_access=True, + api_audience=client_options.api_audience, + ) + + def create_certificate(self, + request: Optional[Union[service.CreateCertificateRequest, dict]] = None, + *, + parent: Optional[str] = None, + certificate: Optional[resources.Certificate] = None, + certificate_id: Optional[str] = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, str]] = (), + ) -> resources.Certificate: + r"""Create a new + [Certificate][google.cloud.security.privateca.v1.Certificate] in + a given Project, Location from a particular + [CaPool][google.cloud.security.privateca.v1.CaPool]. + + .. code-block:: python + + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html + from google.cloud.security import privateca_v1 + + def sample_create_certificate(): + # Create a client + client = privateca_v1.CertificateAuthorityServiceClient() + + # Initialize request argument(s) + certificate = privateca_v1.Certificate() + certificate.pem_csr = "pem_csr_value" + + request = privateca_v1.CreateCertificateRequest( + parent="parent_value", + certificate=certificate, + ) + + # Make the request + response = client.create_certificate(request=request) + + # Handle the response + print(response) + + Args: + request (Union[google.cloud.security.privateca_v1.types.CreateCertificateRequest, dict]): + The request object. Request message for + [CertificateAuthorityService.CreateCertificate][google.cloud.security.privateca.v1.CertificateAuthorityService.CreateCertificate]. + parent (str): + Required. The resource name of the + [CaPool][google.cloud.security.privateca.v1.CaPool] + associated with the + [Certificate][google.cloud.security.privateca.v1.Certificate], + in the format ``projects/*/locations/*/caPools/*``. + + This corresponds to the ``parent`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + certificate (google.cloud.security.privateca_v1.types.Certificate): + Required. A + [Certificate][google.cloud.security.privateca.v1.Certificate] + with initial field values. + + This corresponds to the ``certificate`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + certificate_id (str): + Optional. It must be unique within a location and match + the regular expression ``[a-zA-Z0-9_-]{1,63}``. This + field is required when using a + [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority] + in the Enterprise [CertificateAuthority.Tier][], but is + optional and its value is ignored otherwise. + + 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. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.cloud.security.privateca_v1.types.Certificate: + A [Certificate][google.cloud.security.privateca.v1.Certificate] corresponds to a signed X.509 certificate issued by a + [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority]. + + """ + # Create or coerce a protobuf request object. + # Quick check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([parent, certificate, certificate_id]) + if request is not None and has_flattened_params: + raise ValueError('If the `request` argument is set, then none of ' + 'the individual field arguments should be set.') + + # Minor optimization to avoid making a copy if the user passes + # in a service.CreateCertificateRequest. + # There's no risk of modifying the input as we've already verified + # 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: + request.certificate = certificate + if certificate_id is not None: + request.certificate_id = certificate_id + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.create_certificate] + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata(( + ("parent", request.parent), + )), + ) + + # Send the request. + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Done; return the response. + return response + + def get_certificate(self, + request: Optional[Union[service.GetCertificateRequest, dict]] = None, + *, + name: Optional[str] = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, str]] = (), + ) -> resources.Certificate: + r"""Returns a + [Certificate][google.cloud.security.privateca.v1.Certificate]. + + .. code-block:: python + + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html + from google.cloud.security import privateca_v1 + + def sample_get_certificate(): + # Create a client + client = privateca_v1.CertificateAuthorityServiceClient() + + # Initialize request argument(s) + request = privateca_v1.GetCertificateRequest( + name="name_value", + ) + + # Make the request + response = client.get_certificate(request=request) + + # Handle the response + print(response) + + Args: + request (Union[google.cloud.security.privateca_v1.types.GetCertificateRequest, dict]): + The request object. Request message for + [CertificateAuthorityService.GetCertificate][google.cloud.security.privateca.v1.CertificateAuthorityService.GetCertificate]. + name (str): + Required. The + [name][google.cloud.security.privateca.v1.Certificate.name] + of the + [Certificate][google.cloud.security.privateca.v1.Certificate] + to get. + + 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. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.cloud.security.privateca_v1.types.Certificate: + A [Certificate][google.cloud.security.privateca.v1.Certificate] corresponds to a signed X.509 certificate issued by a + [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority]. + + """ + # Create or coerce a protobuf request object. + # Quick check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([name]) + if request is not None and has_flattened_params: + raise ValueError('If the `request` argument is set, then none of ' + 'the individual field arguments should be set.') + + # Minor optimization to avoid making a copy if the user passes + # in a service.GetCertificateRequest. + # There's no risk of modifying the input as we've already verified + # 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 + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.get_certificate] + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata(( + ("name", request.name), + )), + ) + + # Send the request. + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Done; return the response. + return response + + def list_certificates(self, + request: Optional[Union[service.ListCertificatesRequest, dict]] = None, + *, + parent: Optional[str] = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, str]] = (), + ) -> pagers.ListCertificatesPager: + r"""Lists + [Certificates][google.cloud.security.privateca.v1.Certificate]. + + .. code-block:: python + + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html + from google.cloud.security import privateca_v1 + + def sample_list_certificates(): + # Create a client + client = privateca_v1.CertificateAuthorityServiceClient() + + # Initialize request argument(s) + request = privateca_v1.ListCertificatesRequest( + parent="parent_value", + ) + + # Make the request + page_result = client.list_certificates(request=request) + + # Handle the response + for response in page_result: + print(response) + + Args: + request (Union[google.cloud.security.privateca_v1.types.ListCertificatesRequest, dict]): + The request object. Request message for + [CertificateAuthorityService.ListCertificates][google.cloud.security.privateca.v1.CertificateAuthorityService.ListCertificates]. + parent (str): + Required. The resource name of the location associated + with the + [Certificates][google.cloud.security.privateca.v1.Certificate], + in the format ``projects/*/locations/*/caPools/*``. + + 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. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.cloud.security.privateca_v1.services.certificate_authority_service.pagers.ListCertificatesPager: + Response message for + [CertificateAuthorityService.ListCertificates][google.cloud.security.privateca.v1.CertificateAuthorityService.ListCertificates]. + + Iterating over this object will yield results and + resolve additional pages automatically. + + """ + # Create or coerce a protobuf request object. + # Quick check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([parent]) + if request is not None and has_flattened_params: + raise ValueError('If the `request` argument is set, then none of ' + 'the individual field arguments should be set.') + + # Minor optimization to avoid making a copy if the user passes + # in a service.ListCertificatesRequest. + # There's no risk of modifying the input as we've already verified + # 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 + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.list_certificates] + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata(( + ("parent", request.parent), + )), + ) + + # Send the request. + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # This method is paged; wrap the response in a pager, which provides + # an `__iter__` convenience method. + response = pagers.ListCertificatesPager( + method=rpc, + request=request, + response=response, + metadata=metadata, + ) + + # Done; return the response. + return response + + def revoke_certificate(self, + request: Optional[Union[service.RevokeCertificateRequest, dict]] = None, + *, + name: Optional[str] = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, str]] = (), + ) -> resources.Certificate: + r"""Revoke a + [Certificate][google.cloud.security.privateca.v1.Certificate]. + + .. code-block:: python + + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html + from google.cloud.security import privateca_v1 + + def sample_revoke_certificate(): + # Create a client + client = privateca_v1.CertificateAuthorityServiceClient() + + # Initialize request argument(s) + request = privateca_v1.RevokeCertificateRequest( + name="name_value", + reason="ATTRIBUTE_AUTHORITY_COMPROMISE", + ) + + # Make the request + response = client.revoke_certificate(request=request) + + # Handle the response + print(response) + + Args: + request (Union[google.cloud.security.privateca_v1.types.RevokeCertificateRequest, dict]): + The request object. Request message for + [CertificateAuthorityService.RevokeCertificate][google.cloud.security.privateca.v1.CertificateAuthorityService.RevokeCertificate]. + name (str): + Required. The resource name for this + [Certificate][google.cloud.security.privateca.v1.Certificate] + in the format + ``projects/*/locations/*/caPools/*/certificates/*``. + + 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. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.cloud.security.privateca_v1.types.Certificate: + A [Certificate][google.cloud.security.privateca.v1.Certificate] corresponds to a signed X.509 certificate issued by a + [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority]. + + """ + # Create or coerce a protobuf request object. + # Quick check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([name]) + if request is not None and has_flattened_params: + raise ValueError('If the `request` argument is set, then none of ' + 'the individual field arguments should be set.') + + # Minor optimization to avoid making a copy if the user passes + # in a service.RevokeCertificateRequest. + # There's no risk of modifying the input as we've already verified + # 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 + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.revoke_certificate] + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata(( + ("name", request.name), + )), + ) + + # Send the request. + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Done; return the response. + return response + + def update_certificate(self, + request: Optional[Union[service.UpdateCertificateRequest, dict]] = None, + *, + certificate: Optional[resources.Certificate] = None, + update_mask: Optional[field_mask_pb2.FieldMask] = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, str]] = (), + ) -> resources.Certificate: + r"""Update a + [Certificate][google.cloud.security.privateca.v1.Certificate]. + Currently, the only field you can update is the + [labels][google.cloud.security.privateca.v1.Certificate.labels] + field. + + .. code-block:: python + + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html + from google.cloud.security import privateca_v1 + + def sample_update_certificate(): + # Create a client + client = privateca_v1.CertificateAuthorityServiceClient() + + # Initialize request argument(s) + certificate = privateca_v1.Certificate() + certificate.pem_csr = "pem_csr_value" + + request = privateca_v1.UpdateCertificateRequest( + certificate=certificate, + ) + + # Make the request + response = client.update_certificate(request=request) + + # Handle the response + print(response) + + Args: + request (Union[google.cloud.security.privateca_v1.types.UpdateCertificateRequest, dict]): + The request object. Request message for + [CertificateAuthorityService.UpdateCertificate][google.cloud.security.privateca.v1.CertificateAuthorityService.UpdateCertificate]. + certificate (google.cloud.security.privateca_v1.types.Certificate): + Required. + [Certificate][google.cloud.security.privateca.v1.Certificate] + with updated values. + + This corresponds to the ``certificate`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + update_mask (google.protobuf.field_mask_pb2.FieldMask): + Required. A list of fields to be + updated in this request. + + 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. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.cloud.security.privateca_v1.types.Certificate: + A [Certificate][google.cloud.security.privateca.v1.Certificate] corresponds to a signed X.509 certificate issued by a + [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority]. + + """ + # Create or coerce a protobuf request object. + # Quick check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([certificate, update_mask]) + if request is not None and has_flattened_params: + raise ValueError('If the `request` argument is set, then none of ' + 'the individual field arguments should be set.') + + # Minor optimization to avoid making a copy if the user passes + # in a service.UpdateCertificateRequest. + # There's no risk of modifying the input as we've already verified + # 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: + request.update_mask = update_mask + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.update_certificate] + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata(( + ("certificate.name", request.certificate.name), + )), + ) + + # Send the request. + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Done; return the response. + return response + + def activate_certificate_authority(self, + request: Optional[Union[service.ActivateCertificateAuthorityRequest, dict]] = None, + *, + name: Optional[str] = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, str]] = (), + ) -> operation.Operation: + r"""Activate a + [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority] + that is in state + [AWAITING_USER_ACTIVATION][google.cloud.security.privateca.v1.CertificateAuthority.State.AWAITING_USER_ACTIVATION] + and is of type + [SUBORDINATE][google.cloud.security.privateca.v1.CertificateAuthority.Type.SUBORDINATE]. + After the parent Certificate Authority signs a certificate + signing request from + [FetchCertificateAuthorityCsr][google.cloud.security.privateca.v1.CertificateAuthorityService.FetchCertificateAuthorityCsr], + this method can complete the activation process. + + .. code-block:: python + + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html + from google.cloud.security import privateca_v1 + + def sample_activate_certificate_authority(): + # Create a client + client = privateca_v1.CertificateAuthorityServiceClient() + + # Initialize request argument(s) + subordinate_config = privateca_v1.SubordinateConfig() + subordinate_config.certificate_authority = "certificate_authority_value" + + request = privateca_v1.ActivateCertificateAuthorityRequest( + name="name_value", + pem_ca_certificate="pem_ca_certificate_value", + subordinate_config=subordinate_config, + ) + + # Make the request + operation = client.activate_certificate_authority(request=request) + + print("Waiting for operation to complete...") + + response = operation.result() + + # Handle the response + print(response) + + Args: + request (Union[google.cloud.security.privateca_v1.types.ActivateCertificateAuthorityRequest, dict]): + The request object. Request message for + [CertificateAuthorityService.ActivateCertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthorityService.ActivateCertificateAuthority]. + name (str): + Required. The resource name for this + [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority] + in the format + ``projects/*/locations/*/caPools/*/certificateAuthorities/*``. + + 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. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.api_core.operation.Operation: + An object representing a long-running operation. + + The result type for the operation will be :class:`google.cloud.security.privateca_v1.types.CertificateAuthority` A [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority] represents an individual Certificate Authority. + A + [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority] + can be used to create + [Certificates][google.cloud.security.privateca.v1.Certificate]. + + """ + # Create or coerce a protobuf request object. + # Quick check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([name]) + if request is not None and has_flattened_params: + raise ValueError('If the `request` argument is set, then none of ' + 'the individual field arguments should be set.') + + # Minor optimization to avoid making a copy if the user passes + # in a service.ActivateCertificateAuthorityRequest. + # There's no risk of modifying the input as we've already verified + # 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 + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.activate_certificate_authority] + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata(( + ("name", request.name), + )), + ) + + # Send the request. + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Wrap the response in an operation future. + response = operation.from_gapic( + response, + self._transport.operations_client, + resources.CertificateAuthority, + metadata_type=service.OperationMetadata, + ) + + # Done; return the response. + return response + + def create_certificate_authority(self, + request: Optional[Union[service.CreateCertificateAuthorityRequest, dict]] = None, + *, + parent: Optional[str] = None, + certificate_authority: Optional[resources.CertificateAuthority] = None, + certificate_authority_id: Optional[str] = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, str]] = (), + ) -> operation.Operation: + r"""Create a new + [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority] + in a given Project and Location. + + .. code-block:: python + + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html + from google.cloud.security import privateca_v1 + + def sample_create_certificate_authority(): + # Create a client + client = privateca_v1.CertificateAuthorityServiceClient() + + # Initialize request argument(s) + certificate_authority = privateca_v1.CertificateAuthority() + certificate_authority.type_ = "SUBORDINATE" + certificate_authority.key_spec.cloud_kms_key_version = "cloud_kms_key_version_value" + + request = privateca_v1.CreateCertificateAuthorityRequest( + parent="parent_value", + certificate_authority_id="certificate_authority_id_value", + certificate_authority=certificate_authority, + ) + + # Make the request + operation = client.create_certificate_authority(request=request) + + print("Waiting for operation to complete...") + + response = operation.result() + + # Handle the response + print(response) + + Args: + request (Union[google.cloud.security.privateca_v1.types.CreateCertificateAuthorityRequest, dict]): + The request object. Request message for + [CertificateAuthorityService.CreateCertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthorityService.CreateCertificateAuthority]. + parent (str): + Required. The resource name of the + [CaPool][google.cloud.security.privateca.v1.CaPool] + associated with the + [CertificateAuthorities][google.cloud.security.privateca.v1.CertificateAuthority], + in the format ``projects/*/locations/*/caPools/*``. + + This corresponds to the ``parent`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + certificate_authority (google.cloud.security.privateca_v1.types.CertificateAuthority): + Required. A + [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority] + with initial field values. + + This corresponds to the ``certificate_authority`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + certificate_authority_id (str): + Required. It must be unique within a location and match + the regular expression ``[a-zA-Z0-9_-]{1,63}`` + + 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. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.api_core.operation.Operation: + An object representing a long-running operation. + + The result type for the operation will be :class:`google.cloud.security.privateca_v1.types.CertificateAuthority` A [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority] represents an individual Certificate Authority. + A + [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority] + can be used to create + [Certificates][google.cloud.security.privateca.v1.Certificate]. + + """ + # Create or coerce a protobuf request object. + # Quick check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([parent, certificate_authority, certificate_authority_id]) + if request is not None and has_flattened_params: + raise ValueError('If the `request` argument is set, then none of ' + 'the individual field arguments should be set.') + + # Minor optimization to avoid making a copy if the user passes + # in a service.CreateCertificateAuthorityRequest. + # There's no risk of modifying the input as we've already verified + # 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: + request.certificate_authority = certificate_authority + if certificate_authority_id is not None: + request.certificate_authority_id = certificate_authority_id + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.create_certificate_authority] + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata(( + ("parent", request.parent), + )), + ) + + # Send the request. + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Wrap the response in an operation future. + response = operation.from_gapic( + response, + self._transport.operations_client, + resources.CertificateAuthority, + metadata_type=service.OperationMetadata, + ) + + # Done; return the response. + return response + + def disable_certificate_authority(self, + request: Optional[Union[service.DisableCertificateAuthorityRequest, dict]] = None, + *, + name: Optional[str] = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, str]] = (), + ) -> operation.Operation: + r"""Disable a + [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority]. + + .. code-block:: python + + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html + from google.cloud.security import privateca_v1 + + def sample_disable_certificate_authority(): + # Create a client + client = privateca_v1.CertificateAuthorityServiceClient() + + # Initialize request argument(s) + request = privateca_v1.DisableCertificateAuthorityRequest( + name="name_value", + ) + + # Make the request + operation = client.disable_certificate_authority(request=request) + + print("Waiting for operation to complete...") + + response = operation.result() + + # Handle the response + print(response) + + Args: + request (Union[google.cloud.security.privateca_v1.types.DisableCertificateAuthorityRequest, dict]): + The request object. Request message for + [CertificateAuthorityService.DisableCertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthorityService.DisableCertificateAuthority]. + name (str): + Required. The resource name for this + [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority] + in the format + ``projects/*/locations/*/caPools/*/certificateAuthorities/*``. + + 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. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.api_core.operation.Operation: + An object representing a long-running operation. + + The result type for the operation will be :class:`google.cloud.security.privateca_v1.types.CertificateAuthority` A [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority] represents an individual Certificate Authority. + A + [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority] + can be used to create + [Certificates][google.cloud.security.privateca.v1.Certificate]. + + """ + # Create or coerce a protobuf request object. + # Quick check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([name]) + if request is not None and has_flattened_params: + raise ValueError('If the `request` argument is set, then none of ' + 'the individual field arguments should be set.') + + # Minor optimization to avoid making a copy if the user passes + # in a service.DisableCertificateAuthorityRequest. + # There's no risk of modifying the input as we've already verified + # 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 + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.disable_certificate_authority] + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata(( + ("name", request.name), + )), + ) + + # Send the request. + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Wrap the response in an operation future. + response = operation.from_gapic( + response, + self._transport.operations_client, + resources.CertificateAuthority, + metadata_type=service.OperationMetadata, + ) + + # Done; return the response. + return response + + def enable_certificate_authority(self, + request: Optional[Union[service.EnableCertificateAuthorityRequest, dict]] = None, + *, + name: Optional[str] = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, str]] = (), + ) -> operation.Operation: + r"""Enable a + [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority]. + + .. code-block:: python + + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html + from google.cloud.security import privateca_v1 + + def sample_enable_certificate_authority(): + # Create a client + client = privateca_v1.CertificateAuthorityServiceClient() + + # Initialize request argument(s) + request = privateca_v1.EnableCertificateAuthorityRequest( + name="name_value", + ) + + # Make the request + operation = client.enable_certificate_authority(request=request) + + print("Waiting for operation to complete...") + + response = operation.result() + + # Handle the response + print(response) + + Args: + request (Union[google.cloud.security.privateca_v1.types.EnableCertificateAuthorityRequest, dict]): + The request object. Request message for + [CertificateAuthorityService.EnableCertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthorityService.EnableCertificateAuthority]. + name (str): + Required. The resource name for this + [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority] + in the format + ``projects/*/locations/*/caPools/*/certificateAuthorities/*``. + + 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. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.api_core.operation.Operation: + An object representing a long-running operation. + + The result type for the operation will be :class:`google.cloud.security.privateca_v1.types.CertificateAuthority` A [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority] represents an individual Certificate Authority. + A + [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority] + can be used to create + [Certificates][google.cloud.security.privateca.v1.Certificate]. + + """ + # Create or coerce a protobuf request object. + # Quick check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([name]) + if request is not None and has_flattened_params: + raise ValueError('If the `request` argument is set, then none of ' + 'the individual field arguments should be set.') + + # Minor optimization to avoid making a copy if the user passes + # in a service.EnableCertificateAuthorityRequest. + # There's no risk of modifying the input as we've already verified + # 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 + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.enable_certificate_authority] + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata(( + ("name", request.name), + )), + ) + + # Send the request. + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Wrap the response in an operation future. + response = operation.from_gapic( + response, + self._transport.operations_client, + resources.CertificateAuthority, + metadata_type=service.OperationMetadata, + ) + + # Done; return the response. + return response + + def fetch_certificate_authority_csr(self, + request: Optional[Union[service.FetchCertificateAuthorityCsrRequest, dict]] = None, + *, + name: Optional[str] = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, str]] = (), + ) -> service.FetchCertificateAuthorityCsrResponse: + r"""Fetch a certificate signing request (CSR) from a + [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority] + that is in state + [AWAITING_USER_ACTIVATION][google.cloud.security.privateca.v1.CertificateAuthority.State.AWAITING_USER_ACTIVATION] + and is of type + [SUBORDINATE][google.cloud.security.privateca.v1.CertificateAuthority.Type.SUBORDINATE]. + The CSR must then be signed by the desired parent Certificate + Authority, which could be another + [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority] + resource, or could be an on-prem certificate authority. See also + [ActivateCertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthorityService.ActivateCertificateAuthority]. + + .. code-block:: python + + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html + from google.cloud.security import privateca_v1 + + def sample_fetch_certificate_authority_csr(): + # Create a client + client = privateca_v1.CertificateAuthorityServiceClient() + + # Initialize request argument(s) + request = privateca_v1.FetchCertificateAuthorityCsrRequest( + name="name_value", + ) + + # Make the request + response = client.fetch_certificate_authority_csr(request=request) + + # Handle the response + print(response) + + Args: + request (Union[google.cloud.security.privateca_v1.types.FetchCertificateAuthorityCsrRequest, dict]): + The request object. Request message for + [CertificateAuthorityService.FetchCertificateAuthorityCsr][google.cloud.security.privateca.v1.CertificateAuthorityService.FetchCertificateAuthorityCsr]. + name (str): + Required. The resource name for this + [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority] + in the format + ``projects/*/locations/*/caPools/*/certificateAuthorities/*``. + + 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. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.cloud.security.privateca_v1.types.FetchCertificateAuthorityCsrResponse: + Response message for + [CertificateAuthorityService.FetchCertificateAuthorityCsr][google.cloud.security.privateca.v1.CertificateAuthorityService.FetchCertificateAuthorityCsr]. + + """ + # Create or coerce a protobuf request object. + # Quick check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([name]) + if request is not None and has_flattened_params: + raise ValueError('If the `request` argument is set, then none of ' + 'the individual field arguments should be set.') + + # Minor optimization to avoid making a copy if the user passes + # in a service.FetchCertificateAuthorityCsrRequest. + # There's no risk of modifying the input as we've already verified + # 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 + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.fetch_certificate_authority_csr] + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata(( + ("name", request.name), + )), + ) + + # Send the request. + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Done; return the response. + return response + + def get_certificate_authority(self, + request: Optional[Union[service.GetCertificateAuthorityRequest, dict]] = None, + *, + name: Optional[str] = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, str]] = (), + ) -> resources.CertificateAuthority: + r"""Returns a + [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority]. + + .. code-block:: python + + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html + from google.cloud.security import privateca_v1 + + def sample_get_certificate_authority(): + # Create a client + client = privateca_v1.CertificateAuthorityServiceClient() + + # Initialize request argument(s) + request = privateca_v1.GetCertificateAuthorityRequest( + name="name_value", + ) + + # Make the request + response = client.get_certificate_authority(request=request) + + # Handle the response + print(response) + + Args: + request (Union[google.cloud.security.privateca_v1.types.GetCertificateAuthorityRequest, dict]): + The request object. Request message for + [CertificateAuthorityService.GetCertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthorityService.GetCertificateAuthority]. + name (str): + Required. The + [name][google.cloud.security.privateca.v1.CertificateAuthority.name] + of the + [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority] + to get. + + 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. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.cloud.security.privateca_v1.types.CertificateAuthority: + A [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority] represents an individual Certificate Authority. + A + [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority] + can be used to create + [Certificates][google.cloud.security.privateca.v1.Certificate]. + + """ + # Create or coerce a protobuf request object. + # Quick check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([name]) + if request is not None and has_flattened_params: + raise ValueError('If the `request` argument is set, then none of ' + 'the individual field arguments should be set.') + + # Minor optimization to avoid making a copy if the user passes + # in a service.GetCertificateAuthorityRequest. + # There's no risk of modifying the input as we've already verified + # 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 + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.get_certificate_authority] + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata(( + ("name", request.name), + )), + ) + + # Send the request. + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Done; return the response. + return response + + def list_certificate_authorities(self, + request: Optional[Union[service.ListCertificateAuthoritiesRequest, dict]] = None, + *, + parent: Optional[str] = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, str]] = (), + ) -> pagers.ListCertificateAuthoritiesPager: + r"""Lists + [CertificateAuthorities][google.cloud.security.privateca.v1.CertificateAuthority]. + + .. code-block:: python + + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html + from google.cloud.security import privateca_v1 + + def sample_list_certificate_authorities(): + # Create a client + client = privateca_v1.CertificateAuthorityServiceClient() + + # Initialize request argument(s) + request = privateca_v1.ListCertificateAuthoritiesRequest( + parent="parent_value", + ) + + # Make the request + page_result = client.list_certificate_authorities(request=request) + + # Handle the response + for response in page_result: + print(response) + + Args: + request (Union[google.cloud.security.privateca_v1.types.ListCertificateAuthoritiesRequest, dict]): + The request object. Request message for + [CertificateAuthorityService.ListCertificateAuthorities][google.cloud.security.privateca.v1.CertificateAuthorityService.ListCertificateAuthorities]. + parent (str): + Required. The resource name of the + [CaPool][google.cloud.security.privateca.v1.CaPool] + associated with the + [CertificateAuthorities][google.cloud.security.privateca.v1.CertificateAuthority], + in the format ``projects/*/locations/*/caPools/*``. + + 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. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.cloud.security.privateca_v1.services.certificate_authority_service.pagers.ListCertificateAuthoritiesPager: + Response message for + [CertificateAuthorityService.ListCertificateAuthorities][google.cloud.security.privateca.v1.CertificateAuthorityService.ListCertificateAuthorities]. + + Iterating over this object will yield results and + resolve additional pages automatically. + + """ + # Create or coerce a protobuf request object. + # Quick check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([parent]) + if request is not None and has_flattened_params: + raise ValueError('If the `request` argument is set, then none of ' + 'the individual field arguments should be set.') + + # Minor optimization to avoid making a copy if the user passes + # in a service.ListCertificateAuthoritiesRequest. + # There's no risk of modifying the input as we've already verified + # 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 + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.list_certificate_authorities] + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata(( + ("parent", request.parent), + )), + ) + + # Send the request. + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # This method is paged; wrap the response in a pager, which provides + # an `__iter__` convenience method. + response = pagers.ListCertificateAuthoritiesPager( + method=rpc, + request=request, + response=response, + metadata=metadata, + ) + + # Done; return the response. + return response + + def undelete_certificate_authority(self, + request: Optional[Union[service.UndeleteCertificateAuthorityRequest, dict]] = None, + *, + name: Optional[str] = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, str]] = (), + ) -> operation.Operation: + r"""Undelete a + [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority] + that has been deleted. + + .. code-block:: python + + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html + from google.cloud.security import privateca_v1 + + def sample_undelete_certificate_authority(): + # Create a client + client = privateca_v1.CertificateAuthorityServiceClient() + + # Initialize request argument(s) + request = privateca_v1.UndeleteCertificateAuthorityRequest( + name="name_value", + ) + + # Make the request + operation = client.undelete_certificate_authority(request=request) + + print("Waiting for operation to complete...") + + response = operation.result() + + # Handle the response + print(response) + + Args: + request (Union[google.cloud.security.privateca_v1.types.UndeleteCertificateAuthorityRequest, dict]): + The request object. Request message for + [CertificateAuthorityService.UndeleteCertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthorityService.UndeleteCertificateAuthority]. + name (str): + Required. The resource name for this + [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority] + in the format + ``projects/*/locations/*/caPools/*/certificateAuthorities/*``. + + 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. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.api_core.operation.Operation: + An object representing a long-running operation. + + The result type for the operation will be :class:`google.cloud.security.privateca_v1.types.CertificateAuthority` A [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority] represents an individual Certificate Authority. + A + [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority] + can be used to create + [Certificates][google.cloud.security.privateca.v1.Certificate]. + + """ + # Create or coerce a protobuf request object. + # Quick check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([name]) + if request is not None and has_flattened_params: + raise ValueError('If the `request` argument is set, then none of ' + 'the individual field arguments should be set.') + + # Minor optimization to avoid making a copy if the user passes + # in a service.UndeleteCertificateAuthorityRequest. + # There's no risk of modifying the input as we've already verified + # 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 + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.undelete_certificate_authority] + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata(( + ("name", request.name), + )), + ) + + # Send the request. + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Wrap the response in an operation future. + response = operation.from_gapic( + response, + self._transport.operations_client, + resources.CertificateAuthority, + metadata_type=service.OperationMetadata, + ) + + # Done; return the response. + return response + + def delete_certificate_authority(self, + request: Optional[Union[service.DeleteCertificateAuthorityRequest, dict]] = None, + *, + name: Optional[str] = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, str]] = (), + ) -> operation.Operation: + r"""Delete a + [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority]. + + .. code-block:: python + + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html + from google.cloud.security import privateca_v1 + + def sample_delete_certificate_authority(): + # Create a client + client = privateca_v1.CertificateAuthorityServiceClient() + + # Initialize request argument(s) + request = privateca_v1.DeleteCertificateAuthorityRequest( + name="name_value", + ) + + # Make the request + operation = client.delete_certificate_authority(request=request) + + print("Waiting for operation to complete...") + + response = operation.result() + + # Handle the response + print(response) + + Args: + request (Union[google.cloud.security.privateca_v1.types.DeleteCertificateAuthorityRequest, dict]): + The request object. Request message for + [CertificateAuthorityService.DeleteCertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthorityService.DeleteCertificateAuthority]. + name (str): + Required. The resource name for this + [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority] + in the format + ``projects/*/locations/*/caPools/*/certificateAuthorities/*``. + + 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. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.api_core.operation.Operation: + An object representing a long-running operation. + + The result type for the operation will be :class:`google.cloud.security.privateca_v1.types.CertificateAuthority` A [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority] represents an individual Certificate Authority. + A + [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority] + can be used to create + [Certificates][google.cloud.security.privateca.v1.Certificate]. + + """ + # Create or coerce a protobuf request object. + # Quick check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([name]) + if request is not None and has_flattened_params: + raise ValueError('If the `request` argument is set, then none of ' + 'the individual field arguments should be set.') + + # Minor optimization to avoid making a copy if the user passes + # in a service.DeleteCertificateAuthorityRequest. + # There's no risk of modifying the input as we've already verified + # 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 + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.delete_certificate_authority] + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata(( + ("name", request.name), + )), + ) + + # Send the request. + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Wrap the response in an operation future. + response = operation.from_gapic( + response, + self._transport.operations_client, + resources.CertificateAuthority, + metadata_type=service.OperationMetadata, + ) + + # Done; return the response. + return response + + def update_certificate_authority(self, + request: Optional[Union[service.UpdateCertificateAuthorityRequest, dict]] = None, + *, + certificate_authority: Optional[resources.CertificateAuthority] = None, + update_mask: Optional[field_mask_pb2.FieldMask] = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, str]] = (), + ) -> operation.Operation: + r"""Update a + [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority]. + + .. code-block:: python + + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html + from google.cloud.security import privateca_v1 + + def sample_update_certificate_authority(): + # Create a client + client = privateca_v1.CertificateAuthorityServiceClient() + + # Initialize request argument(s) + certificate_authority = privateca_v1.CertificateAuthority() + certificate_authority.type_ = "SUBORDINATE" + certificate_authority.key_spec.cloud_kms_key_version = "cloud_kms_key_version_value" + + request = privateca_v1.UpdateCertificateAuthorityRequest( + certificate_authority=certificate_authority, + ) + + # Make the request + operation = client.update_certificate_authority(request=request) + + print("Waiting for operation to complete...") + + response = operation.result() + + # Handle the response + print(response) + + Args: + request (Union[google.cloud.security.privateca_v1.types.UpdateCertificateAuthorityRequest, dict]): + The request object. Request message for + [CertificateAuthorityService.UpdateCertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthorityService.UpdateCertificateAuthority]. + certificate_authority (google.cloud.security.privateca_v1.types.CertificateAuthority): + Required. + [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority] + with updated values. + + This corresponds to the ``certificate_authority`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + update_mask (google.protobuf.field_mask_pb2.FieldMask): + Required. A list of fields to be + updated in this request. + + 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. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.api_core.operation.Operation: + An object representing a long-running operation. + + The result type for the operation will be :class:`google.cloud.security.privateca_v1.types.CertificateAuthority` A [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority] represents an individual Certificate Authority. + A + [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority] + can be used to create + [Certificates][google.cloud.security.privateca.v1.Certificate]. + + """ + # Create or coerce a protobuf request object. + # Quick check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([certificate_authority, update_mask]) + if request is not None and has_flattened_params: + raise ValueError('If the `request` argument is set, then none of ' + 'the individual field arguments should be set.') + + # Minor optimization to avoid making a copy if the user passes + # in a service.UpdateCertificateAuthorityRequest. + # There's no risk of modifying the input as we've already verified + # 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: + request.update_mask = update_mask + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.update_certificate_authority] + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata(( + ("certificate_authority.name", request.certificate_authority.name), + )), + ) + + # Send the request. + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Wrap the response in an operation future. + response = operation.from_gapic( + response, + self._transport.operations_client, + resources.CertificateAuthority, + metadata_type=service.OperationMetadata, + ) + + # Done; return the response. + return response + + def create_ca_pool(self, + request: Optional[Union[service.CreateCaPoolRequest, dict]] = None, + *, + parent: Optional[str] = None, + ca_pool: Optional[resources.CaPool] = None, + ca_pool_id: Optional[str] = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, str]] = (), + ) -> operation.Operation: + r"""Create a [CaPool][google.cloud.security.privateca.v1.CaPool]. + + .. code-block:: python + + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html + from google.cloud.security import privateca_v1 + + def sample_create_ca_pool(): + # Create a client + client = privateca_v1.CertificateAuthorityServiceClient() + + # Initialize request argument(s) + ca_pool = privateca_v1.CaPool() + ca_pool.tier = "DEVOPS" + + request = privateca_v1.CreateCaPoolRequest( + parent="parent_value", + ca_pool_id="ca_pool_id_value", + ca_pool=ca_pool, + ) + + # Make the request + operation = client.create_ca_pool(request=request) + + print("Waiting for operation to complete...") + + response = operation.result() + + # Handle the response + print(response) + + Args: + request (Union[google.cloud.security.privateca_v1.types.CreateCaPoolRequest, dict]): + The request object. Request message for + [CertificateAuthorityService.CreateCaPool][google.cloud.security.privateca.v1.CertificateAuthorityService.CreateCaPool]. + parent (str): + Required. The resource name of the location associated + with the + [CaPool][google.cloud.security.privateca.v1.CaPool], in + the format ``projects/*/locations/*``. + + This corresponds to the ``parent`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + ca_pool (google.cloud.security.privateca_v1.types.CaPool): + Required. A + [CaPool][google.cloud.security.privateca.v1.CaPool] with + initial field values. + + This corresponds to the ``ca_pool`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + ca_pool_id (str): + Required. It must be unique within a location and match + the regular expression ``[a-zA-Z0-9_-]{1,63}`` + + 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. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.api_core.operation.Operation: + An object representing a long-running operation. + + The result type for the operation will be :class:`google.cloud.security.privateca_v1.types.CaPool` A [CaPool][google.cloud.security.privateca.v1.CaPool] represents a group of + [CertificateAuthorities][google.cloud.security.privateca.v1.CertificateAuthority] + that form a trust anchor. A + [CaPool][google.cloud.security.privateca.v1.CaPool] + can be used to manage issuance policies for one or + more + [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority] + resources and to rotate CA certificates in and out of + the trust anchor. + + """ + # Create or coerce a protobuf request object. + # Quick check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([parent, ca_pool, ca_pool_id]) + if request is not None and has_flattened_params: + raise ValueError('If the `request` argument is set, then none of ' + 'the individual field arguments should be set.') + + # Minor optimization to avoid making a copy if the user passes + # in a service.CreateCaPoolRequest. + # There's no risk of modifying the input as we've already verified + # 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: + request.ca_pool = ca_pool + if ca_pool_id is not None: + request.ca_pool_id = ca_pool_id + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.create_ca_pool] + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata(( + ("parent", request.parent), + )), + ) + + # Send the request. + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Wrap the response in an operation future. + response = operation.from_gapic( + response, + self._transport.operations_client, + resources.CaPool, + metadata_type=service.OperationMetadata, + ) + + # Done; return the response. + return response + + def update_ca_pool(self, + request: Optional[Union[service.UpdateCaPoolRequest, dict]] = None, + *, + ca_pool: Optional[resources.CaPool] = None, + update_mask: Optional[field_mask_pb2.FieldMask] = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, str]] = (), + ) -> operation.Operation: + r"""Update a [CaPool][google.cloud.security.privateca.v1.CaPool]. + + .. code-block:: python + + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html + from google.cloud.security import privateca_v1 + + def sample_update_ca_pool(): + # Create a client + client = privateca_v1.CertificateAuthorityServiceClient() + + # Initialize request argument(s) + ca_pool = privateca_v1.CaPool() + ca_pool.tier = "DEVOPS" + + request = privateca_v1.UpdateCaPoolRequest( + ca_pool=ca_pool, + ) + + # Make the request + operation = client.update_ca_pool(request=request) + + print("Waiting for operation to complete...") + + response = operation.result() + + # Handle the response + print(response) + + Args: + request (Union[google.cloud.security.privateca_v1.types.UpdateCaPoolRequest, dict]): + The request object. Request message for + [CertificateAuthorityService.UpdateCaPool][google.cloud.security.privateca.v1.CertificateAuthorityService.UpdateCaPool]. + ca_pool (google.cloud.security.privateca_v1.types.CaPool): + Required. + [CaPool][google.cloud.security.privateca.v1.CaPool] with + updated values. + + This corresponds to the ``ca_pool`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + update_mask (google.protobuf.field_mask_pb2.FieldMask): + Required. A list of fields to be + updated in this request. + + 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. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.api_core.operation.Operation: + An object representing a long-running operation. + + The result type for the operation will be :class:`google.cloud.security.privateca_v1.types.CaPool` A [CaPool][google.cloud.security.privateca.v1.CaPool] represents a group of + [CertificateAuthorities][google.cloud.security.privateca.v1.CertificateAuthority] + that form a trust anchor. A + [CaPool][google.cloud.security.privateca.v1.CaPool] + can be used to manage issuance policies for one or + more + [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority] + resources and to rotate CA certificates in and out of + the trust anchor. + + """ + # Create or coerce a protobuf request object. + # Quick check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([ca_pool, update_mask]) + if request is not None and has_flattened_params: + raise ValueError('If the `request` argument is set, then none of ' + 'the individual field arguments should be set.') + + # Minor optimization to avoid making a copy if the user passes + # in a service.UpdateCaPoolRequest. + # There's no risk of modifying the input as we've already verified + # 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: + request.update_mask = update_mask + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.update_ca_pool] + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata(( + ("ca_pool.name", request.ca_pool.name), + )), + ) + + # Send the request. + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Wrap the response in an operation future. + response = operation.from_gapic( + response, + self._transport.operations_client, + resources.CaPool, + metadata_type=service.OperationMetadata, + ) + + # Done; return the response. + return response + + def get_ca_pool(self, + request: Optional[Union[service.GetCaPoolRequest, dict]] = None, + *, + name: Optional[str] = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, str]] = (), + ) -> resources.CaPool: + r"""Returns a [CaPool][google.cloud.security.privateca.v1.CaPool]. + + .. code-block:: python + + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html + from google.cloud.security import privateca_v1 + + def sample_get_ca_pool(): + # Create a client + client = privateca_v1.CertificateAuthorityServiceClient() + + # Initialize request argument(s) + request = privateca_v1.GetCaPoolRequest( + name="name_value", + ) + + # Make the request + response = client.get_ca_pool(request=request) + + # Handle the response + print(response) + + Args: + request (Union[google.cloud.security.privateca_v1.types.GetCaPoolRequest, dict]): + The request object. Request message for + [CertificateAuthorityService.GetCaPool][google.cloud.security.privateca.v1.CertificateAuthorityService.GetCaPool]. + name (str): + Required. The + [name][google.cloud.security.privateca.v1.CaPool.name] + of the + [CaPool][google.cloud.security.privateca.v1.CaPool] to + get. + + 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. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.cloud.security.privateca_v1.types.CaPool: + A [CaPool][google.cloud.security.privateca.v1.CaPool] represents a group of + [CertificateAuthorities][google.cloud.security.privateca.v1.CertificateAuthority] + that form a trust anchor. A + [CaPool][google.cloud.security.privateca.v1.CaPool] + can be used to manage issuance policies for one or + more + [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority] + resources and to rotate CA certificates in and out of + the trust anchor. + + """ + # Create or coerce a protobuf request object. + # Quick check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([name]) + if request is not None and has_flattened_params: + raise ValueError('If the `request` argument is set, then none of ' + 'the individual field arguments should be set.') + + # Minor optimization to avoid making a copy if the user passes + # in a service.GetCaPoolRequest. + # There's no risk of modifying the input as we've already verified + # 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 + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.get_ca_pool] + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata(( + ("name", request.name), + )), + ) + + # Send the request. + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Done; return the response. + return response + + def list_ca_pools(self, + request: Optional[Union[service.ListCaPoolsRequest, dict]] = None, + *, + parent: Optional[str] = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, str]] = (), + ) -> pagers.ListCaPoolsPager: + r"""Lists [CaPools][google.cloud.security.privateca.v1.CaPool]. + + .. code-block:: python + + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html + from google.cloud.security import privateca_v1 + + def sample_list_ca_pools(): + # Create a client + client = privateca_v1.CertificateAuthorityServiceClient() + + # Initialize request argument(s) + request = privateca_v1.ListCaPoolsRequest( + parent="parent_value", + ) + + # Make the request + page_result = client.list_ca_pools(request=request) + + # Handle the response + for response in page_result: + print(response) + + Args: + request (Union[google.cloud.security.privateca_v1.types.ListCaPoolsRequest, dict]): + The request object. Request message for + [CertificateAuthorityService.ListCaPools][google.cloud.security.privateca.v1.CertificateAuthorityService.ListCaPools]. + parent (str): + Required. The resource name of the location associated + with the + [CaPools][google.cloud.security.privateca.v1.CaPool], in + the format ``projects/*/locations/*``. + + 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. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.cloud.security.privateca_v1.services.certificate_authority_service.pagers.ListCaPoolsPager: + Response message for + [CertificateAuthorityService.ListCaPools][google.cloud.security.privateca.v1.CertificateAuthorityService.ListCaPools]. + + Iterating over this object will yield results and + resolve additional pages automatically. + + """ + # Create or coerce a protobuf request object. + # Quick check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([parent]) + if request is not None and has_flattened_params: + raise ValueError('If the `request` argument is set, then none of ' + 'the individual field arguments should be set.') + + # Minor optimization to avoid making a copy if the user passes + # in a service.ListCaPoolsRequest. + # There's no risk of modifying the input as we've already verified + # 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 + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.list_ca_pools] + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata(( + ("parent", request.parent), + )), + ) + + # Send the request. + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # This method is paged; wrap the response in a pager, which provides + # an `__iter__` convenience method. + response = pagers.ListCaPoolsPager( + method=rpc, + request=request, + response=response, + metadata=metadata, + ) + + # Done; return the response. + return response + + def delete_ca_pool(self, + request: Optional[Union[service.DeleteCaPoolRequest, dict]] = None, + *, + name: Optional[str] = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, str]] = (), + ) -> operation.Operation: + r"""Delete a [CaPool][google.cloud.security.privateca.v1.CaPool]. + + .. code-block:: python + + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html + from google.cloud.security import privateca_v1 + + def sample_delete_ca_pool(): + # Create a client + client = privateca_v1.CertificateAuthorityServiceClient() + + # Initialize request argument(s) + request = privateca_v1.DeleteCaPoolRequest( + name="name_value", + ) + + # Make the request + operation = client.delete_ca_pool(request=request) + + print("Waiting for operation to complete...") + + response = operation.result() + + # Handle the response + print(response) + + Args: + request (Union[google.cloud.security.privateca_v1.types.DeleteCaPoolRequest, dict]): + The request object. Request message for + [CertificateAuthorityService.DeleteCaPool][google.cloud.security.privateca.v1.CertificateAuthorityService.DeleteCaPool]. + name (str): + Required. The resource name for this + [CaPool][google.cloud.security.privateca.v1.CaPool] in + the format ``projects/*/locations/*/caPools/*``. + + 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. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.api_core.operation.Operation: + An object representing a long-running operation. + + The result type for the operation will be :class:`google.protobuf.empty_pb2.Empty` A generic empty message that you can re-use to avoid defining duplicated + empty messages in your APIs. A typical example is to + use it as the request or the response type of an API + method. For instance: + + service Foo { + rpc Bar(google.protobuf.Empty) returns + (google.protobuf.Empty); + + } + + """ + # Create or coerce a protobuf request object. + # Quick check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([name]) + if request is not None and has_flattened_params: + raise ValueError('If the `request` argument is set, then none of ' + 'the individual field arguments should be set.') + + # Minor optimization to avoid making a copy if the user passes + # in a service.DeleteCaPoolRequest. + # There's no risk of modifying the input as we've already verified + # 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 + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.delete_ca_pool] + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata(( + ("name", request.name), + )), + ) + + # Send the request. + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Wrap the response in an operation future. + response = operation.from_gapic( + response, + self._transport.operations_client, + empty_pb2.Empty, + metadata_type=service.OperationMetadata, + ) + + # Done; return the response. + return response + + def fetch_ca_certs(self, + request: Optional[Union[service.FetchCaCertsRequest, dict]] = None, + *, + ca_pool: Optional[str] = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, str]] = (), + ) -> service.FetchCaCertsResponse: + r"""FetchCaCerts returns the current trust anchor for the + [CaPool][google.cloud.security.privateca.v1.CaPool]. This will + include CA certificate chains for all ACTIVE + [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority] + resources in the + [CaPool][google.cloud.security.privateca.v1.CaPool]. + + .. code-block:: python + + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html + from google.cloud.security import privateca_v1 + + def sample_fetch_ca_certs(): + # Create a client + client = privateca_v1.CertificateAuthorityServiceClient() + + # Initialize request argument(s) + request = privateca_v1.FetchCaCertsRequest( + ca_pool="ca_pool_value", + ) + + # Make the request + response = client.fetch_ca_certs(request=request) + + # Handle the response + print(response) + + Args: + request (Union[google.cloud.security.privateca_v1.types.FetchCaCertsRequest, dict]): + The request object. Request message for + [CertificateAuthorityService.FetchCaCerts][google.cloud.security.privateca.v1.CertificateAuthorityService.FetchCaCerts]. + ca_pool (str): + Required. The resource name for the + [CaPool][google.cloud.security.privateca.v1.CaPool] in + the format ``projects/*/locations/*/caPools/*``. + + 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. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.cloud.security.privateca_v1.types.FetchCaCertsResponse: + Response message for + [CertificateAuthorityService.FetchCaCerts][google.cloud.security.privateca.v1.CertificateAuthorityService.FetchCaCerts]. + + """ + # Create or coerce a protobuf request object. + # Quick check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([ca_pool]) + if request is not None and has_flattened_params: + raise ValueError('If the `request` argument is set, then none of ' + 'the individual field arguments should be set.') + + # Minor optimization to avoid making a copy if the user passes + # in a service.FetchCaCertsRequest. + # There's no risk of modifying the input as we've already verified + # 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 + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.fetch_ca_certs] + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata(( + ("ca_pool", request.ca_pool), + )), + ) + + # Send the request. + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Done; return the response. + return response + + def get_certificate_revocation_list(self, + request: Optional[Union[service.GetCertificateRevocationListRequest, dict]] = None, + *, + name: Optional[str] = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, str]] = (), + ) -> resources.CertificateRevocationList: + r"""Returns a + [CertificateRevocationList][google.cloud.security.privateca.v1.CertificateRevocationList]. + + .. code-block:: python + + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html + from google.cloud.security import privateca_v1 + + def sample_get_certificate_revocation_list(): + # Create a client + client = privateca_v1.CertificateAuthorityServiceClient() + + # Initialize request argument(s) + request = privateca_v1.GetCertificateRevocationListRequest( + name="name_value", + ) + + # Make the request + response = client.get_certificate_revocation_list(request=request) + + # Handle the response + print(response) + + Args: + request (Union[google.cloud.security.privateca_v1.types.GetCertificateRevocationListRequest, dict]): + The request object. Request message for + [CertificateAuthorityService.GetCertificateRevocationList][google.cloud.security.privateca.v1.CertificateAuthorityService.GetCertificateRevocationList]. + name (str): + Required. The + [name][google.cloud.security.privateca.v1.CertificateRevocationList.name] + of the + [CertificateRevocationList][google.cloud.security.privateca.v1.CertificateRevocationList] + to get. + + 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. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.cloud.security.privateca_v1.types.CertificateRevocationList: + A [CertificateRevocationList][google.cloud.security.privateca.v1.CertificateRevocationList] corresponds to a signed X.509 certificate + Revocation List (CRL). A CRL contains the serial + numbers of certificates that should no longer be + trusted. + + """ + # Create or coerce a protobuf request object. + # Quick check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([name]) + if request is not None and has_flattened_params: + raise ValueError('If the `request` argument is set, then none of ' + 'the individual field arguments should be set.') + + # Minor optimization to avoid making a copy if the user passes + # in a service.GetCertificateRevocationListRequest. + # There's no risk of modifying the input as we've already verified + # 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 + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.get_certificate_revocation_list] + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata(( + ("name", request.name), + )), + ) + + # Send the request. + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Done; return the response. + return response + + def list_certificate_revocation_lists(self, + request: Optional[Union[service.ListCertificateRevocationListsRequest, dict]] = None, + *, + parent: Optional[str] = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, str]] = (), + ) -> pagers.ListCertificateRevocationListsPager: + r"""Lists + [CertificateRevocationLists][google.cloud.security.privateca.v1.CertificateRevocationList]. + + .. code-block:: python + + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html + from google.cloud.security import privateca_v1 + + def sample_list_certificate_revocation_lists(): + # Create a client + client = privateca_v1.CertificateAuthorityServiceClient() + + # Initialize request argument(s) + request = privateca_v1.ListCertificateRevocationListsRequest( + parent="parent_value", + ) + + # Make the request + page_result = client.list_certificate_revocation_lists(request=request) + + # Handle the response + for response in page_result: + print(response) + + Args: + request (Union[google.cloud.security.privateca_v1.types.ListCertificateRevocationListsRequest, dict]): + The request object. Request message for + [CertificateAuthorityService.ListCertificateRevocationLists][google.cloud.security.privateca.v1.CertificateAuthorityService.ListCertificateRevocationLists]. + parent (str): + Required. The resource name of the location associated + with the + [CertificateRevocationLists][google.cloud.security.privateca.v1.CertificateRevocationList], + in the format + ``projects/*/locations/*/caPools/*/certificateAuthorities/*``. + + 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. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.cloud.security.privateca_v1.services.certificate_authority_service.pagers.ListCertificateRevocationListsPager: + Response message for + [CertificateAuthorityService.ListCertificateRevocationLists][google.cloud.security.privateca.v1.CertificateAuthorityService.ListCertificateRevocationLists]. + + Iterating over this object will yield results and + resolve additional pages automatically. + + """ + # Create or coerce a protobuf request object. + # Quick check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([parent]) + if request is not None and has_flattened_params: + raise ValueError('If the `request` argument is set, then none of ' + 'the individual field arguments should be set.') + + # Minor optimization to avoid making a copy if the user passes + # in a service.ListCertificateRevocationListsRequest. + # There's no risk of modifying the input as we've already verified + # 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 + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.list_certificate_revocation_lists] + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata(( + ("parent", request.parent), + )), + ) + + # Send the request. + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # This method is paged; wrap the response in a pager, which provides + # an `__iter__` convenience method. + response = pagers.ListCertificateRevocationListsPager( + method=rpc, + request=request, + response=response, + metadata=metadata, + ) + + # Done; return the response. + return response + + def update_certificate_revocation_list(self, + request: Optional[Union[service.UpdateCertificateRevocationListRequest, dict]] = None, + *, + certificate_revocation_list: Optional[resources.CertificateRevocationList] = None, + update_mask: Optional[field_mask_pb2.FieldMask] = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, str]] = (), + ) -> operation.Operation: + r"""Update a + [CertificateRevocationList][google.cloud.security.privateca.v1.CertificateRevocationList]. + + .. code-block:: python + + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html + from google.cloud.security import privateca_v1 + + def sample_update_certificate_revocation_list(): + # Create a client + client = privateca_v1.CertificateAuthorityServiceClient() + + # Initialize request argument(s) + request = privateca_v1.UpdateCertificateRevocationListRequest( + ) + + # Make the request + operation = client.update_certificate_revocation_list(request=request) + + print("Waiting for operation to complete...") + + response = operation.result() + + # Handle the response + print(response) + + Args: + request (Union[google.cloud.security.privateca_v1.types.UpdateCertificateRevocationListRequest, dict]): + The request object. Request message for + [CertificateAuthorityService.UpdateCertificateRevocationList][google.cloud.security.privateca.v1.CertificateAuthorityService.UpdateCertificateRevocationList]. + certificate_revocation_list (google.cloud.security.privateca_v1.types.CertificateRevocationList): + Required. + [CertificateRevocationList][google.cloud.security.privateca.v1.CertificateRevocationList] + with updated values. + + This corresponds to the ``certificate_revocation_list`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + update_mask (google.protobuf.field_mask_pb2.FieldMask): + Required. A list of fields to be + updated in this request. + + 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. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.api_core.operation.Operation: + An object representing a long-running operation. + + The result type for the operation will be :class:`google.cloud.security.privateca_v1.types.CertificateRevocationList` A [CertificateRevocationList][google.cloud.security.privateca.v1.CertificateRevocationList] corresponds to a signed X.509 certificate + Revocation List (CRL). A CRL contains the serial + numbers of certificates that should no longer be + trusted. + + """ + # Create or coerce a protobuf request object. + # Quick check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([certificate_revocation_list, update_mask]) + if request is not None and has_flattened_params: + raise ValueError('If the `request` argument is set, then none of ' + 'the individual field arguments should be set.') + + # Minor optimization to avoid making a copy if the user passes + # in a service.UpdateCertificateRevocationListRequest. + # There's no risk of modifying the input as we've already verified + # 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: + request.update_mask = update_mask + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.update_certificate_revocation_list] + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata(( + ("certificate_revocation_list.name", request.certificate_revocation_list.name), + )), + ) + + # Send the request. + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Wrap the response in an operation future. + response = operation.from_gapic( + response, + self._transport.operations_client, + resources.CertificateRevocationList, + metadata_type=service.OperationMetadata, + ) + + # Done; return the response. + return response + + def create_certificate_template(self, + request: Optional[Union[service.CreateCertificateTemplateRequest, dict]] = None, + *, + parent: Optional[str] = None, + certificate_template: Optional[resources.CertificateTemplate] = None, + certificate_template_id: Optional[str] = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, str]] = (), + ) -> operation.Operation: + r"""Create a new + [CertificateTemplate][google.cloud.security.privateca.v1.CertificateTemplate] + in a given Project and Location. + + .. code-block:: python + + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html + from google.cloud.security import privateca_v1 + + def sample_create_certificate_template(): + # Create a client + client = privateca_v1.CertificateAuthorityServiceClient() + + # Initialize request argument(s) + request = privateca_v1.CreateCertificateTemplateRequest( + parent="parent_value", + certificate_template_id="certificate_template_id_value", + ) + + # Make the request + operation = client.create_certificate_template(request=request) + + print("Waiting for operation to complete...") + + response = operation.result() + + # Handle the response + print(response) + + Args: + request (Union[google.cloud.security.privateca_v1.types.CreateCertificateTemplateRequest, dict]): + The request object. Request message for + [CertificateAuthorityService.CreateCertificateTemplate][google.cloud.security.privateca.v1.CertificateAuthorityService.CreateCertificateTemplate]. + parent (str): + Required. The resource name of the location associated + with the + [CertificateTemplate][google.cloud.security.privateca.v1.CertificateTemplate], + in the format ``projects/*/locations/*``. + + This corresponds to the ``parent`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + certificate_template (google.cloud.security.privateca_v1.types.CertificateTemplate): + Required. A + [CertificateTemplate][google.cloud.security.privateca.v1.CertificateTemplate] + with initial field values. + + This corresponds to the ``certificate_template`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + certificate_template_id (str): + Required. It must be unique within a location and match + the regular expression ``[a-zA-Z0-9_-]{1,63}`` + + 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. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.api_core.operation.Operation: + An object representing a long-running operation. + + The result type for the operation will be :class:`google.cloud.security.privateca_v1.types.CertificateTemplate` A [CertificateTemplate][google.cloud.security.privateca.v1.CertificateTemplate] refers to a managed template for certificate + issuance. + + """ + # Create or coerce a protobuf request object. + # Quick check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([parent, certificate_template, certificate_template_id]) + if request is not None and has_flattened_params: + raise ValueError('If the `request` argument is set, then none of ' + 'the individual field arguments should be set.') + + # Minor optimization to avoid making a copy if the user passes + # in a service.CreateCertificateTemplateRequest. + # There's no risk of modifying the input as we've already verified + # 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: + request.certificate_template = certificate_template + if certificate_template_id is not None: + request.certificate_template_id = certificate_template_id + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.create_certificate_template] + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata(( + ("parent", request.parent), + )), + ) + + # Send the request. + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Wrap the response in an operation future. + response = operation.from_gapic( + response, + self._transport.operations_client, + resources.CertificateTemplate, + metadata_type=service.OperationMetadata, + ) + + # Done; return the response. + return response + + def delete_certificate_template(self, + request: Optional[Union[service.DeleteCertificateTemplateRequest, dict]] = None, + *, + name: Optional[str] = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, str]] = (), + ) -> operation.Operation: + r"""DeleteCertificateTemplate deletes a + [CertificateTemplate][google.cloud.security.privateca.v1.CertificateTemplate]. + + .. code-block:: python + + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html + from google.cloud.security import privateca_v1 + + def sample_delete_certificate_template(): + # Create a client + client = privateca_v1.CertificateAuthorityServiceClient() + + # Initialize request argument(s) + request = privateca_v1.DeleteCertificateTemplateRequest( + name="name_value", + ) + + # Make the request + operation = client.delete_certificate_template(request=request) + + print("Waiting for operation to complete...") + + response = operation.result() + + # Handle the response + print(response) + + Args: + request (Union[google.cloud.security.privateca_v1.types.DeleteCertificateTemplateRequest, dict]): + The request object. Request message for + [CertificateAuthorityService.DeleteCertificateTemplate][google.cloud.security.privateca.v1.CertificateAuthorityService.DeleteCertificateTemplate]. + name (str): + Required. The resource name for this + [CertificateTemplate][google.cloud.security.privateca.v1.CertificateTemplate] + in the format + ``projects/*/locations/*/certificateTemplates/*``. + + 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. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.api_core.operation.Operation: + An object representing a long-running operation. + + The result type for the operation will be :class:`google.protobuf.empty_pb2.Empty` A generic empty message that you can re-use to avoid defining duplicated + empty messages in your APIs. A typical example is to + use it as the request or the response type of an API + method. For instance: + + service Foo { + rpc Bar(google.protobuf.Empty) returns + (google.protobuf.Empty); + + } + + """ + # Create or coerce a protobuf request object. + # Quick check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([name]) + if request is not None and has_flattened_params: + raise ValueError('If the `request` argument is set, then none of ' + 'the individual field arguments should be set.') + + # Minor optimization to avoid making a copy if the user passes + # in a service.DeleteCertificateTemplateRequest. + # There's no risk of modifying the input as we've already verified + # 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 + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.delete_certificate_template] + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata(( + ("name", request.name), + )), + ) + + # Send the request. + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Wrap the response in an operation future. + response = operation.from_gapic( + response, + self._transport.operations_client, + empty_pb2.Empty, + metadata_type=service.OperationMetadata, + ) + + # Done; return the response. + return response + + def get_certificate_template(self, + request: Optional[Union[service.GetCertificateTemplateRequest, dict]] = None, + *, + name: Optional[str] = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, str]] = (), + ) -> resources.CertificateTemplate: + r"""Returns a + [CertificateTemplate][google.cloud.security.privateca.v1.CertificateTemplate]. + + .. code-block:: python + + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html + from google.cloud.security import privateca_v1 + + def sample_get_certificate_template(): + # Create a client + client = privateca_v1.CertificateAuthorityServiceClient() + + # Initialize request argument(s) + request = privateca_v1.GetCertificateTemplateRequest( + name="name_value", + ) + + # Make the request + response = client.get_certificate_template(request=request) + + # Handle the response + print(response) + + Args: + request (Union[google.cloud.security.privateca_v1.types.GetCertificateTemplateRequest, dict]): + The request object. Request message for + [CertificateAuthorityService.GetCertificateTemplate][google.cloud.security.privateca.v1.CertificateAuthorityService.GetCertificateTemplate]. + name (str): + Required. The + [name][google.cloud.security.privateca.v1.CertificateTemplate.name] + of the + [CertificateTemplate][google.cloud.security.privateca.v1.CertificateTemplate] + to get. + + 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. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.cloud.security.privateca_v1.types.CertificateTemplate: + A [CertificateTemplate][google.cloud.security.privateca.v1.CertificateTemplate] refers to a managed template for certificate + issuance. + + """ + # Create or coerce a protobuf request object. + # Quick check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([name]) + if request is not None and has_flattened_params: + raise ValueError('If the `request` argument is set, then none of ' + 'the individual field arguments should be set.') + + # Minor optimization to avoid making a copy if the user passes + # in a service.GetCertificateTemplateRequest. + # There's no risk of modifying the input as we've already verified + # 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 + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.get_certificate_template] + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata(( + ("name", request.name), + )), + ) + + # Send the request. + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Done; return the response. + return response + + def list_certificate_templates(self, + request: Optional[Union[service.ListCertificateTemplatesRequest, dict]] = None, + *, + parent: Optional[str] = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, str]] = (), + ) -> pagers.ListCertificateTemplatesPager: + r"""Lists + [CertificateTemplates][google.cloud.security.privateca.v1.CertificateTemplate]. + + .. code-block:: python + + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html + from google.cloud.security import privateca_v1 + + def sample_list_certificate_templates(): + # Create a client + client = privateca_v1.CertificateAuthorityServiceClient() + + # Initialize request argument(s) + request = privateca_v1.ListCertificateTemplatesRequest( + parent="parent_value", + ) + + # Make the request + page_result = client.list_certificate_templates(request=request) + + # Handle the response + for response in page_result: + print(response) + + Args: + request (Union[google.cloud.security.privateca_v1.types.ListCertificateTemplatesRequest, dict]): + The request object. Request message for + [CertificateAuthorityService.ListCertificateTemplates][google.cloud.security.privateca.v1.CertificateAuthorityService.ListCertificateTemplates]. + parent (str): + Required. The resource name of the location associated + with the + [CertificateTemplates][google.cloud.security.privateca.v1.CertificateTemplate], + in the format ``projects/*/locations/*``. + + 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. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.cloud.security.privateca_v1.services.certificate_authority_service.pagers.ListCertificateTemplatesPager: + Response message for + [CertificateAuthorityService.ListCertificateTemplates][google.cloud.security.privateca.v1.CertificateAuthorityService.ListCertificateTemplates]. + + Iterating over this object will yield results and + resolve additional pages automatically. + + """ + # Create or coerce a protobuf request object. + # Quick check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([parent]) + if request is not None and has_flattened_params: + raise ValueError('If the `request` argument is set, then none of ' + 'the individual field arguments should be set.') + + # Minor optimization to avoid making a copy if the user passes + # in a service.ListCertificateTemplatesRequest. + # There's no risk of modifying the input as we've already verified + # 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 + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.list_certificate_templates] + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata(( + ("parent", request.parent), + )), + ) + + # Send the request. + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # This method is paged; wrap the response in a pager, which provides + # an `__iter__` convenience method. + response = pagers.ListCertificateTemplatesPager( + method=rpc, + request=request, + response=response, + metadata=metadata, + ) + + # Done; return the response. + return response + + def update_certificate_template(self, + request: Optional[Union[service.UpdateCertificateTemplateRequest, dict]] = None, + *, + certificate_template: Optional[resources.CertificateTemplate] = None, + update_mask: Optional[field_mask_pb2.FieldMask] = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, str]] = (), + ) -> operation.Operation: + r"""Update a + [CertificateTemplate][google.cloud.security.privateca.v1.CertificateTemplate]. + + .. code-block:: python + + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html + from google.cloud.security import privateca_v1 + + def sample_update_certificate_template(): + # Create a client + client = privateca_v1.CertificateAuthorityServiceClient() + + # Initialize request argument(s) + request = privateca_v1.UpdateCertificateTemplateRequest( + ) + + # Make the request + operation = client.update_certificate_template(request=request) + + print("Waiting for operation to complete...") + + response = operation.result() + + # Handle the response + print(response) + + Args: + request (Union[google.cloud.security.privateca_v1.types.UpdateCertificateTemplateRequest, dict]): + The request object. Request message for + [CertificateAuthorityService.UpdateCertificateTemplate][google.cloud.security.privateca.v1.CertificateAuthorityService.UpdateCertificateTemplate]. + certificate_template (google.cloud.security.privateca_v1.types.CertificateTemplate): + Required. + [CertificateTemplate][google.cloud.security.privateca.v1.CertificateTemplate] + with updated values. + + This corresponds to the ``certificate_template`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + update_mask (google.protobuf.field_mask_pb2.FieldMask): + Required. A list of fields to be + updated in this request. + + 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. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.api_core.operation.Operation: + An object representing a long-running operation. + + The result type for the operation will be :class:`google.cloud.security.privateca_v1.types.CertificateTemplate` A [CertificateTemplate][google.cloud.security.privateca.v1.CertificateTemplate] refers to a managed template for certificate + issuance. + + """ + # Create or coerce a protobuf request object. + # Quick check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([certificate_template, update_mask]) + if request is not None and has_flattened_params: + raise ValueError('If the `request` argument is set, then none of ' + 'the individual field arguments should be set.') + + # Minor optimization to avoid making a copy if the user passes + # in a service.UpdateCertificateTemplateRequest. + # There's no risk of modifying the input as we've already verified + # 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: + request.update_mask = update_mask + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.update_certificate_template] + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata(( + ("certificate_template.name", request.certificate_template.name), + )), + ) + + # Send the request. + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Wrap the response in an operation future. + response = operation.from_gapic( + response, + self._transport.operations_client, + resources.CertificateTemplate, + metadata_type=service.OperationMetadata, + ) + + # Done; return the response. + return response + + def __enter__(self) -> "CertificateAuthorityServiceClient": + return self + + def __exit__(self, type, value, traceback): + """Releases underlying transport's resources. + + .. warning:: + ONLY use as a context manager if the transport is NOT shared + with other clients! Exiting the with block will CLOSE the transport + and may cause errors in other clients! + """ + self.transport.close() + + + + + + + +DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo(gapic_version=package_version.__version__) + + +__all__ = ( + "CertificateAuthorityServiceClient", +) diff --git a/owl-bot-staging/v1/google/cloud/security/privateca_v1/services/certificate_authority_service/pagers.py b/owl-bot-staging/v1/google/cloud/security/privateca_v1/services/certificate_authority_service/pagers.py new file mode 100644 index 0000000..25dbab8 --- /dev/null +++ b/owl-bot-staging/v1/google/cloud/security/privateca_v1/services/certificate_authority_service/pagers.py @@ -0,0 +1,624 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +from typing import Any, AsyncIterator, Awaitable, Callable, Sequence, Tuple, Optional, Iterator + +from google.cloud.security.privateca_v1.types import resources +from google.cloud.security.privateca_v1.types import service + + +class ListCertificatesPager: + """A pager for iterating through ``list_certificates`` requests. + + This class thinly wraps an initial + :class:`google.cloud.security.privateca_v1.types.ListCertificatesResponse` object, and + provides an ``__iter__`` method to iterate through its + ``certificates`` field. + + If there are more pages, the ``__iter__`` method will make additional + ``ListCertificates`` requests and continue to iterate + through the ``certificates`` field on the + corresponding responses. + + All the usual :class:`google.cloud.security.privateca_v1.types.ListCertificatesResponse` + attributes are available on the pager. If multiple requests are made, only + the most recent response is retained, and thus used for attribute lookup. + """ + def __init__(self, + method: Callable[..., service.ListCertificatesResponse], + request: service.ListCertificatesRequest, + response: service.ListCertificatesResponse, + *, + metadata: Sequence[Tuple[str, str]] = ()): + """Instantiate the pager. + + Args: + method (Callable): The method that was originally called, and + which instantiated this pager. + request (google.cloud.security.privateca_v1.types.ListCertificatesRequest): + The initial request object. + response (google.cloud.security.privateca_v1.types.ListCertificatesResponse): + The initial response object. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + """ + self._method = method + self._request = service.ListCertificatesRequest(request) + self._response = response + self._metadata = metadata + + def __getattr__(self, name: str) -> Any: + return getattr(self._response, name) + + @property + def pages(self) -> Iterator[service.ListCertificatesResponse]: + yield self._response + while self._response.next_page_token: + self._request.page_token = self._response.next_page_token + self._response = self._method(self._request, metadata=self._metadata) + yield self._response + + def __iter__(self) -> Iterator[resources.Certificate]: + for page in self.pages: + yield from page.certificates + + def __repr__(self) -> str: + return '{0}<{1!r}>'.format(self.__class__.__name__, self._response) + + +class ListCertificatesAsyncPager: + """A pager for iterating through ``list_certificates`` requests. + + This class thinly wraps an initial + :class:`google.cloud.security.privateca_v1.types.ListCertificatesResponse` object, and + provides an ``__aiter__`` method to iterate through its + ``certificates`` field. + + If there are more pages, the ``__aiter__`` method will make additional + ``ListCertificates`` requests and continue to iterate + through the ``certificates`` field on the + corresponding responses. + + All the usual :class:`google.cloud.security.privateca_v1.types.ListCertificatesResponse` + attributes are available on the pager. If multiple requests are made, only + the most recent response is retained, and thus used for attribute lookup. + """ + def __init__(self, + method: Callable[..., Awaitable[service.ListCertificatesResponse]], + request: service.ListCertificatesRequest, + response: service.ListCertificatesResponse, + *, + metadata: Sequence[Tuple[str, str]] = ()): + """Instantiates the pager. + + Args: + method (Callable): The method that was originally called, and + which instantiated this pager. + request (google.cloud.security.privateca_v1.types.ListCertificatesRequest): + The initial request object. + response (google.cloud.security.privateca_v1.types.ListCertificatesResponse): + The initial response object. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + """ + self._method = method + self._request = service.ListCertificatesRequest(request) + self._response = response + self._metadata = metadata + + def __getattr__(self, name: str) -> Any: + return getattr(self._response, name) + + @property + async def pages(self) -> AsyncIterator[service.ListCertificatesResponse]: + yield self._response + while self._response.next_page_token: + self._request.page_token = self._response.next_page_token + self._response = await self._method(self._request, metadata=self._metadata) + yield self._response + def __aiter__(self) -> AsyncIterator[resources.Certificate]: + async def async_generator(): + async for page in self.pages: + for response in page.certificates: + yield response + + return async_generator() + + def __repr__(self) -> str: + return '{0}<{1!r}>'.format(self.__class__.__name__, self._response) + + +class ListCertificateAuthoritiesPager: + """A pager for iterating through ``list_certificate_authorities`` requests. + + This class thinly wraps an initial + :class:`google.cloud.security.privateca_v1.types.ListCertificateAuthoritiesResponse` object, and + provides an ``__iter__`` method to iterate through its + ``certificate_authorities`` field. + + If there are more pages, the ``__iter__`` method will make additional + ``ListCertificateAuthorities`` requests and continue to iterate + through the ``certificate_authorities`` field on the + corresponding responses. + + All the usual :class:`google.cloud.security.privateca_v1.types.ListCertificateAuthoritiesResponse` + attributes are available on the pager. If multiple requests are made, only + the most recent response is retained, and thus used for attribute lookup. + """ + def __init__(self, + method: Callable[..., service.ListCertificateAuthoritiesResponse], + request: service.ListCertificateAuthoritiesRequest, + response: service.ListCertificateAuthoritiesResponse, + *, + metadata: Sequence[Tuple[str, str]] = ()): + """Instantiate the pager. + + Args: + method (Callable): The method that was originally called, and + which instantiated this pager. + request (google.cloud.security.privateca_v1.types.ListCertificateAuthoritiesRequest): + The initial request object. + response (google.cloud.security.privateca_v1.types.ListCertificateAuthoritiesResponse): + The initial response object. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + """ + self._method = method + self._request = service.ListCertificateAuthoritiesRequest(request) + self._response = response + self._metadata = metadata + + def __getattr__(self, name: str) -> Any: + return getattr(self._response, name) + + @property + def pages(self) -> Iterator[service.ListCertificateAuthoritiesResponse]: + yield self._response + while self._response.next_page_token: + self._request.page_token = self._response.next_page_token + self._response = self._method(self._request, metadata=self._metadata) + yield self._response + + def __iter__(self) -> Iterator[resources.CertificateAuthority]: + for page in self.pages: + yield from page.certificate_authorities + + def __repr__(self) -> str: + return '{0}<{1!r}>'.format(self.__class__.__name__, self._response) + + +class ListCertificateAuthoritiesAsyncPager: + """A pager for iterating through ``list_certificate_authorities`` requests. + + This class thinly wraps an initial + :class:`google.cloud.security.privateca_v1.types.ListCertificateAuthoritiesResponse` object, and + provides an ``__aiter__`` method to iterate through its + ``certificate_authorities`` field. + + If there are more pages, the ``__aiter__`` method will make additional + ``ListCertificateAuthorities`` requests and continue to iterate + through the ``certificate_authorities`` field on the + corresponding responses. + + All the usual :class:`google.cloud.security.privateca_v1.types.ListCertificateAuthoritiesResponse` + attributes are available on the pager. If multiple requests are made, only + the most recent response is retained, and thus used for attribute lookup. + """ + def __init__(self, + method: Callable[..., Awaitable[service.ListCertificateAuthoritiesResponse]], + request: service.ListCertificateAuthoritiesRequest, + response: service.ListCertificateAuthoritiesResponse, + *, + metadata: Sequence[Tuple[str, str]] = ()): + """Instantiates the pager. + + Args: + method (Callable): The method that was originally called, and + which instantiated this pager. + request (google.cloud.security.privateca_v1.types.ListCertificateAuthoritiesRequest): + The initial request object. + response (google.cloud.security.privateca_v1.types.ListCertificateAuthoritiesResponse): + The initial response object. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + """ + self._method = method + self._request = service.ListCertificateAuthoritiesRequest(request) + self._response = response + self._metadata = metadata + + def __getattr__(self, name: str) -> Any: + return getattr(self._response, name) + + @property + async def pages(self) -> AsyncIterator[service.ListCertificateAuthoritiesResponse]: + yield self._response + while self._response.next_page_token: + self._request.page_token = self._response.next_page_token + self._response = await self._method(self._request, metadata=self._metadata) + yield self._response + def __aiter__(self) -> AsyncIterator[resources.CertificateAuthority]: + async def async_generator(): + async for page in self.pages: + for response in page.certificate_authorities: + yield response + + return async_generator() + + def __repr__(self) -> str: + return '{0}<{1!r}>'.format(self.__class__.__name__, self._response) + + +class ListCaPoolsPager: + """A pager for iterating through ``list_ca_pools`` requests. + + This class thinly wraps an initial + :class:`google.cloud.security.privateca_v1.types.ListCaPoolsResponse` object, and + provides an ``__iter__`` method to iterate through its + ``ca_pools`` field. + + If there are more pages, the ``__iter__`` method will make additional + ``ListCaPools`` requests and continue to iterate + through the ``ca_pools`` field on the + corresponding responses. + + All the usual :class:`google.cloud.security.privateca_v1.types.ListCaPoolsResponse` + attributes are available on the pager. If multiple requests are made, only + the most recent response is retained, and thus used for attribute lookup. + """ + def __init__(self, + method: Callable[..., service.ListCaPoolsResponse], + request: service.ListCaPoolsRequest, + response: service.ListCaPoolsResponse, + *, + metadata: Sequence[Tuple[str, str]] = ()): + """Instantiate the pager. + + Args: + method (Callable): The method that was originally called, and + which instantiated this pager. + request (google.cloud.security.privateca_v1.types.ListCaPoolsRequest): + The initial request object. + response (google.cloud.security.privateca_v1.types.ListCaPoolsResponse): + The initial response object. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + """ + self._method = method + self._request = service.ListCaPoolsRequest(request) + self._response = response + self._metadata = metadata + + def __getattr__(self, name: str) -> Any: + return getattr(self._response, name) + + @property + def pages(self) -> Iterator[service.ListCaPoolsResponse]: + yield self._response + while self._response.next_page_token: + self._request.page_token = self._response.next_page_token + self._response = self._method(self._request, metadata=self._metadata) + yield self._response + + def __iter__(self) -> Iterator[resources.CaPool]: + for page in self.pages: + yield from page.ca_pools + + def __repr__(self) -> str: + return '{0}<{1!r}>'.format(self.__class__.__name__, self._response) + + +class ListCaPoolsAsyncPager: + """A pager for iterating through ``list_ca_pools`` requests. + + This class thinly wraps an initial + :class:`google.cloud.security.privateca_v1.types.ListCaPoolsResponse` object, and + provides an ``__aiter__`` method to iterate through its + ``ca_pools`` field. + + If there are more pages, the ``__aiter__`` method will make additional + ``ListCaPools`` requests and continue to iterate + through the ``ca_pools`` field on the + corresponding responses. + + All the usual :class:`google.cloud.security.privateca_v1.types.ListCaPoolsResponse` + attributes are available on the pager. If multiple requests are made, only + the most recent response is retained, and thus used for attribute lookup. + """ + def __init__(self, + method: Callable[..., Awaitable[service.ListCaPoolsResponse]], + request: service.ListCaPoolsRequest, + response: service.ListCaPoolsResponse, + *, + metadata: Sequence[Tuple[str, str]] = ()): + """Instantiates the pager. + + Args: + method (Callable): The method that was originally called, and + which instantiated this pager. + request (google.cloud.security.privateca_v1.types.ListCaPoolsRequest): + The initial request object. + response (google.cloud.security.privateca_v1.types.ListCaPoolsResponse): + The initial response object. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + """ + self._method = method + self._request = service.ListCaPoolsRequest(request) + self._response = response + self._metadata = metadata + + def __getattr__(self, name: str) -> Any: + return getattr(self._response, name) + + @property + async def pages(self) -> AsyncIterator[service.ListCaPoolsResponse]: + yield self._response + while self._response.next_page_token: + self._request.page_token = self._response.next_page_token + self._response = await self._method(self._request, metadata=self._metadata) + yield self._response + def __aiter__(self) -> AsyncIterator[resources.CaPool]: + async def async_generator(): + async for page in self.pages: + for response in page.ca_pools: + yield response + + return async_generator() + + def __repr__(self) -> str: + return '{0}<{1!r}>'.format(self.__class__.__name__, self._response) + + +class ListCertificateRevocationListsPager: + """A pager for iterating through ``list_certificate_revocation_lists`` requests. + + This class thinly wraps an initial + :class:`google.cloud.security.privateca_v1.types.ListCertificateRevocationListsResponse` object, and + provides an ``__iter__`` method to iterate through its + ``certificate_revocation_lists`` field. + + If there are more pages, the ``__iter__`` method will make additional + ``ListCertificateRevocationLists`` requests and continue to iterate + through the ``certificate_revocation_lists`` field on the + corresponding responses. + + All the usual :class:`google.cloud.security.privateca_v1.types.ListCertificateRevocationListsResponse` + attributes are available on the pager. If multiple requests are made, only + the most recent response is retained, and thus used for attribute lookup. + """ + def __init__(self, + method: Callable[..., service.ListCertificateRevocationListsResponse], + request: service.ListCertificateRevocationListsRequest, + response: service.ListCertificateRevocationListsResponse, + *, + metadata: Sequence[Tuple[str, str]] = ()): + """Instantiate the pager. + + Args: + method (Callable): The method that was originally called, and + which instantiated this pager. + request (google.cloud.security.privateca_v1.types.ListCertificateRevocationListsRequest): + The initial request object. + response (google.cloud.security.privateca_v1.types.ListCertificateRevocationListsResponse): + The initial response object. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + """ + self._method = method + self._request = service.ListCertificateRevocationListsRequest(request) + self._response = response + self._metadata = metadata + + def __getattr__(self, name: str) -> Any: + return getattr(self._response, name) + + @property + def pages(self) -> Iterator[service.ListCertificateRevocationListsResponse]: + yield self._response + while self._response.next_page_token: + self._request.page_token = self._response.next_page_token + self._response = self._method(self._request, metadata=self._metadata) + yield self._response + + def __iter__(self) -> Iterator[resources.CertificateRevocationList]: + for page in self.pages: + yield from page.certificate_revocation_lists + + def __repr__(self) -> str: + return '{0}<{1!r}>'.format(self.__class__.__name__, self._response) + + +class ListCertificateRevocationListsAsyncPager: + """A pager for iterating through ``list_certificate_revocation_lists`` requests. + + This class thinly wraps an initial + :class:`google.cloud.security.privateca_v1.types.ListCertificateRevocationListsResponse` object, and + provides an ``__aiter__`` method to iterate through its + ``certificate_revocation_lists`` field. + + If there are more pages, the ``__aiter__`` method will make additional + ``ListCertificateRevocationLists`` requests and continue to iterate + through the ``certificate_revocation_lists`` field on the + corresponding responses. + + All the usual :class:`google.cloud.security.privateca_v1.types.ListCertificateRevocationListsResponse` + attributes are available on the pager. If multiple requests are made, only + the most recent response is retained, and thus used for attribute lookup. + """ + def __init__(self, + method: Callable[..., Awaitable[service.ListCertificateRevocationListsResponse]], + request: service.ListCertificateRevocationListsRequest, + response: service.ListCertificateRevocationListsResponse, + *, + metadata: Sequence[Tuple[str, str]] = ()): + """Instantiates the pager. + + Args: + method (Callable): The method that was originally called, and + which instantiated this pager. + request (google.cloud.security.privateca_v1.types.ListCertificateRevocationListsRequest): + The initial request object. + response (google.cloud.security.privateca_v1.types.ListCertificateRevocationListsResponse): + The initial response object. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + """ + self._method = method + self._request = service.ListCertificateRevocationListsRequest(request) + self._response = response + self._metadata = metadata + + def __getattr__(self, name: str) -> Any: + return getattr(self._response, name) + + @property + async def pages(self) -> AsyncIterator[service.ListCertificateRevocationListsResponse]: + yield self._response + while self._response.next_page_token: + self._request.page_token = self._response.next_page_token + self._response = await self._method(self._request, metadata=self._metadata) + yield self._response + def __aiter__(self) -> AsyncIterator[resources.CertificateRevocationList]: + async def async_generator(): + async for page in self.pages: + for response in page.certificate_revocation_lists: + yield response + + return async_generator() + + def __repr__(self) -> str: + return '{0}<{1!r}>'.format(self.__class__.__name__, self._response) + + +class ListCertificateTemplatesPager: + """A pager for iterating through ``list_certificate_templates`` requests. + + This class thinly wraps an initial + :class:`google.cloud.security.privateca_v1.types.ListCertificateTemplatesResponse` object, and + provides an ``__iter__`` method to iterate through its + ``certificate_templates`` field. + + If there are more pages, the ``__iter__`` method will make additional + ``ListCertificateTemplates`` requests and continue to iterate + through the ``certificate_templates`` field on the + corresponding responses. + + All the usual :class:`google.cloud.security.privateca_v1.types.ListCertificateTemplatesResponse` + attributes are available on the pager. If multiple requests are made, only + the most recent response is retained, and thus used for attribute lookup. + """ + def __init__(self, + method: Callable[..., service.ListCertificateTemplatesResponse], + request: service.ListCertificateTemplatesRequest, + response: service.ListCertificateTemplatesResponse, + *, + metadata: Sequence[Tuple[str, str]] = ()): + """Instantiate the pager. + + Args: + method (Callable): The method that was originally called, and + which instantiated this pager. + request (google.cloud.security.privateca_v1.types.ListCertificateTemplatesRequest): + The initial request object. + response (google.cloud.security.privateca_v1.types.ListCertificateTemplatesResponse): + The initial response object. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + """ + self._method = method + self._request = service.ListCertificateTemplatesRequest(request) + self._response = response + self._metadata = metadata + + def __getattr__(self, name: str) -> Any: + return getattr(self._response, name) + + @property + def pages(self) -> Iterator[service.ListCertificateTemplatesResponse]: + yield self._response + while self._response.next_page_token: + self._request.page_token = self._response.next_page_token + self._response = self._method(self._request, metadata=self._metadata) + yield self._response + + def __iter__(self) -> Iterator[resources.CertificateTemplate]: + for page in self.pages: + yield from page.certificate_templates + + def __repr__(self) -> str: + return '{0}<{1!r}>'.format(self.__class__.__name__, self._response) + + +class ListCertificateTemplatesAsyncPager: + """A pager for iterating through ``list_certificate_templates`` requests. + + This class thinly wraps an initial + :class:`google.cloud.security.privateca_v1.types.ListCertificateTemplatesResponse` object, and + provides an ``__aiter__`` method to iterate through its + ``certificate_templates`` field. + + If there are more pages, the ``__aiter__`` method will make additional + ``ListCertificateTemplates`` requests and continue to iterate + through the ``certificate_templates`` field on the + corresponding responses. + + All the usual :class:`google.cloud.security.privateca_v1.types.ListCertificateTemplatesResponse` + attributes are available on the pager. If multiple requests are made, only + the most recent response is retained, and thus used for attribute lookup. + """ + def __init__(self, + method: Callable[..., Awaitable[service.ListCertificateTemplatesResponse]], + request: service.ListCertificateTemplatesRequest, + response: service.ListCertificateTemplatesResponse, + *, + metadata: Sequence[Tuple[str, str]] = ()): + """Instantiates the pager. + + Args: + method (Callable): The method that was originally called, and + which instantiated this pager. + request (google.cloud.security.privateca_v1.types.ListCertificateTemplatesRequest): + The initial request object. + response (google.cloud.security.privateca_v1.types.ListCertificateTemplatesResponse): + The initial response object. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + """ + self._method = method + self._request = service.ListCertificateTemplatesRequest(request) + self._response = response + self._metadata = metadata + + def __getattr__(self, name: str) -> Any: + return getattr(self._response, name) + + @property + async def pages(self) -> AsyncIterator[service.ListCertificateTemplatesResponse]: + yield self._response + while self._response.next_page_token: + self._request.page_token = self._response.next_page_token + self._response = await self._method(self._request, metadata=self._metadata) + yield self._response + def __aiter__(self) -> AsyncIterator[resources.CertificateTemplate]: + async def async_generator(): + async for page in self.pages: + for response in page.certificate_templates: + yield response + + return async_generator() + + def __repr__(self) -> str: + return '{0}<{1!r}>'.format(self.__class__.__name__, self._response) diff --git a/owl-bot-staging/v1/google/cloud/security/privateca_v1/services/certificate_authority_service/transports/__init__.py b/owl-bot-staging/v1/google/cloud/security/privateca_v1/services/certificate_authority_service/transports/__init__.py new file mode 100644 index 0000000..9564748 --- /dev/null +++ b/owl-bot-staging/v1/google/cloud/security/privateca_v1/services/certificate_authority_service/transports/__init__.py @@ -0,0 +1,33 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +from collections import OrderedDict +from typing import Dict, Type + +from .base import CertificateAuthorityServiceTransport +from .grpc import CertificateAuthorityServiceGrpcTransport +from .grpc_asyncio import CertificateAuthorityServiceGrpcAsyncIOTransport + + +# Compile a registry of transports. +_transport_registry = OrderedDict() # type: Dict[str, Type[CertificateAuthorityServiceTransport]] +_transport_registry['grpc'] = CertificateAuthorityServiceGrpcTransport +_transport_registry['grpc_asyncio'] = CertificateAuthorityServiceGrpcAsyncIOTransport + +__all__ = ( + 'CertificateAuthorityServiceTransport', + 'CertificateAuthorityServiceGrpcTransport', + 'CertificateAuthorityServiceGrpcAsyncIOTransport', +) diff --git a/owl-bot-staging/v1/google/cloud/security/privateca_v1/services/certificate_authority_service/transports/base.py b/owl-bot-staging/v1/google/cloud/security/privateca_v1/services/certificate_authority_service/transports/base.py new file mode 100644 index 0000000..e96b892 --- /dev/null +++ b/owl-bot-staging/v1/google/cloud/security/privateca_v1/services/certificate_authority_service/transports/base.py @@ -0,0 +1,548 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +import abc +from typing import Awaitable, Callable, Dict, Optional, Sequence, Union + +from google.cloud.security.privateca_v1 import gapic_version as package_version + +import google.auth # type: ignore +import google.api_core +from google.api_core import exceptions as core_exceptions +from google.api_core import gapic_v1 +from google.api_core import retry as retries +from google.api_core import operations_v1 +from google.auth import credentials as ga_credentials # type: ignore +from google.oauth2 import service_account # 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 # type: ignore + +DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo(gapic_version=package_version.__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 = DEFAULT_HOST, + credentials: Optional[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, + always_use_jwt_access: Optional[bool] = False, + api_audience: Optional[str] = None, + **kwargs, + ) -> None: + """Instantiate the transport. + + Args: + 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 + are specified, the client will attempt to ascertain the + credentials from the environment. + 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. + 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): + The client info used to send a user-agent string along with + API requests. If ``None``, then default info will be used. + Generally, you only need to set this if you're developing + your own client library. + always_use_jwt_access (Optional[bool]): Whether self signed JWT should + be used for service account credentials. + """ + + scopes_kwargs = {"scopes": scopes, "default_scopes": self.AUTH_SCOPES} + + # Save the scopes. + self._scopes = scopes + + # If no credentials are provided, then determine the appropriate + # defaults. + if credentials and credentials_file: + raise core_exceptions.DuplicateCredentialArgs("'credentials_file' and 'credentials' are mutually exclusive") + + if credentials_file is not None: + credentials, _ = google.auth.load_credentials_from_file( + credentials_file, + **scopes_kwargs, + quota_project_id=quota_project_id + ) + elif credentials is None: + credentials, _ = google.auth.default(**scopes_kwargs, quota_project_id=quota_project_id) + # Don't apply audience if the credentials file passed from user. + if hasattr(credentials, "with_gdch_audience"): + credentials = credentials.with_gdch_audience(api_audience if api_audience else host) + + # If the credentials are service account credentials, then always try to use self signed JWT. + if always_use_jwt_access and isinstance(credentials, service_account.Credentials) and hasattr(service_account.Credentials, "with_always_use_jwt_access"): + credentials = credentials.with_always_use_jwt_access(True) + + # Save the credentials. + self._credentials = credentials + + # Save the hostname. Default to port 443 (HTTPS) if none is specified. + if ':' not in host: + host += ':443' + self._host = host + + def _prep_wrapped_messages(self, client_info): + # Precompute the wrapped methods. + self._wrapped_methods = { + self.create_certificate: gapic_v1.method.wrap_method( + self.create_certificate, + default_timeout=None, + client_info=client_info, + ), + self.get_certificate: gapic_v1.method.wrap_method( + self.get_certificate, + default_timeout=None, + client_info=client_info, + ), + self.list_certificates: gapic_v1.method.wrap_method( + self.list_certificates, + default_timeout=None, + client_info=client_info, + ), + self.revoke_certificate: gapic_v1.method.wrap_method( + self.revoke_certificate, + default_timeout=None, + client_info=client_info, + ), + self.update_certificate: gapic_v1.method.wrap_method( + self.update_certificate, + default_timeout=None, + client_info=client_info, + ), + self.activate_certificate_authority: gapic_v1.method.wrap_method( + self.activate_certificate_authority, + default_timeout=None, + client_info=client_info, + ), + self.create_certificate_authority: gapic_v1.method.wrap_method( + self.create_certificate_authority, + default_timeout=None, + client_info=client_info, + ), + self.disable_certificate_authority: gapic_v1.method.wrap_method( + self.disable_certificate_authority, + default_timeout=None, + client_info=client_info, + ), + self.enable_certificate_authority: gapic_v1.method.wrap_method( + self.enable_certificate_authority, + default_timeout=None, + client_info=client_info, + ), + self.fetch_certificate_authority_csr: gapic_v1.method.wrap_method( + self.fetch_certificate_authority_csr, + default_timeout=None, + client_info=client_info, + ), + self.get_certificate_authority: gapic_v1.method.wrap_method( + self.get_certificate_authority, + default_timeout=None, + client_info=client_info, + ), + self.list_certificate_authorities: gapic_v1.method.wrap_method( + self.list_certificate_authorities, + default_timeout=None, + client_info=client_info, + ), + self.undelete_certificate_authority: gapic_v1.method.wrap_method( + self.undelete_certificate_authority, + default_timeout=None, + client_info=client_info, + ), + self.delete_certificate_authority: gapic_v1.method.wrap_method( + self.delete_certificate_authority, + default_timeout=None, + client_info=client_info, + ), + self.update_certificate_authority: gapic_v1.method.wrap_method( + self.update_certificate_authority, + default_timeout=None, + client_info=client_info, + ), + self.create_ca_pool: gapic_v1.method.wrap_method( + self.create_ca_pool, + default_timeout=None, + client_info=client_info, + ), + self.update_ca_pool: gapic_v1.method.wrap_method( + self.update_ca_pool, + default_timeout=None, + client_info=client_info, + ), + self.get_ca_pool: gapic_v1.method.wrap_method( + self.get_ca_pool, + default_timeout=None, + client_info=client_info, + ), + self.list_ca_pools: gapic_v1.method.wrap_method( + self.list_ca_pools, + default_timeout=None, + client_info=client_info, + ), + self.delete_ca_pool: gapic_v1.method.wrap_method( + self.delete_ca_pool, + default_timeout=None, + client_info=client_info, + ), + self.fetch_ca_certs: gapic_v1.method.wrap_method( + self.fetch_ca_certs, + default_timeout=None, + client_info=client_info, + ), + self.get_certificate_revocation_list: gapic_v1.method.wrap_method( + self.get_certificate_revocation_list, + default_timeout=None, + client_info=client_info, + ), + self.list_certificate_revocation_lists: gapic_v1.method.wrap_method( + self.list_certificate_revocation_lists, + default_timeout=None, + client_info=client_info, + ), + self.update_certificate_revocation_list: gapic_v1.method.wrap_method( + self.update_certificate_revocation_list, + default_timeout=None, + client_info=client_info, + ), + self.create_certificate_template: gapic_v1.method.wrap_method( + self.create_certificate_template, + default_timeout=None, + client_info=client_info, + ), + self.delete_certificate_template: gapic_v1.method.wrap_method( + self.delete_certificate_template, + default_timeout=None, + client_info=client_info, + ), + self.get_certificate_template: gapic_v1.method.wrap_method( + self.get_certificate_template, + default_timeout=None, + client_info=client_info, + ), + self.list_certificate_templates: gapic_v1.method.wrap_method( + self.list_certificate_templates, + default_timeout=None, + client_info=client_info, + ), + self.update_certificate_template: gapic_v1.method.wrap_method( + self.update_certificate_template, + default_timeout=None, + client_info=client_info, + ), + } + + def close(self): + """Closes resources associated with the transport. + + .. warning:: + Only call this method if the transport is NOT shared + with other clients - this may cause errors in other clients! + """ + raise NotImplementedError() + + @property + def operations_client(self): + """Return the client designed to process long-running operations.""" + raise NotImplementedError() + + @property + def create_certificate(self) -> Callable[ + [service.CreateCertificateRequest], + Union[ + resources.Certificate, + Awaitable[resources.Certificate] + ]]: + raise NotImplementedError() + + @property + def get_certificate(self) -> Callable[ + [service.GetCertificateRequest], + Union[ + resources.Certificate, + Awaitable[resources.Certificate] + ]]: + raise NotImplementedError() + + @property + def list_certificates(self) -> Callable[ + [service.ListCertificatesRequest], + Union[ + service.ListCertificatesResponse, + Awaitable[service.ListCertificatesResponse] + ]]: + raise NotImplementedError() + + @property + def revoke_certificate(self) -> Callable[ + [service.RevokeCertificateRequest], + Union[ + resources.Certificate, + Awaitable[resources.Certificate] + ]]: + raise NotImplementedError() + + @property + def update_certificate(self) -> Callable[ + [service.UpdateCertificateRequest], + Union[ + resources.Certificate, + Awaitable[resources.Certificate] + ]]: + raise NotImplementedError() + + @property + def activate_certificate_authority(self) -> Callable[ + [service.ActivateCertificateAuthorityRequest], + Union[ + operations_pb2.Operation, + Awaitable[operations_pb2.Operation] + ]]: + raise NotImplementedError() + + @property + def create_certificate_authority(self) -> Callable[ + [service.CreateCertificateAuthorityRequest], + Union[ + operations_pb2.Operation, + Awaitable[operations_pb2.Operation] + ]]: + raise NotImplementedError() + + @property + def disable_certificate_authority(self) -> Callable[ + [service.DisableCertificateAuthorityRequest], + Union[ + operations_pb2.Operation, + Awaitable[operations_pb2.Operation] + ]]: + raise NotImplementedError() + + @property + def enable_certificate_authority(self) -> Callable[ + [service.EnableCertificateAuthorityRequest], + Union[ + operations_pb2.Operation, + Awaitable[operations_pb2.Operation] + ]]: + raise NotImplementedError() + + @property + def fetch_certificate_authority_csr(self) -> Callable[ + [service.FetchCertificateAuthorityCsrRequest], + Union[ + service.FetchCertificateAuthorityCsrResponse, + Awaitable[service.FetchCertificateAuthorityCsrResponse] + ]]: + raise NotImplementedError() + + @property + def get_certificate_authority(self) -> Callable[ + [service.GetCertificateAuthorityRequest], + Union[ + resources.CertificateAuthority, + Awaitable[resources.CertificateAuthority] + ]]: + raise NotImplementedError() + + @property + def list_certificate_authorities(self) -> Callable[ + [service.ListCertificateAuthoritiesRequest], + Union[ + service.ListCertificateAuthoritiesResponse, + Awaitable[service.ListCertificateAuthoritiesResponse] + ]]: + raise NotImplementedError() + + @property + def undelete_certificate_authority(self) -> Callable[ + [service.UndeleteCertificateAuthorityRequest], + Union[ + operations_pb2.Operation, + Awaitable[operations_pb2.Operation] + ]]: + raise NotImplementedError() + + @property + def delete_certificate_authority(self) -> Callable[ + [service.DeleteCertificateAuthorityRequest], + Union[ + operations_pb2.Operation, + Awaitable[operations_pb2.Operation] + ]]: + raise NotImplementedError() + + @property + def update_certificate_authority(self) -> Callable[ + [service.UpdateCertificateAuthorityRequest], + Union[ + operations_pb2.Operation, + Awaitable[operations_pb2.Operation] + ]]: + raise NotImplementedError() + + @property + def create_ca_pool(self) -> Callable[ + [service.CreateCaPoolRequest], + Union[ + operations_pb2.Operation, + Awaitable[operations_pb2.Operation] + ]]: + raise NotImplementedError() + + @property + def update_ca_pool(self) -> Callable[ + [service.UpdateCaPoolRequest], + Union[ + operations_pb2.Operation, + Awaitable[operations_pb2.Operation] + ]]: + raise NotImplementedError() + + @property + def get_ca_pool(self) -> Callable[ + [service.GetCaPoolRequest], + Union[ + resources.CaPool, + Awaitable[resources.CaPool] + ]]: + raise NotImplementedError() + + @property + def list_ca_pools(self) -> Callable[ + [service.ListCaPoolsRequest], + Union[ + service.ListCaPoolsResponse, + Awaitable[service.ListCaPoolsResponse] + ]]: + raise NotImplementedError() + + @property + def delete_ca_pool(self) -> Callable[ + [service.DeleteCaPoolRequest], + Union[ + operations_pb2.Operation, + Awaitable[operations_pb2.Operation] + ]]: + raise NotImplementedError() + + @property + def fetch_ca_certs(self) -> Callable[ + [service.FetchCaCertsRequest], + Union[ + service.FetchCaCertsResponse, + Awaitable[service.FetchCaCertsResponse] + ]]: + raise NotImplementedError() + + @property + def get_certificate_revocation_list(self) -> Callable[ + [service.GetCertificateRevocationListRequest], + Union[ + resources.CertificateRevocationList, + Awaitable[resources.CertificateRevocationList] + ]]: + raise NotImplementedError() + + @property + def list_certificate_revocation_lists(self) -> Callable[ + [service.ListCertificateRevocationListsRequest], + Union[ + service.ListCertificateRevocationListsResponse, + Awaitable[service.ListCertificateRevocationListsResponse] + ]]: + raise NotImplementedError() + + @property + def update_certificate_revocation_list(self) -> Callable[ + [service.UpdateCertificateRevocationListRequest], + Union[ + operations_pb2.Operation, + Awaitable[operations_pb2.Operation] + ]]: + raise NotImplementedError() + + @property + def create_certificate_template(self) -> Callable[ + [service.CreateCertificateTemplateRequest], + Union[ + operations_pb2.Operation, + Awaitable[operations_pb2.Operation] + ]]: + raise NotImplementedError() + + @property + def delete_certificate_template(self) -> Callable[ + [service.DeleteCertificateTemplateRequest], + Union[ + operations_pb2.Operation, + Awaitable[operations_pb2.Operation] + ]]: + raise NotImplementedError() + + @property + def get_certificate_template(self) -> Callable[ + [service.GetCertificateTemplateRequest], + Union[ + resources.CertificateTemplate, + Awaitable[resources.CertificateTemplate] + ]]: + raise NotImplementedError() + + @property + def list_certificate_templates(self) -> Callable[ + [service.ListCertificateTemplatesRequest], + Union[ + service.ListCertificateTemplatesResponse, + Awaitable[service.ListCertificateTemplatesResponse] + ]]: + raise NotImplementedError() + + @property + def update_certificate_template(self) -> Callable[ + [service.UpdateCertificateTemplateRequest], + Union[ + operations_pb2.Operation, + Awaitable[operations_pb2.Operation] + ]]: + raise NotImplementedError() + + @property + def kind(self) -> str: + raise NotImplementedError() + + +__all__ = ( + 'CertificateAuthorityServiceTransport', +) diff --git a/owl-bot-staging/v1/google/cloud/security/privateca_v1/services/certificate_authority_service/transports/grpc.py b/owl-bot-staging/v1/google/cloud/security/privateca_v1/services/certificate_authority_service/transports/grpc.py new file mode 100644 index 0000000..f73bb43 --- /dev/null +++ b/owl-bot-staging/v1/google/cloud/security/privateca_v1/services/certificate_authority_service/transports/grpc.py @@ -0,0 +1,1071 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +import warnings +from typing import Callable, Dict, Optional, Sequence, Tuple, Union + +from google.api_core import grpc_helpers +from google.api_core import operations_v1 +from google.api_core import gapic_v1 +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 # type: ignore +from .base import CertificateAuthorityServiceTransport, DEFAULT_CLIENT_INFO + + +class CertificateAuthorityServiceGrpcTransport(CertificateAuthorityServiceTransport): + """gRPC backend transport for CertificateAuthorityService. + + [Certificate Authority + Service][google.cloud.security.privateca.v1.CertificateAuthorityService] + manages private certificate authorities and issued certificates. + + This class defines the same methods as the primary client, so the + primary client can load the underlying transport implementation + and call it. + + It sends protocol buffers over the wire using gRPC (which is built on + top of HTTP/2); the ``grpcio`` package must be installed. + """ + _stubs: Dict[str, Callable] + + def __init__(self, *, + host: str = 'privateca.googleapis.com', + credentials: Optional[ga_credentials.Credentials] = None, + credentials_file: Optional[str] = None, + scopes: Optional[Sequence[str]] = None, + channel: Optional[grpc.Channel] = None, + api_mtls_endpoint: Optional[str] = None, + client_cert_source: Optional[Callable[[], Tuple[bytes, bytes]]] = None, + ssl_channel_credentials: Optional[grpc.ChannelCredentials] = None, + client_cert_source_for_mtls: Optional[Callable[[], Tuple[bytes, bytes]]] = None, + quota_project_id: Optional[str] = None, + client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, + always_use_jwt_access: Optional[bool] = False, + api_audience: Optional[str] = None, + ) -> None: + """Instantiate the transport. + + Args: + 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 + are specified, the client will attempt to ascertain the + credentials from the environment. + This argument is ignored if ``channel`` is provided. + credentials_file (Optional[str]): A file with credentials that can + be loaded with :func:`google.auth.load_credentials_from_file`. + This argument is ignored if ``channel`` is provided. + scopes (Optional(Sequence[str])): A list of scopes. This argument is + ignored if ``channel`` is provided. + channel (Optional[grpc.Channel]): A ``Channel`` instance through + which to make calls. + api_mtls_endpoint (Optional[str]): Deprecated. The mutual TLS endpoint. + If provided, it overrides the ``host`` argument and tries to create + a mutual TLS channel with client SSL credentials from + ``client_cert_source`` or application default SSL credentials. + client_cert_source (Optional[Callable[[], Tuple[bytes, bytes]]]): + Deprecated. A callback to provide client SSL certificate bytes and + private key bytes, both in PEM format. It is ignored if + ``api_mtls_endpoint`` is None. + ssl_channel_credentials (grpc.ChannelCredentials): SSL credentials + for the grpc channel. It is ignored if ``channel`` is provided. + client_cert_source_for_mtls (Optional[Callable[[], Tuple[bytes, bytes]]]): + A callback to provide client certificate bytes and private key bytes, + both in PEM format. It is used to configure a mutual TLS channel. It is + ignored if ``channel`` or ``ssl_channel_credentials`` is provided. + quota_project_id (Optional[str]): An optional project to use for billing + and quota. + client_info (google.api_core.gapic_v1.client_info.ClientInfo): + The client info used to send a user-agent string along with + API requests. If ``None``, then default info will be used. + Generally, you only need to set this if you're developing + your own client library. + always_use_jwt_access (Optional[bool]): Whether self signed JWT should + be used for service account credentials. + + Raises: + google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport + creation failed for any reason. + google.api_core.exceptions.DuplicateCredentialArgs: If both ``credentials`` + and ``credentials_file`` are passed. + """ + self._grpc_channel = None + self._ssl_channel_credentials = ssl_channel_credentials + self._stubs: Dict[str, Callable] = {} + self._operations_client: Optional[operations_v1.OperationsClient] = None + + if api_mtls_endpoint: + warnings.warn("api_mtls_endpoint is deprecated", DeprecationWarning) + if client_cert_source: + warnings.warn("client_cert_source is deprecated", DeprecationWarning) + + if channel: + # Ignore credentials if a channel was passed. + credentials = False + # 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 + + # Create SSL credentials with client_cert_source or application + # default SSL credentials. + if client_cert_source: + cert, key = client_cert_source() + self._ssl_channel_credentials = grpc.ssl_channel_credentials( + certificate_chain=cert, private_key=key + ) + else: + self._ssl_channel_credentials = SslCredentials().ssl_credentials + + else: + if client_cert_source_for_mtls and not ssl_channel_credentials: + cert, key = client_cert_source_for_mtls() + self._ssl_channel_credentials = grpc.ssl_channel_credentials( + certificate_chain=cert, private_key=key + ) + + # The base transport sets the host, credentials and scopes + super().__init__( + host=host, + credentials=credentials, + credentials_file=credentials_file, + scopes=scopes, + quota_project_id=quota_project_id, + client_info=client_info, + always_use_jwt_access=always_use_jwt_access, + api_audience=api_audience, + ) + + if not self._grpc_channel: + self._grpc_channel = type(self).create_channel( + self._host, + # use the credentials which are saved + credentials=self._credentials, + # Set ``credentials_file`` to ``None`` here as + # the credentials that we saved earlier should be used. + credentials_file=None, + scopes=self._scopes, + ssl_credentials=self._ssl_channel_credentials, + quota_project_id=quota_project_id, + options=[ + ("grpc.max_send_message_length", -1), + ("grpc.max_receive_message_length", -1), + ], + ) + + # Wrap messages. This must be done after self._grpc_channel exists + self._prep_wrapped_messages(client_info) + + @classmethod + def create_channel(cls, + host: str = 'privateca.googleapis.com', + credentials: Optional[ga_credentials.Credentials] = None, + credentials_file: Optional[str] = None, + scopes: Optional[Sequence[str]] = None, + quota_project_id: Optional[str] = None, + **kwargs) -> grpc.Channel: + """Create and return a gRPC channel object. + Args: + host (Optional[str]): The host for the channel to use. + credentials (Optional[~.Credentials]): The + authorization credentials to attach to requests. These + credentials identify this application to the service. If + none are specified, the client will attempt to ascertain + the credentials from the environment. + 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. + scopes (Optional[Sequence[str]]): A optional list of scopes needed for this + service. These are only used when credentials are not specified and + are passed to :func:`google.auth.default`. + quota_project_id (Optional[str]): An optional project to use for billing + and quota. + kwargs (Optional[dict]): Keyword arguments, which are passed to the + channel creation. + Returns: + grpc.Channel: A gRPC channel object. + + Raises: + google.api_core.exceptions.DuplicateCredentialArgs: If both ``credentials`` + and ``credentials_file`` are passed. + """ + + return grpc_helpers.create_channel( + host, + credentials=credentials, + credentials_file=credentials_file, + quota_project_id=quota_project_id, + default_scopes=cls.AUTH_SCOPES, + scopes=scopes, + default_host=cls.DEFAULT_HOST, + **kwargs + ) + + @property + def grpc_channel(self) -> grpc.Channel: + """Return the channel designed to connect to this service. + """ + return self._grpc_channel + + @property + def operations_client(self) -> operations_v1.OperationsClient: + """Create the client designed to process long-running operations. + + This property caches on the instance; repeated calls return the same + client. + """ + # Quick check: Only create a new client if we do not already have one. + if self._operations_client is None: + self._operations_client = operations_v1.OperationsClient( + self.grpc_channel + ) + + # Return the client from cache. + return self._operations_client + + @property + def create_certificate(self) -> Callable[ + [service.CreateCertificateRequest], + resources.Certificate]: + r"""Return a callable for the create certificate method over gRPC. + + Create a new + [Certificate][google.cloud.security.privateca.v1.Certificate] in + a given Project, Location from a particular + [CaPool][google.cloud.security.privateca.v1.CaPool]. + + Returns: + Callable[[~.CreateCertificateRequest], + ~.Certificate]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if 'create_certificate' not in self._stubs: + self._stubs['create_certificate'] = self.grpc_channel.unary_unary( + '/google.cloud.security.privateca.v1.CertificateAuthorityService/CreateCertificate', + request_serializer=service.CreateCertificateRequest.serialize, + response_deserializer=resources.Certificate.deserialize, + ) + return self._stubs['create_certificate'] + + @property + def get_certificate(self) -> Callable[ + [service.GetCertificateRequest], + resources.Certificate]: + r"""Return a callable for the get certificate method over gRPC. + + Returns a + [Certificate][google.cloud.security.privateca.v1.Certificate]. + + Returns: + Callable[[~.GetCertificateRequest], + ~.Certificate]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if 'get_certificate' not in self._stubs: + self._stubs['get_certificate'] = self.grpc_channel.unary_unary( + '/google.cloud.security.privateca.v1.CertificateAuthorityService/GetCertificate', + request_serializer=service.GetCertificateRequest.serialize, + response_deserializer=resources.Certificate.deserialize, + ) + return self._stubs['get_certificate'] + + @property + def list_certificates(self) -> Callable[ + [service.ListCertificatesRequest], + service.ListCertificatesResponse]: + r"""Return a callable for the list certificates method over gRPC. + + Lists + [Certificates][google.cloud.security.privateca.v1.Certificate]. + + Returns: + Callable[[~.ListCertificatesRequest], + ~.ListCertificatesResponse]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if 'list_certificates' not in self._stubs: + self._stubs['list_certificates'] = self.grpc_channel.unary_unary( + '/google.cloud.security.privateca.v1.CertificateAuthorityService/ListCertificates', + request_serializer=service.ListCertificatesRequest.serialize, + response_deserializer=service.ListCertificatesResponse.deserialize, + ) + return self._stubs['list_certificates'] + + @property + def revoke_certificate(self) -> Callable[ + [service.RevokeCertificateRequest], + resources.Certificate]: + r"""Return a callable for the revoke certificate method over gRPC. + + Revoke a + [Certificate][google.cloud.security.privateca.v1.Certificate]. + + Returns: + Callable[[~.RevokeCertificateRequest], + ~.Certificate]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if 'revoke_certificate' not in self._stubs: + self._stubs['revoke_certificate'] = self.grpc_channel.unary_unary( + '/google.cloud.security.privateca.v1.CertificateAuthorityService/RevokeCertificate', + request_serializer=service.RevokeCertificateRequest.serialize, + response_deserializer=resources.Certificate.deserialize, + ) + return self._stubs['revoke_certificate'] + + @property + def update_certificate(self) -> Callable[ + [service.UpdateCertificateRequest], + resources.Certificate]: + r"""Return a callable for the update certificate method over gRPC. + + Update a + [Certificate][google.cloud.security.privateca.v1.Certificate]. + Currently, the only field you can update is the + [labels][google.cloud.security.privateca.v1.Certificate.labels] + field. + + Returns: + Callable[[~.UpdateCertificateRequest], + ~.Certificate]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if 'update_certificate' not in self._stubs: + self._stubs['update_certificate'] = self.grpc_channel.unary_unary( + '/google.cloud.security.privateca.v1.CertificateAuthorityService/UpdateCertificate', + request_serializer=service.UpdateCertificateRequest.serialize, + response_deserializer=resources.Certificate.deserialize, + ) + return self._stubs['update_certificate'] + + @property + def activate_certificate_authority(self) -> Callable[ + [service.ActivateCertificateAuthorityRequest], + operations_pb2.Operation]: + r"""Return a callable for the activate certificate authority method over gRPC. + + Activate a + [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority] + that is in state + [AWAITING_USER_ACTIVATION][google.cloud.security.privateca.v1.CertificateAuthority.State.AWAITING_USER_ACTIVATION] + and is of type + [SUBORDINATE][google.cloud.security.privateca.v1.CertificateAuthority.Type.SUBORDINATE]. + After the parent Certificate Authority signs a certificate + signing request from + [FetchCertificateAuthorityCsr][google.cloud.security.privateca.v1.CertificateAuthorityService.FetchCertificateAuthorityCsr], + this method can complete the activation process. + + Returns: + Callable[[~.ActivateCertificateAuthorityRequest], + ~.Operation]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if 'activate_certificate_authority' not in self._stubs: + self._stubs['activate_certificate_authority'] = self.grpc_channel.unary_unary( + '/google.cloud.security.privateca.v1.CertificateAuthorityService/ActivateCertificateAuthority', + request_serializer=service.ActivateCertificateAuthorityRequest.serialize, + response_deserializer=operations_pb2.Operation.FromString, + ) + return self._stubs['activate_certificate_authority'] + + @property + def create_certificate_authority(self) -> Callable[ + [service.CreateCertificateAuthorityRequest], + operations_pb2.Operation]: + r"""Return a callable for the create certificate authority method over gRPC. + + Create a new + [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority] + in a given Project and Location. + + Returns: + Callable[[~.CreateCertificateAuthorityRequest], + ~.Operation]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if 'create_certificate_authority' not in self._stubs: + 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_pb2.Operation.FromString, + ) + return self._stubs['create_certificate_authority'] + + @property + def disable_certificate_authority(self) -> Callable[ + [service.DisableCertificateAuthorityRequest], + operations_pb2.Operation]: + r"""Return a callable for the disable certificate authority method over gRPC. + + Disable a + [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority]. + + Returns: + Callable[[~.DisableCertificateAuthorityRequest], + ~.Operation]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if 'disable_certificate_authority' not in self._stubs: + self._stubs['disable_certificate_authority'] = self.grpc_channel.unary_unary( + '/google.cloud.security.privateca.v1.CertificateAuthorityService/DisableCertificateAuthority', + request_serializer=service.DisableCertificateAuthorityRequest.serialize, + response_deserializer=operations_pb2.Operation.FromString, + ) + return self._stubs['disable_certificate_authority'] + + @property + def enable_certificate_authority(self) -> Callable[ + [service.EnableCertificateAuthorityRequest], + operations_pb2.Operation]: + r"""Return a callable for the enable certificate authority method over gRPC. + + Enable a + [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority]. + + Returns: + Callable[[~.EnableCertificateAuthorityRequest], + ~.Operation]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if 'enable_certificate_authority' not in self._stubs: + 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_pb2.Operation.FromString, + ) + return self._stubs['enable_certificate_authority'] + + @property + def fetch_certificate_authority_csr(self) -> Callable[ + [service.FetchCertificateAuthorityCsrRequest], + service.FetchCertificateAuthorityCsrResponse]: + r"""Return a callable for the fetch certificate authority + csr method over gRPC. + + Fetch a certificate signing request (CSR) from a + [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority] + that is in state + [AWAITING_USER_ACTIVATION][google.cloud.security.privateca.v1.CertificateAuthority.State.AWAITING_USER_ACTIVATION] + and is of type + [SUBORDINATE][google.cloud.security.privateca.v1.CertificateAuthority.Type.SUBORDINATE]. + The CSR must then be signed by the desired parent Certificate + Authority, which could be another + [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority] + resource, or could be an on-prem certificate authority. See also + [ActivateCertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthorityService.ActivateCertificateAuthority]. + + Returns: + Callable[[~.FetchCertificateAuthorityCsrRequest], + ~.FetchCertificateAuthorityCsrResponse]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if 'fetch_certificate_authority_csr' not in self._stubs: + self._stubs['fetch_certificate_authority_csr'] = self.grpc_channel.unary_unary( + '/google.cloud.security.privateca.v1.CertificateAuthorityService/FetchCertificateAuthorityCsr', + request_serializer=service.FetchCertificateAuthorityCsrRequest.serialize, + response_deserializer=service.FetchCertificateAuthorityCsrResponse.deserialize, + ) + return self._stubs['fetch_certificate_authority_csr'] + + @property + def get_certificate_authority(self) -> Callable[ + [service.GetCertificateAuthorityRequest], + resources.CertificateAuthority]: + r"""Return a callable for the get certificate authority method over gRPC. + + Returns a + [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority]. + + Returns: + Callable[[~.GetCertificateAuthorityRequest], + ~.CertificateAuthority]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if 'get_certificate_authority' not in self._stubs: + self._stubs['get_certificate_authority'] = self.grpc_channel.unary_unary( + '/google.cloud.security.privateca.v1.CertificateAuthorityService/GetCertificateAuthority', + request_serializer=service.GetCertificateAuthorityRequest.serialize, + response_deserializer=resources.CertificateAuthority.deserialize, + ) + return self._stubs['get_certificate_authority'] + + @property + def list_certificate_authorities(self) -> Callable[ + [service.ListCertificateAuthoritiesRequest], + service.ListCertificateAuthoritiesResponse]: + r"""Return a callable for the list certificate authorities method over gRPC. + + Lists + [CertificateAuthorities][google.cloud.security.privateca.v1.CertificateAuthority]. + + Returns: + Callable[[~.ListCertificateAuthoritiesRequest], + ~.ListCertificateAuthoritiesResponse]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if 'list_certificate_authorities' not in self._stubs: + self._stubs['list_certificate_authorities'] = self.grpc_channel.unary_unary( + '/google.cloud.security.privateca.v1.CertificateAuthorityService/ListCertificateAuthorities', + request_serializer=service.ListCertificateAuthoritiesRequest.serialize, + response_deserializer=service.ListCertificateAuthoritiesResponse.deserialize, + ) + return self._stubs['list_certificate_authorities'] + + @property + def undelete_certificate_authority(self) -> Callable[ + [service.UndeleteCertificateAuthorityRequest], + operations_pb2.Operation]: + r"""Return a callable for the undelete certificate authority method over gRPC. + + Undelete a + [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority] + that has been deleted. + + Returns: + Callable[[~.UndeleteCertificateAuthorityRequest], + ~.Operation]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if 'undelete_certificate_authority' not in self._stubs: + self._stubs['undelete_certificate_authority'] = self.grpc_channel.unary_unary( + '/google.cloud.security.privateca.v1.CertificateAuthorityService/UndeleteCertificateAuthority', + request_serializer=service.UndeleteCertificateAuthorityRequest.serialize, + response_deserializer=operations_pb2.Operation.FromString, + ) + return self._stubs['undelete_certificate_authority'] + + @property + def delete_certificate_authority(self) -> Callable[ + [service.DeleteCertificateAuthorityRequest], + operations_pb2.Operation]: + r"""Return a callable for the delete certificate authority method over gRPC. + + Delete a + [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority]. + + Returns: + Callable[[~.DeleteCertificateAuthorityRequest], + ~.Operation]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if 'delete_certificate_authority' not in self._stubs: + 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_pb2.Operation.FromString, + ) + return self._stubs['delete_certificate_authority'] + + @property + def update_certificate_authority(self) -> Callable[ + [service.UpdateCertificateAuthorityRequest], + operations_pb2.Operation]: + r"""Return a callable for the update certificate authority method over gRPC. + + Update a + [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority]. + + Returns: + Callable[[~.UpdateCertificateAuthorityRequest], + ~.Operation]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if 'update_certificate_authority' not in self._stubs: + 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_pb2.Operation.FromString, + ) + return self._stubs['update_certificate_authority'] + + @property + def create_ca_pool(self) -> 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]. + + Returns: + Callable[[~.CreateCaPoolRequest], + ~.Operation]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if 'create_ca_pool' not in self._stubs: + 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_pb2.Operation.FromString, + ) + return self._stubs['create_ca_pool'] + + @property + def update_ca_pool(self) -> 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]. + + Returns: + Callable[[~.UpdateCaPoolRequest], + ~.Operation]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if 'update_ca_pool' not in self._stubs: + 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_pb2.Operation.FromString, + ) + return self._stubs['update_ca_pool'] + + @property + def get_ca_pool(self) -> Callable[ + [service.GetCaPoolRequest], + resources.CaPool]: + r"""Return a callable for the get ca pool method over gRPC. + + Returns a [CaPool][google.cloud.security.privateca.v1.CaPool]. + + Returns: + Callable[[~.GetCaPoolRequest], + ~.CaPool]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if 'get_ca_pool' not in self._stubs: + self._stubs['get_ca_pool'] = self.grpc_channel.unary_unary( + '/google.cloud.security.privateca.v1.CertificateAuthorityService/GetCaPool', + request_serializer=service.GetCaPoolRequest.serialize, + response_deserializer=resources.CaPool.deserialize, + ) + return self._stubs['get_ca_pool'] + + @property + def list_ca_pools(self) -> Callable[ + [service.ListCaPoolsRequest], + service.ListCaPoolsResponse]: + r"""Return a callable for the list ca pools method over gRPC. + + Lists [CaPools][google.cloud.security.privateca.v1.CaPool]. + + Returns: + Callable[[~.ListCaPoolsRequest], + ~.ListCaPoolsResponse]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if 'list_ca_pools' not in self._stubs: + self._stubs['list_ca_pools'] = self.grpc_channel.unary_unary( + '/google.cloud.security.privateca.v1.CertificateAuthorityService/ListCaPools', + request_serializer=service.ListCaPoolsRequest.serialize, + response_deserializer=service.ListCaPoolsResponse.deserialize, + ) + return self._stubs['list_ca_pools'] + + @property + def delete_ca_pool(self) -> 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]. + + Returns: + Callable[[~.DeleteCaPoolRequest], + ~.Operation]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if 'delete_ca_pool' not in self._stubs: + 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_pb2.Operation.FromString, + ) + return self._stubs['delete_ca_pool'] + + @property + def fetch_ca_certs(self) -> Callable[ + [service.FetchCaCertsRequest], + service.FetchCaCertsResponse]: + r"""Return a callable for the fetch ca certs method over gRPC. + + FetchCaCerts returns the current trust anchor for the + [CaPool][google.cloud.security.privateca.v1.CaPool]. This will + include CA certificate chains for all ACTIVE + [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority] + resources in the + [CaPool][google.cloud.security.privateca.v1.CaPool]. + + Returns: + Callable[[~.FetchCaCertsRequest], + ~.FetchCaCertsResponse]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if 'fetch_ca_certs' not in self._stubs: + self._stubs['fetch_ca_certs'] = self.grpc_channel.unary_unary( + '/google.cloud.security.privateca.v1.CertificateAuthorityService/FetchCaCerts', + request_serializer=service.FetchCaCertsRequest.serialize, + response_deserializer=service.FetchCaCertsResponse.deserialize, + ) + return self._stubs['fetch_ca_certs'] + + @property + def get_certificate_revocation_list(self) -> Callable[ + [service.GetCertificateRevocationListRequest], + resources.CertificateRevocationList]: + r"""Return a callable for the get certificate revocation + list method over gRPC. + + Returns a + [CertificateRevocationList][google.cloud.security.privateca.v1.CertificateRevocationList]. + + Returns: + Callable[[~.GetCertificateRevocationListRequest], + ~.CertificateRevocationList]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if 'get_certificate_revocation_list' not in self._stubs: + self._stubs['get_certificate_revocation_list'] = self.grpc_channel.unary_unary( + '/google.cloud.security.privateca.v1.CertificateAuthorityService/GetCertificateRevocationList', + request_serializer=service.GetCertificateRevocationListRequest.serialize, + response_deserializer=resources.CertificateRevocationList.deserialize, + ) + return self._stubs['get_certificate_revocation_list'] + + @property + def list_certificate_revocation_lists(self) -> Callable[ + [service.ListCertificateRevocationListsRequest], + service.ListCertificateRevocationListsResponse]: + r"""Return a callable for the list certificate revocation + lists method over gRPC. + + Lists + [CertificateRevocationLists][google.cloud.security.privateca.v1.CertificateRevocationList]. + + Returns: + Callable[[~.ListCertificateRevocationListsRequest], + ~.ListCertificateRevocationListsResponse]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if 'list_certificate_revocation_lists' not in self._stubs: + self._stubs['list_certificate_revocation_lists'] = self.grpc_channel.unary_unary( + '/google.cloud.security.privateca.v1.CertificateAuthorityService/ListCertificateRevocationLists', + request_serializer=service.ListCertificateRevocationListsRequest.serialize, + response_deserializer=service.ListCertificateRevocationListsResponse.deserialize, + ) + return self._stubs['list_certificate_revocation_lists'] + + @property + def update_certificate_revocation_list(self) -> Callable[ + [service.UpdateCertificateRevocationListRequest], + operations_pb2.Operation]: + r"""Return a callable for the update certificate revocation + list method over gRPC. + + Update a + [CertificateRevocationList][google.cloud.security.privateca.v1.CertificateRevocationList]. + + Returns: + Callable[[~.UpdateCertificateRevocationListRequest], + ~.Operation]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if 'update_certificate_revocation_list' not in self._stubs: + self._stubs['update_certificate_revocation_list'] = self.grpc_channel.unary_unary( + '/google.cloud.security.privateca.v1.CertificateAuthorityService/UpdateCertificateRevocationList', + request_serializer=service.UpdateCertificateRevocationListRequest.serialize, + response_deserializer=operations_pb2.Operation.FromString, + ) + return self._stubs['update_certificate_revocation_list'] + + @property + def create_certificate_template(self) -> Callable[ + [service.CreateCertificateTemplateRequest], + operations_pb2.Operation]: + r"""Return a callable for the create certificate template method over gRPC. + + Create a new + [CertificateTemplate][google.cloud.security.privateca.v1.CertificateTemplate] + in a given Project and Location. + + Returns: + Callable[[~.CreateCertificateTemplateRequest], + ~.Operation]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if 'create_certificate_template' not in self._stubs: + 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_pb2.Operation.FromString, + ) + return self._stubs['create_certificate_template'] + + @property + def delete_certificate_template(self) -> Callable[ + [service.DeleteCertificateTemplateRequest], + operations_pb2.Operation]: + r"""Return a callable for the delete certificate template method over gRPC. + + DeleteCertificateTemplate deletes a + [CertificateTemplate][google.cloud.security.privateca.v1.CertificateTemplate]. + + Returns: + Callable[[~.DeleteCertificateTemplateRequest], + ~.Operation]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if 'delete_certificate_template' not in self._stubs: + 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_pb2.Operation.FromString, + ) + return self._stubs['delete_certificate_template'] + + @property + def get_certificate_template(self) -> Callable[ + [service.GetCertificateTemplateRequest], + resources.CertificateTemplate]: + r"""Return a callable for the get certificate template method over gRPC. + + Returns a + [CertificateTemplate][google.cloud.security.privateca.v1.CertificateTemplate]. + + Returns: + Callable[[~.GetCertificateTemplateRequest], + ~.CertificateTemplate]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if 'get_certificate_template' not in self._stubs: + self._stubs['get_certificate_template'] = self.grpc_channel.unary_unary( + '/google.cloud.security.privateca.v1.CertificateAuthorityService/GetCertificateTemplate', + request_serializer=service.GetCertificateTemplateRequest.serialize, + response_deserializer=resources.CertificateTemplate.deserialize, + ) + return self._stubs['get_certificate_template'] + + @property + def list_certificate_templates(self) -> Callable[ + [service.ListCertificateTemplatesRequest], + service.ListCertificateTemplatesResponse]: + r"""Return a callable for the list certificate templates method over gRPC. + + Lists + [CertificateTemplates][google.cloud.security.privateca.v1.CertificateTemplate]. + + Returns: + Callable[[~.ListCertificateTemplatesRequest], + ~.ListCertificateTemplatesResponse]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if 'list_certificate_templates' not in self._stubs: + self._stubs['list_certificate_templates'] = self.grpc_channel.unary_unary( + '/google.cloud.security.privateca.v1.CertificateAuthorityService/ListCertificateTemplates', + request_serializer=service.ListCertificateTemplatesRequest.serialize, + response_deserializer=service.ListCertificateTemplatesResponse.deserialize, + ) + return self._stubs['list_certificate_templates'] + + @property + def update_certificate_template(self) -> Callable[ + [service.UpdateCertificateTemplateRequest], + operations_pb2.Operation]: + r"""Return a callable for the update certificate template method over gRPC. + + Update a + [CertificateTemplate][google.cloud.security.privateca.v1.CertificateTemplate]. + + Returns: + Callable[[~.UpdateCertificateTemplateRequest], + ~.Operation]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if 'update_certificate_template' not in self._stubs: + 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_pb2.Operation.FromString, + ) + return self._stubs['update_certificate_template'] + + def close(self): + self.grpc_channel.close() + + @property + def kind(self) -> str: + return "grpc" + + +__all__ = ( + 'CertificateAuthorityServiceGrpcTransport', +) diff --git a/owl-bot-staging/v1/google/cloud/security/privateca_v1/services/certificate_authority_service/transports/grpc_asyncio.py b/owl-bot-staging/v1/google/cloud/security/privateca_v1/services/certificate_authority_service/transports/grpc_asyncio.py new file mode 100644 index 0000000..b6ef220 --- /dev/null +++ b/owl-bot-staging/v1/google/cloud/security/privateca_v1/services/certificate_authority_service/transports/grpc_asyncio.py @@ -0,0 +1,1070 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +import warnings +from typing import Awaitable, Callable, Dict, Optional, Sequence, Tuple, Union + +from google.api_core import gapic_v1 +from google.api_core import grpc_helpers_async +from google.api_core import operations_v1 +from google.auth import credentials as ga_credentials # type: ignore +from google.auth.transport.grpc import SslCredentials # type: ignore + +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 # type: ignore +from .base import CertificateAuthorityServiceTransport, DEFAULT_CLIENT_INFO +from .grpc import CertificateAuthorityServiceGrpcTransport + + +class CertificateAuthorityServiceGrpcAsyncIOTransport(CertificateAuthorityServiceTransport): + """gRPC AsyncIO backend transport for CertificateAuthorityService. + + [Certificate Authority + Service][google.cloud.security.privateca.v1.CertificateAuthorityService] + manages private certificate authorities and issued certificates. + + This class defines the same methods as the primary client, so the + primary client can load the underlying transport implementation + and call it. + + It sends protocol buffers over the wire using gRPC (which is built on + top of HTTP/2); the ``grpcio`` package must be installed. + """ + + _grpc_channel: aio.Channel + _stubs: Dict[str, Callable] = {} + + @classmethod + def create_channel(cls, + host: str = 'privateca.googleapis.com', + credentials: Optional[ga_credentials.Credentials] = None, + credentials_file: Optional[str] = None, + scopes: Optional[Sequence[str]] = None, + quota_project_id: Optional[str] = None, + **kwargs) -> aio.Channel: + """Create and return a gRPC AsyncIO channel object. + Args: + host (Optional[str]): The host for the channel to use. + credentials (Optional[~.Credentials]): The + authorization credentials to attach to requests. These + credentials identify this application to the service. If + none are specified, the client will attempt to ascertain + the credentials from the environment. + credentials_file (Optional[str]): A file with credentials that can + be loaded with :func:`google.auth.load_credentials_from_file`. + This argument is ignored if ``channel`` is provided. + scopes (Optional[Sequence[str]]): A optional list of scopes needed for this + service. These are only used when credentials are not specified and + are passed to :func:`google.auth.default`. + quota_project_id (Optional[str]): An optional project to use for billing + and quota. + kwargs (Optional[dict]): Keyword arguments, which are passed to the + channel creation. + Returns: + aio.Channel: A gRPC AsyncIO channel object. + """ + + return grpc_helpers_async.create_channel( + host, + credentials=credentials, + credentials_file=credentials_file, + quota_project_id=quota_project_id, + default_scopes=cls.AUTH_SCOPES, + scopes=scopes, + default_host=cls.DEFAULT_HOST, + **kwargs + ) + + def __init__(self, *, + host: str = 'privateca.googleapis.com', + credentials: Optional[ga_credentials.Credentials] = None, + credentials_file: Optional[str] = None, + scopes: Optional[Sequence[str]] = None, + channel: Optional[aio.Channel] = None, + api_mtls_endpoint: Optional[str] = None, + client_cert_source: Optional[Callable[[], Tuple[bytes, bytes]]] = None, + ssl_channel_credentials: Optional[grpc.ChannelCredentials] = None, + client_cert_source_for_mtls: Optional[Callable[[], Tuple[bytes, bytes]]] = None, + quota_project_id: Optional[str] = None, + client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, + always_use_jwt_access: Optional[bool] = False, + api_audience: Optional[str] = None, + ) -> None: + """Instantiate the transport. + + Args: + 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 + are specified, the client will attempt to ascertain the + credentials from the environment. + This argument is ignored if ``channel`` is provided. + credentials_file (Optional[str]): A file with credentials that can + be loaded with :func:`google.auth.load_credentials_from_file`. + This argument is ignored if ``channel`` is provided. + scopes (Optional[Sequence[str]]): A optional list of scopes needed for this + service. These are only used when credentials are not specified and + are passed to :func:`google.auth.default`. + channel (Optional[aio.Channel]): A ``Channel`` instance through + which to make calls. + api_mtls_endpoint (Optional[str]): Deprecated. The mutual TLS endpoint. + If provided, it overrides the ``host`` argument and tries to create + a mutual TLS channel with client SSL credentials from + ``client_cert_source`` or application default SSL credentials. + client_cert_source (Optional[Callable[[], Tuple[bytes, bytes]]]): + Deprecated. A callback to provide client SSL certificate bytes and + private key bytes, both in PEM format. It is ignored if + ``api_mtls_endpoint`` is None. + ssl_channel_credentials (grpc.ChannelCredentials): SSL credentials + for the grpc channel. It is ignored if ``channel`` is provided. + client_cert_source_for_mtls (Optional[Callable[[], Tuple[bytes, bytes]]]): + A callback to provide client certificate bytes and private key bytes, + both in PEM format. It is used to configure a mutual TLS channel. It is + ignored if ``channel`` or ``ssl_channel_credentials`` is provided. + quota_project_id (Optional[str]): An optional project to use for billing + and quota. + client_info (google.api_core.gapic_v1.client_info.ClientInfo): + The client info used to send a user-agent string along with + API requests. If ``None``, then default info will be used. + Generally, you only need to set this if you're developing + your own client library. + always_use_jwt_access (Optional[bool]): Whether self signed JWT should + be used for service account credentials. + + Raises: + google.auth.exceptions.MutualTlsChannelError: If mutual TLS transport + creation failed for any reason. + google.api_core.exceptions.DuplicateCredentialArgs: If both ``credentials`` + and ``credentials_file`` are passed. + """ + self._grpc_channel = None + self._ssl_channel_credentials = ssl_channel_credentials + self._stubs: Dict[str, Callable] = {} + self._operations_client: Optional[operations_v1.OperationsAsyncClient] = None + + if api_mtls_endpoint: + warnings.warn("api_mtls_endpoint is deprecated", DeprecationWarning) + if client_cert_source: + warnings.warn("client_cert_source is deprecated", DeprecationWarning) + + if channel: + # Ignore credentials if a channel was passed. + credentials = False + # 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 + + # Create SSL credentials with client_cert_source or application + # default SSL credentials. + if client_cert_source: + cert, key = client_cert_source() + self._ssl_channel_credentials = grpc.ssl_channel_credentials( + certificate_chain=cert, private_key=key + ) + else: + self._ssl_channel_credentials = SslCredentials().ssl_credentials + + else: + if client_cert_source_for_mtls and not ssl_channel_credentials: + cert, key = client_cert_source_for_mtls() + self._ssl_channel_credentials = grpc.ssl_channel_credentials( + certificate_chain=cert, private_key=key + ) + + # The base transport sets the host, credentials and scopes + super().__init__( + host=host, + credentials=credentials, + credentials_file=credentials_file, + scopes=scopes, + quota_project_id=quota_project_id, + client_info=client_info, + always_use_jwt_access=always_use_jwt_access, + api_audience=api_audience, + ) + + if not self._grpc_channel: + self._grpc_channel = type(self).create_channel( + self._host, + # use the credentials which are saved + credentials=self._credentials, + # Set ``credentials_file`` to ``None`` here as + # the credentials that we saved earlier should be used. + credentials_file=None, + scopes=self._scopes, + ssl_credentials=self._ssl_channel_credentials, + quota_project_id=quota_project_id, + options=[ + ("grpc.max_send_message_length", -1), + ("grpc.max_receive_message_length", -1), + ], + ) + + # Wrap messages. This must be done after self._grpc_channel exists + self._prep_wrapped_messages(client_info) + + @property + def grpc_channel(self) -> aio.Channel: + """Create the channel designed to connect to this service. + + This property caches on the instance; repeated calls return + the same channel. + """ + # Return the channel from cache. + return self._grpc_channel + + @property + def operations_client(self) -> operations_v1.OperationsAsyncClient: + """Create the client designed to process long-running operations. + + This property caches on the instance; repeated calls return the same + client. + """ + # Quick check: Only create a new client if we do not already have one. + if self._operations_client is None: + self._operations_client = operations_v1.OperationsAsyncClient( + self.grpc_channel + ) + + # Return the client from cache. + return self._operations_client + + @property + def create_certificate(self) -> Callable[ + [service.CreateCertificateRequest], + Awaitable[resources.Certificate]]: + r"""Return a callable for the create certificate method over gRPC. + + Create a new + [Certificate][google.cloud.security.privateca.v1.Certificate] in + a given Project, Location from a particular + [CaPool][google.cloud.security.privateca.v1.CaPool]. + + Returns: + Callable[[~.CreateCertificateRequest], + Awaitable[~.Certificate]]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if 'create_certificate' not in self._stubs: + self._stubs['create_certificate'] = self.grpc_channel.unary_unary( + '/google.cloud.security.privateca.v1.CertificateAuthorityService/CreateCertificate', + request_serializer=service.CreateCertificateRequest.serialize, + response_deserializer=resources.Certificate.deserialize, + ) + return self._stubs['create_certificate'] + + @property + def get_certificate(self) -> Callable[ + [service.GetCertificateRequest], + Awaitable[resources.Certificate]]: + r"""Return a callable for the get certificate method over gRPC. + + Returns a + [Certificate][google.cloud.security.privateca.v1.Certificate]. + + Returns: + Callable[[~.GetCertificateRequest], + Awaitable[~.Certificate]]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if 'get_certificate' not in self._stubs: + self._stubs['get_certificate'] = self.grpc_channel.unary_unary( + '/google.cloud.security.privateca.v1.CertificateAuthorityService/GetCertificate', + request_serializer=service.GetCertificateRequest.serialize, + response_deserializer=resources.Certificate.deserialize, + ) + return self._stubs['get_certificate'] + + @property + def list_certificates(self) -> Callable[ + [service.ListCertificatesRequest], + Awaitable[service.ListCertificatesResponse]]: + r"""Return a callable for the list certificates method over gRPC. + + Lists + [Certificates][google.cloud.security.privateca.v1.Certificate]. + + Returns: + Callable[[~.ListCertificatesRequest], + Awaitable[~.ListCertificatesResponse]]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if 'list_certificates' not in self._stubs: + self._stubs['list_certificates'] = self.grpc_channel.unary_unary( + '/google.cloud.security.privateca.v1.CertificateAuthorityService/ListCertificates', + request_serializer=service.ListCertificatesRequest.serialize, + response_deserializer=service.ListCertificatesResponse.deserialize, + ) + return self._stubs['list_certificates'] + + @property + def revoke_certificate(self) -> Callable[ + [service.RevokeCertificateRequest], + Awaitable[resources.Certificate]]: + r"""Return a callable for the revoke certificate method over gRPC. + + Revoke a + [Certificate][google.cloud.security.privateca.v1.Certificate]. + + Returns: + Callable[[~.RevokeCertificateRequest], + Awaitable[~.Certificate]]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if 'revoke_certificate' not in self._stubs: + self._stubs['revoke_certificate'] = self.grpc_channel.unary_unary( + '/google.cloud.security.privateca.v1.CertificateAuthorityService/RevokeCertificate', + request_serializer=service.RevokeCertificateRequest.serialize, + response_deserializer=resources.Certificate.deserialize, + ) + return self._stubs['revoke_certificate'] + + @property + def update_certificate(self) -> Callable[ + [service.UpdateCertificateRequest], + Awaitable[resources.Certificate]]: + r"""Return a callable for the update certificate method over gRPC. + + Update a + [Certificate][google.cloud.security.privateca.v1.Certificate]. + Currently, the only field you can update is the + [labels][google.cloud.security.privateca.v1.Certificate.labels] + field. + + Returns: + Callable[[~.UpdateCertificateRequest], + Awaitable[~.Certificate]]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if 'update_certificate' not in self._stubs: + self._stubs['update_certificate'] = self.grpc_channel.unary_unary( + '/google.cloud.security.privateca.v1.CertificateAuthorityService/UpdateCertificate', + request_serializer=service.UpdateCertificateRequest.serialize, + response_deserializer=resources.Certificate.deserialize, + ) + return self._stubs['update_certificate'] + + @property + def activate_certificate_authority(self) -> Callable[ + [service.ActivateCertificateAuthorityRequest], + Awaitable[operations_pb2.Operation]]: + r"""Return a callable for the activate certificate authority method over gRPC. + + Activate a + [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority] + that is in state + [AWAITING_USER_ACTIVATION][google.cloud.security.privateca.v1.CertificateAuthority.State.AWAITING_USER_ACTIVATION] + and is of type + [SUBORDINATE][google.cloud.security.privateca.v1.CertificateAuthority.Type.SUBORDINATE]. + After the parent Certificate Authority signs a certificate + signing request from + [FetchCertificateAuthorityCsr][google.cloud.security.privateca.v1.CertificateAuthorityService.FetchCertificateAuthorityCsr], + this method can complete the activation process. + + Returns: + Callable[[~.ActivateCertificateAuthorityRequest], + Awaitable[~.Operation]]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if 'activate_certificate_authority' not in self._stubs: + self._stubs['activate_certificate_authority'] = self.grpc_channel.unary_unary( + '/google.cloud.security.privateca.v1.CertificateAuthorityService/ActivateCertificateAuthority', + request_serializer=service.ActivateCertificateAuthorityRequest.serialize, + response_deserializer=operations_pb2.Operation.FromString, + ) + return self._stubs['activate_certificate_authority'] + + @property + def create_certificate_authority(self) -> Callable[ + [service.CreateCertificateAuthorityRequest], + Awaitable[operations_pb2.Operation]]: + r"""Return a callable for the create certificate authority method over gRPC. + + Create a new + [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority] + in a given Project and Location. + + Returns: + Callable[[~.CreateCertificateAuthorityRequest], + Awaitable[~.Operation]]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if 'create_certificate_authority' not in self._stubs: + 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_pb2.Operation.FromString, + ) + return self._stubs['create_certificate_authority'] + + @property + def disable_certificate_authority(self) -> Callable[ + [service.DisableCertificateAuthorityRequest], + Awaitable[operations_pb2.Operation]]: + r"""Return a callable for the disable certificate authority method over gRPC. + + Disable a + [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority]. + + Returns: + Callable[[~.DisableCertificateAuthorityRequest], + Awaitable[~.Operation]]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if 'disable_certificate_authority' not in self._stubs: + self._stubs['disable_certificate_authority'] = self.grpc_channel.unary_unary( + '/google.cloud.security.privateca.v1.CertificateAuthorityService/DisableCertificateAuthority', + request_serializer=service.DisableCertificateAuthorityRequest.serialize, + response_deserializer=operations_pb2.Operation.FromString, + ) + return self._stubs['disable_certificate_authority'] + + @property + def enable_certificate_authority(self) -> Callable[ + [service.EnableCertificateAuthorityRequest], + Awaitable[operations_pb2.Operation]]: + r"""Return a callable for the enable certificate authority method over gRPC. + + Enable a + [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority]. + + Returns: + Callable[[~.EnableCertificateAuthorityRequest], + Awaitable[~.Operation]]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if 'enable_certificate_authority' not in self._stubs: + 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_pb2.Operation.FromString, + ) + return self._stubs['enable_certificate_authority'] + + @property + def fetch_certificate_authority_csr(self) -> Callable[ + [service.FetchCertificateAuthorityCsrRequest], + Awaitable[service.FetchCertificateAuthorityCsrResponse]]: + r"""Return a callable for the fetch certificate authority + csr method over gRPC. + + Fetch a certificate signing request (CSR) from a + [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority] + that is in state + [AWAITING_USER_ACTIVATION][google.cloud.security.privateca.v1.CertificateAuthority.State.AWAITING_USER_ACTIVATION] + and is of type + [SUBORDINATE][google.cloud.security.privateca.v1.CertificateAuthority.Type.SUBORDINATE]. + The CSR must then be signed by the desired parent Certificate + Authority, which could be another + [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority] + resource, or could be an on-prem certificate authority. See also + [ActivateCertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthorityService.ActivateCertificateAuthority]. + + Returns: + Callable[[~.FetchCertificateAuthorityCsrRequest], + Awaitable[~.FetchCertificateAuthorityCsrResponse]]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if 'fetch_certificate_authority_csr' not in self._stubs: + self._stubs['fetch_certificate_authority_csr'] = self.grpc_channel.unary_unary( + '/google.cloud.security.privateca.v1.CertificateAuthorityService/FetchCertificateAuthorityCsr', + request_serializer=service.FetchCertificateAuthorityCsrRequest.serialize, + response_deserializer=service.FetchCertificateAuthorityCsrResponse.deserialize, + ) + return self._stubs['fetch_certificate_authority_csr'] + + @property + def get_certificate_authority(self) -> Callable[ + [service.GetCertificateAuthorityRequest], + Awaitable[resources.CertificateAuthority]]: + r"""Return a callable for the get certificate authority method over gRPC. + + Returns a + [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority]. + + Returns: + Callable[[~.GetCertificateAuthorityRequest], + Awaitable[~.CertificateAuthority]]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if 'get_certificate_authority' not in self._stubs: + self._stubs['get_certificate_authority'] = self.grpc_channel.unary_unary( + '/google.cloud.security.privateca.v1.CertificateAuthorityService/GetCertificateAuthority', + request_serializer=service.GetCertificateAuthorityRequest.serialize, + response_deserializer=resources.CertificateAuthority.deserialize, + ) + return self._stubs['get_certificate_authority'] + + @property + def list_certificate_authorities(self) -> Callable[ + [service.ListCertificateAuthoritiesRequest], + Awaitable[service.ListCertificateAuthoritiesResponse]]: + r"""Return a callable for the list certificate authorities method over gRPC. + + Lists + [CertificateAuthorities][google.cloud.security.privateca.v1.CertificateAuthority]. + + Returns: + Callable[[~.ListCertificateAuthoritiesRequest], + Awaitable[~.ListCertificateAuthoritiesResponse]]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if 'list_certificate_authorities' not in self._stubs: + self._stubs['list_certificate_authorities'] = self.grpc_channel.unary_unary( + '/google.cloud.security.privateca.v1.CertificateAuthorityService/ListCertificateAuthorities', + request_serializer=service.ListCertificateAuthoritiesRequest.serialize, + response_deserializer=service.ListCertificateAuthoritiesResponse.deserialize, + ) + return self._stubs['list_certificate_authorities'] + + @property + def undelete_certificate_authority(self) -> Callable[ + [service.UndeleteCertificateAuthorityRequest], + Awaitable[operations_pb2.Operation]]: + r"""Return a callable for the undelete certificate authority method over gRPC. + + Undelete a + [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority] + that has been deleted. + + Returns: + Callable[[~.UndeleteCertificateAuthorityRequest], + Awaitable[~.Operation]]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if 'undelete_certificate_authority' not in self._stubs: + self._stubs['undelete_certificate_authority'] = self.grpc_channel.unary_unary( + '/google.cloud.security.privateca.v1.CertificateAuthorityService/UndeleteCertificateAuthority', + request_serializer=service.UndeleteCertificateAuthorityRequest.serialize, + response_deserializer=operations_pb2.Operation.FromString, + ) + return self._stubs['undelete_certificate_authority'] + + @property + def delete_certificate_authority(self) -> Callable[ + [service.DeleteCertificateAuthorityRequest], + Awaitable[operations_pb2.Operation]]: + r"""Return a callable for the delete certificate authority method over gRPC. + + Delete a + [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority]. + + Returns: + Callable[[~.DeleteCertificateAuthorityRequest], + Awaitable[~.Operation]]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if 'delete_certificate_authority' not in self._stubs: + 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_pb2.Operation.FromString, + ) + return self._stubs['delete_certificate_authority'] + + @property + def update_certificate_authority(self) -> Callable[ + [service.UpdateCertificateAuthorityRequest], + Awaitable[operations_pb2.Operation]]: + r"""Return a callable for the update certificate authority method over gRPC. + + Update a + [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority]. + + Returns: + Callable[[~.UpdateCertificateAuthorityRequest], + Awaitable[~.Operation]]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if 'update_certificate_authority' not in self._stubs: + 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_pb2.Operation.FromString, + ) + return self._stubs['update_certificate_authority'] + + @property + def create_ca_pool(self) -> 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]. + + Returns: + Callable[[~.CreateCaPoolRequest], + Awaitable[~.Operation]]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if 'create_ca_pool' not in self._stubs: + 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_pb2.Operation.FromString, + ) + return self._stubs['create_ca_pool'] + + @property + def update_ca_pool(self) -> 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]. + + Returns: + Callable[[~.UpdateCaPoolRequest], + Awaitable[~.Operation]]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if 'update_ca_pool' not in self._stubs: + 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_pb2.Operation.FromString, + ) + return self._stubs['update_ca_pool'] + + @property + def get_ca_pool(self) -> Callable[ + [service.GetCaPoolRequest], + Awaitable[resources.CaPool]]: + r"""Return a callable for the get ca pool method over gRPC. + + Returns a [CaPool][google.cloud.security.privateca.v1.CaPool]. + + Returns: + Callable[[~.GetCaPoolRequest], + Awaitable[~.CaPool]]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if 'get_ca_pool' not in self._stubs: + self._stubs['get_ca_pool'] = self.grpc_channel.unary_unary( + '/google.cloud.security.privateca.v1.CertificateAuthorityService/GetCaPool', + request_serializer=service.GetCaPoolRequest.serialize, + response_deserializer=resources.CaPool.deserialize, + ) + return self._stubs['get_ca_pool'] + + @property + def list_ca_pools(self) -> Callable[ + [service.ListCaPoolsRequest], + Awaitable[service.ListCaPoolsResponse]]: + r"""Return a callable for the list ca pools method over gRPC. + + Lists [CaPools][google.cloud.security.privateca.v1.CaPool]. + + Returns: + Callable[[~.ListCaPoolsRequest], + Awaitable[~.ListCaPoolsResponse]]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if 'list_ca_pools' not in self._stubs: + self._stubs['list_ca_pools'] = self.grpc_channel.unary_unary( + '/google.cloud.security.privateca.v1.CertificateAuthorityService/ListCaPools', + request_serializer=service.ListCaPoolsRequest.serialize, + response_deserializer=service.ListCaPoolsResponse.deserialize, + ) + return self._stubs['list_ca_pools'] + + @property + def delete_ca_pool(self) -> 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]. + + Returns: + Callable[[~.DeleteCaPoolRequest], + Awaitable[~.Operation]]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if 'delete_ca_pool' not in self._stubs: + 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_pb2.Operation.FromString, + ) + return self._stubs['delete_ca_pool'] + + @property + def fetch_ca_certs(self) -> Callable[ + [service.FetchCaCertsRequest], + Awaitable[service.FetchCaCertsResponse]]: + r"""Return a callable for the fetch ca certs method over gRPC. + + FetchCaCerts returns the current trust anchor for the + [CaPool][google.cloud.security.privateca.v1.CaPool]. This will + include CA certificate chains for all ACTIVE + [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority] + resources in the + [CaPool][google.cloud.security.privateca.v1.CaPool]. + + Returns: + Callable[[~.FetchCaCertsRequest], + Awaitable[~.FetchCaCertsResponse]]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if 'fetch_ca_certs' not in self._stubs: + self._stubs['fetch_ca_certs'] = self.grpc_channel.unary_unary( + '/google.cloud.security.privateca.v1.CertificateAuthorityService/FetchCaCerts', + request_serializer=service.FetchCaCertsRequest.serialize, + response_deserializer=service.FetchCaCertsResponse.deserialize, + ) + return self._stubs['fetch_ca_certs'] + + @property + def get_certificate_revocation_list(self) -> Callable[ + [service.GetCertificateRevocationListRequest], + Awaitable[resources.CertificateRevocationList]]: + r"""Return a callable for the get certificate revocation + list method over gRPC. + + Returns a + [CertificateRevocationList][google.cloud.security.privateca.v1.CertificateRevocationList]. + + Returns: + Callable[[~.GetCertificateRevocationListRequest], + Awaitable[~.CertificateRevocationList]]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if 'get_certificate_revocation_list' not in self._stubs: + self._stubs['get_certificate_revocation_list'] = self.grpc_channel.unary_unary( + '/google.cloud.security.privateca.v1.CertificateAuthorityService/GetCertificateRevocationList', + request_serializer=service.GetCertificateRevocationListRequest.serialize, + response_deserializer=resources.CertificateRevocationList.deserialize, + ) + return self._stubs['get_certificate_revocation_list'] + + @property + def list_certificate_revocation_lists(self) -> Callable[ + [service.ListCertificateRevocationListsRequest], + Awaitable[service.ListCertificateRevocationListsResponse]]: + r"""Return a callable for the list certificate revocation + lists method over gRPC. + + Lists + [CertificateRevocationLists][google.cloud.security.privateca.v1.CertificateRevocationList]. + + Returns: + Callable[[~.ListCertificateRevocationListsRequest], + Awaitable[~.ListCertificateRevocationListsResponse]]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if 'list_certificate_revocation_lists' not in self._stubs: + self._stubs['list_certificate_revocation_lists'] = self.grpc_channel.unary_unary( + '/google.cloud.security.privateca.v1.CertificateAuthorityService/ListCertificateRevocationLists', + request_serializer=service.ListCertificateRevocationListsRequest.serialize, + response_deserializer=service.ListCertificateRevocationListsResponse.deserialize, + ) + return self._stubs['list_certificate_revocation_lists'] + + @property + def update_certificate_revocation_list(self) -> Callable[ + [service.UpdateCertificateRevocationListRequest], + Awaitable[operations_pb2.Operation]]: + r"""Return a callable for the update certificate revocation + list method over gRPC. + + Update a + [CertificateRevocationList][google.cloud.security.privateca.v1.CertificateRevocationList]. + + Returns: + Callable[[~.UpdateCertificateRevocationListRequest], + Awaitable[~.Operation]]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if 'update_certificate_revocation_list' not in self._stubs: + self._stubs['update_certificate_revocation_list'] = self.grpc_channel.unary_unary( + '/google.cloud.security.privateca.v1.CertificateAuthorityService/UpdateCertificateRevocationList', + request_serializer=service.UpdateCertificateRevocationListRequest.serialize, + response_deserializer=operations_pb2.Operation.FromString, + ) + return self._stubs['update_certificate_revocation_list'] + + @property + def create_certificate_template(self) -> Callable[ + [service.CreateCertificateTemplateRequest], + Awaitable[operations_pb2.Operation]]: + r"""Return a callable for the create certificate template method over gRPC. + + Create a new + [CertificateTemplate][google.cloud.security.privateca.v1.CertificateTemplate] + in a given Project and Location. + + Returns: + Callable[[~.CreateCertificateTemplateRequest], + Awaitable[~.Operation]]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if 'create_certificate_template' not in self._stubs: + 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_pb2.Operation.FromString, + ) + return self._stubs['create_certificate_template'] + + @property + def delete_certificate_template(self) -> Callable[ + [service.DeleteCertificateTemplateRequest], + Awaitable[operations_pb2.Operation]]: + r"""Return a callable for the delete certificate template method over gRPC. + + DeleteCertificateTemplate deletes a + [CertificateTemplate][google.cloud.security.privateca.v1.CertificateTemplate]. + + Returns: + Callable[[~.DeleteCertificateTemplateRequest], + Awaitable[~.Operation]]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if 'delete_certificate_template' not in self._stubs: + 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_pb2.Operation.FromString, + ) + return self._stubs['delete_certificate_template'] + + @property + def get_certificate_template(self) -> Callable[ + [service.GetCertificateTemplateRequest], + Awaitable[resources.CertificateTemplate]]: + r"""Return a callable for the get certificate template method over gRPC. + + Returns a + [CertificateTemplate][google.cloud.security.privateca.v1.CertificateTemplate]. + + Returns: + Callable[[~.GetCertificateTemplateRequest], + Awaitable[~.CertificateTemplate]]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if 'get_certificate_template' not in self._stubs: + self._stubs['get_certificate_template'] = self.grpc_channel.unary_unary( + '/google.cloud.security.privateca.v1.CertificateAuthorityService/GetCertificateTemplate', + request_serializer=service.GetCertificateTemplateRequest.serialize, + response_deserializer=resources.CertificateTemplate.deserialize, + ) + return self._stubs['get_certificate_template'] + + @property + def list_certificate_templates(self) -> Callable[ + [service.ListCertificateTemplatesRequest], + Awaitable[service.ListCertificateTemplatesResponse]]: + r"""Return a callable for the list certificate templates method over gRPC. + + Lists + [CertificateTemplates][google.cloud.security.privateca.v1.CertificateTemplate]. + + Returns: + Callable[[~.ListCertificateTemplatesRequest], + Awaitable[~.ListCertificateTemplatesResponse]]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if 'list_certificate_templates' not in self._stubs: + self._stubs['list_certificate_templates'] = self.grpc_channel.unary_unary( + '/google.cloud.security.privateca.v1.CertificateAuthorityService/ListCertificateTemplates', + request_serializer=service.ListCertificateTemplatesRequest.serialize, + response_deserializer=service.ListCertificateTemplatesResponse.deserialize, + ) + return self._stubs['list_certificate_templates'] + + @property + def update_certificate_template(self) -> Callable[ + [service.UpdateCertificateTemplateRequest], + Awaitable[operations_pb2.Operation]]: + r"""Return a callable for the update certificate template method over gRPC. + + Update a + [CertificateTemplate][google.cloud.security.privateca.v1.CertificateTemplate]. + + Returns: + Callable[[~.UpdateCertificateTemplateRequest], + Awaitable[~.Operation]]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if 'update_certificate_template' not in self._stubs: + 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_pb2.Operation.FromString, + ) + return self._stubs['update_certificate_template'] + + def close(self): + return self.grpc_channel.close() + + +__all__ = ( + 'CertificateAuthorityServiceGrpcAsyncIOTransport', +) diff --git a/owl-bot-staging/v1/google/cloud/security/privateca_v1/types/__init__.py b/owl-bot-staging/v1/google/cloud/security/privateca_v1/types/__init__.py new file mode 100644 index 0000000..de38a94 --- /dev/null +++ b/owl-bot-staging/v1/google/cloud/security/privateca_v1/types/__init__.py @@ -0,0 +1,134 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +from .resources import ( + CaPool, + Certificate, + CertificateAuthority, + CertificateConfig, + CertificateDescription, + CertificateExtensionConstraints, + CertificateIdentityConstraints, + CertificateRevocationList, + CertificateTemplate, + KeyUsage, + ObjectId, + PublicKey, + Subject, + SubjectAltNames, + SubordinateConfig, + X509Extension, + X509Parameters, + RevocationReason, + SubjectRequestMode, +) +from .service import ( + ActivateCertificateAuthorityRequest, + CreateCaPoolRequest, + CreateCertificateAuthorityRequest, + CreateCertificateRequest, + CreateCertificateTemplateRequest, + DeleteCaPoolRequest, + DeleteCertificateAuthorityRequest, + DeleteCertificateTemplateRequest, + DisableCertificateAuthorityRequest, + EnableCertificateAuthorityRequest, + FetchCaCertsRequest, + FetchCaCertsResponse, + FetchCertificateAuthorityCsrRequest, + FetchCertificateAuthorityCsrResponse, + GetCaPoolRequest, + GetCertificateAuthorityRequest, + GetCertificateRequest, + GetCertificateRevocationListRequest, + GetCertificateTemplateRequest, + ListCaPoolsRequest, + ListCaPoolsResponse, + ListCertificateAuthoritiesRequest, + ListCertificateAuthoritiesResponse, + ListCertificateRevocationListsRequest, + ListCertificateRevocationListsResponse, + ListCertificatesRequest, + ListCertificatesResponse, + ListCertificateTemplatesRequest, + ListCertificateTemplatesResponse, + OperationMetadata, + RevokeCertificateRequest, + UndeleteCertificateAuthorityRequest, + UpdateCaPoolRequest, + UpdateCertificateAuthorityRequest, + UpdateCertificateRequest, + UpdateCertificateRevocationListRequest, + UpdateCertificateTemplateRequest, +) + +__all__ = ( + 'CaPool', + 'Certificate', + 'CertificateAuthority', + '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', + 'GetCertificateTemplateRequest', + 'ListCaPoolsRequest', + 'ListCaPoolsResponse', + 'ListCertificateAuthoritiesRequest', + 'ListCertificateAuthoritiesResponse', + 'ListCertificateRevocationListsRequest', + 'ListCertificateRevocationListsResponse', + 'ListCertificatesRequest', + 'ListCertificatesResponse', + 'ListCertificateTemplatesRequest', + 'ListCertificateTemplatesResponse', + 'OperationMetadata', + 'RevokeCertificateRequest', + 'UndeleteCertificateAuthorityRequest', + 'UpdateCaPoolRequest', + 'UpdateCertificateAuthorityRequest', + 'UpdateCertificateRequest', + 'UpdateCertificateRevocationListRequest', + 'UpdateCertificateTemplateRequest', +) diff --git a/owl-bot-staging/v1/google/cloud/security/privateca_v1/types/resources.py b/owl-bot-staging/v1/google/cloud/security/privateca_v1/types/resources.py new file mode 100644 index 0000000..26acdca --- /dev/null +++ b/owl-bot-staging/v1/google/cloud/security/privateca_v1/types/resources.py @@ -0,0 +1,2179 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +from typing import MutableMapping, MutableSequence + +import proto # 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( + package='google.cloud.security.privateca.v1', + manifest={ + 'RevocationReason', + 'SubjectRequestMode', + 'CertificateAuthority', + 'CaPool', + 'CertificateRevocationList', + 'Certificate', + 'CertificateTemplate', + 'X509Parameters', + 'SubordinateConfig', + 'PublicKey', + 'CertificateConfig', + 'CertificateDescription', + 'ObjectId', + 'X509Extension', + 'KeyUsage', + 'Subject', + 'SubjectAltNames', + 'CertificateIdentityConstraints', + 'CertificateExtensionConstraints', + }, +) + + +class RevocationReason(proto.Enum): + r"""A + [RevocationReason][google.cloud.security.privateca.v1.RevocationReason] + indicates whether a + [Certificate][google.cloud.security.privateca.v1.Certificate] has + been revoked, and the reason for revocation. These correspond to + standard revocation reasons from RFC 5280. Note that the enum labels + and values in this definition are not the same ASN.1 values defined + in RFC 5280. These values will be translated to the correct ASN.1 + values when a CRL is created. + + Values: + REVOCATION_REASON_UNSPECIFIED (0): + Default unspecified value. This value does indicate that a + [Certificate][google.cloud.security.privateca.v1.Certificate] + has been revoked, but that a reason has not been recorded. + KEY_COMPROMISE (1): + Key material for this + [Certificate][google.cloud.security.privateca.v1.Certificate] + may have leaked. + CERTIFICATE_AUTHORITY_COMPROMISE (2): + The key material for a certificate authority + in the issuing path may have leaked. + AFFILIATION_CHANGED (3): + The subject or other attributes in this + [Certificate][google.cloud.security.privateca.v1.Certificate] + have changed. + SUPERSEDED (4): + This + [Certificate][google.cloud.security.privateca.v1.Certificate] + has been superseded. + CESSATION_OF_OPERATION (5): + This + [Certificate][google.cloud.security.privateca.v1.Certificate] + or entities in the issuing path have ceased to operate. + CERTIFICATE_HOLD (6): + This + [Certificate][google.cloud.security.privateca.v1.Certificate] + should not be considered valid, it is expected that it may + become valid in the future. + PRIVILEGE_WITHDRAWN (7): + This + [Certificate][google.cloud.security.privateca.v1.Certificate] + no longer has permission to assert the listed attributes. + ATTRIBUTE_AUTHORITY_COMPROMISE (8): + The authority which determines appropriate attributes for a + [Certificate][google.cloud.security.privateca.v1.Certificate] + may have been compromised. + """ + REVOCATION_REASON_UNSPECIFIED = 0 + KEY_COMPROMISE = 1 + CERTIFICATE_AUTHORITY_COMPROMISE = 2 + AFFILIATION_CHANGED = 3 + SUPERSEDED = 4 + CESSATION_OF_OPERATION = 5 + CERTIFICATE_HOLD = 6 + PRIVILEGE_WITHDRAWN = 7 + ATTRIBUTE_AUTHORITY_COMPROMISE = 8 + + +class SubjectRequestMode(proto.Enum): + r"""Describes the way in which a + [Certificate][google.cloud.security.privateca.v1.Certificate]'s + [Subject][google.cloud.security.privateca.v1.Subject] and/or + [SubjectAltNames][google.cloud.security.privateca.v1.SubjectAltNames] + will be resolved. + + Values: + SUBJECT_REQUEST_MODE_UNSPECIFIED (0): + Not specified. + DEFAULT (1): + The default mode used in most cases. Indicates that the + certificate's + [Subject][google.cloud.security.privateca.v1.Subject] and/or + [SubjectAltNames][google.cloud.security.privateca.v1.SubjectAltNames] + are specified in the certificate request. This mode requires + the caller to have the ``privateca.certificates.create`` + permission. + REFLECTED_SPIFFE (2): + A mode reserved for special cases. Indicates that the + certificate should have one or more SPIFFE + [SubjectAltNames][google.cloud.security.privateca.v1.SubjectAltNames] + set by the service based on the caller's identity. This mode + will ignore any explicitly specified + [Subject][google.cloud.security.privateca.v1.Subject] and/or + [SubjectAltNames][google.cloud.security.privateca.v1.SubjectAltNames] + in the certificate request. This mode requires the caller to + have the ``privateca.certificates.createForSelf`` + permission. + """ + SUBJECT_REQUEST_MODE_UNSPECIFIED = 0 + DEFAULT = 1 + REFLECTED_SPIFFE = 2 + + +class CertificateAuthority(proto.Message): + r"""A + [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority] + represents an individual Certificate Authority. A + [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority] + can be used to create + [Certificates][google.cloud.security.privateca.v1.Certificate]. + + Attributes: + name (str): + Output only. The resource name for this + [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority] + in the format + ``projects/*/locations/*/caPools/*/certificateAuthorities/*``. + type_ (google.cloud.security.privateca_v1.types.CertificateAuthority.Type): + Required. Immutable. The + [Type][google.cloud.security.privateca.v1.CertificateAuthority.Type] + of this + [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority]. + config (google.cloud.security.privateca_v1.types.CertificateConfig): + Required. Immutable. The config used to + create a self-signed X.509 certificate or CSR. + lifetime (google.protobuf.duration_pb2.Duration): + Required. Immutable. The desired lifetime of the CA + certificate. Used to create the "not_before_time" and + "not_after_time" fields inside an X.509 certificate. + key_spec (google.cloud.security.privateca_v1.types.CertificateAuthority.KeyVersionSpec): + Required. Immutable. Used when issuing certificates for this + [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority]. + If this + [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority] + is a self-signed CertificateAuthority, this key is also used + to sign the self-signed CA certificate. Otherwise, it is + used to sign a CSR. + subordinate_config (google.cloud.security.privateca_v1.types.SubordinateConfig): + Optional. If this is a subordinate + [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority], + this field will be set with the subordinate configuration, + which describes its issuers. This may be updated, but this + [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority] + must continue to validate. + tier (google.cloud.security.privateca_v1.types.CaPool.Tier): + Output only. The + [CaPool.Tier][google.cloud.security.privateca.v1.CaPool.Tier] + of the [CaPool][google.cloud.security.privateca.v1.CaPool] + that includes this + [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority]. + state (google.cloud.security.privateca_v1.types.CertificateAuthority.State): + Output only. The + [State][google.cloud.security.privateca.v1.CertificateAuthority.State] + for this + [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority]. + pem_ca_certificates (MutableSequence[str]): + Output only. This + [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority]'s + certificate chain, including the current + [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority]'s + certificate. Ordered such that the root issuer is the final + element (consistent with RFC 5246). For a self-signed CA, + this will only list the current + [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority]'s + certificate. + ca_certificate_descriptions (MutableSequence[google.cloud.security.privateca_v1.types.CertificateDescription]): + Output only. A structured description of this + [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority]'s + CA certificate and its issuers. Ordered as self-to-root. + gcs_bucket (str): + Immutable. The name of a Cloud Storage bucket where this + [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority] + will publish content, such as the CA certificate and CRLs. + This must be a bucket name, without any prefixes (such as + ``gs://``) or suffixes (such as ``.googleapis.com``). For + example, to use a bucket named ``my-bucket``, you would + simply specify ``my-bucket``. If not specified, a managed + bucket will be created. + access_urls (google.cloud.security.privateca_v1.types.CertificateAuthority.AccessUrls): + Output only. URLs for accessing content + published by this CA, such as the CA certificate + and CRLs. + create_time (google.protobuf.timestamp_pb2.Timestamp): + Output only. The time at which this + [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority] + was created. + update_time (google.protobuf.timestamp_pb2.Timestamp): + Output only. The time at which this + [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority] + was last updated. + delete_time (google.protobuf.timestamp_pb2.Timestamp): + Output only. The time at which this + [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority] + was soft deleted, if it is in the + [DELETED][google.cloud.security.privateca.v1.CertificateAuthority.State.DELETED] + state. + expire_time (google.protobuf.timestamp_pb2.Timestamp): + Output only. The time at which this + [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority] + will be permanently purged, if it is in the + [DELETED][google.cloud.security.privateca.v1.CertificateAuthority.State.DELETED] + state. + labels (MutableMapping[str, str]): + Optional. Labels with user-defined metadata. + """ + class Type(proto.Enum): + r"""The type of a + [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority], + indicating its issuing chain. + + Values: + TYPE_UNSPECIFIED (0): + Not specified. + SELF_SIGNED (1): + Self-signed CA. + SUBORDINATE (2): + Subordinate CA. Could be issued by a Private CA + [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority] + or an unmanaged CA. + """ + TYPE_UNSPECIFIED = 0 + SELF_SIGNED = 1 + SUBORDINATE = 2 + + class State(proto.Enum): + r"""The state of a + [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority], + indicating if it can be used. + + Values: + STATE_UNSPECIFIED (0): + Not specified. + ENABLED (1): + Certificates can be issued from this CA. CRLs will be + generated for this CA. The CA will be part of the + [CaPool][google.cloud.security.privateca.v1.CaPool]'s trust + anchor, and will be used to issue certificates from the + [CaPool][google.cloud.security.privateca.v1.CaPool]. + DISABLED (2): + Certificates cannot be issued from this CA. CRLs will still + be generated. The CA will be part of the + [CaPool][google.cloud.security.privateca.v1.CaPool]'s trust + anchor, but will not be used to issue certificates from the + [CaPool][google.cloud.security.privateca.v1.CaPool]. + STAGED (3): + Certificates can be issued from this CA. CRLs will be + generated for this CA. The CA will be part of the + [CaPool][google.cloud.security.privateca.v1.CaPool]'s trust + anchor, but will not be used to issue certificates from the + [CaPool][google.cloud.security.privateca.v1.CaPool]. + AWAITING_USER_ACTIVATION (4): + Certificates cannot be issued from this CA. CRLs will not be + generated. The CA will not be part of the + [CaPool][google.cloud.security.privateca.v1.CaPool]'s trust + anchor, and will not be used to issue certificates from the + [CaPool][google.cloud.security.privateca.v1.CaPool]. + DELETED (5): + Certificates cannot be issued from this CA. CRLs will not be + generated. The CA may still be recovered by calling + [CertificateAuthorityService.UndeleteCertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthorityService.UndeleteCertificateAuthority] + before + [expire_time][google.cloud.security.privateca.v1.CertificateAuthority.expire_time]. + The CA will not be part of the + [CaPool][google.cloud.security.privateca.v1.CaPool]'s trust + anchor, and will not be used to issue certificates from the + [CaPool][google.cloud.security.privateca.v1.CaPool]. + """ + STATE_UNSPECIFIED = 0 + ENABLED = 1 + DISABLED = 2 + STAGED = 3 + AWAITING_USER_ACTIVATION = 4 + DELETED = 5 + + class SignHashAlgorithm(proto.Enum): + r"""The algorithm of a Cloud KMS CryptoKeyVersion of a + [CryptoKey][google.cloud.kms.v1.CryptoKey] with the + [CryptoKeyPurpose][google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose] + value ``ASYMMETRIC_SIGN``. These values correspond to the + [CryptoKeyVersionAlgorithm][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionAlgorithm] + values. For RSA signing algorithms, the PSS algorithms should be + preferred, use PKCS1 algorithms if required for compatibility. For + further recommendations, see + https://cloud.google.com/kms/docs/algorithms#algorithm_recommendations. + + Values: + SIGN_HASH_ALGORITHM_UNSPECIFIED (0): + Not specified. + RSA_PSS_2048_SHA256 (1): + maps to CryptoKeyVersionAlgorithm.RSA_SIGN_PSS_2048_SHA256 + RSA_PSS_3072_SHA256 (2): + maps to CryptoKeyVersionAlgorithm. RSA_SIGN_PSS_3072_SHA256 + RSA_PSS_4096_SHA256 (3): + maps to CryptoKeyVersionAlgorithm.RSA_SIGN_PSS_4096_SHA256 + RSA_PKCS1_2048_SHA256 (6): + maps to CryptoKeyVersionAlgorithm.RSA_SIGN_PKCS1_2048_SHA256 + RSA_PKCS1_3072_SHA256 (7): + maps to CryptoKeyVersionAlgorithm.RSA_SIGN_PKCS1_3072_SHA256 + RSA_PKCS1_4096_SHA256 (8): + maps to CryptoKeyVersionAlgorithm.RSA_SIGN_PKCS1_4096_SHA256 + EC_P256_SHA256 (4): + maps to CryptoKeyVersionAlgorithm.EC_SIGN_P256_SHA256 + EC_P384_SHA384 (5): + maps to CryptoKeyVersionAlgorithm.EC_SIGN_P384_SHA384 + """ + SIGN_HASH_ALGORITHM_UNSPECIFIED = 0 + RSA_PSS_2048_SHA256 = 1 + RSA_PSS_3072_SHA256 = 2 + RSA_PSS_4096_SHA256 = 3 + RSA_PKCS1_2048_SHA256 = 6 + RSA_PKCS1_3072_SHA256 = 7 + RSA_PKCS1_4096_SHA256 = 8 + EC_P256_SHA256 = 4 + EC_P384_SHA384 = 5 + + class AccessUrls(proto.Message): + r"""URLs where a + [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority] + will publish content. + + Attributes: + ca_certificate_access_url (str): + The URL where this + [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority]'s + CA certificate is published. This will only be set for CAs + that have been activated. + crl_access_urls (MutableSequence[str]): + The URLs where this + [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority]'s + CRLs are published. This will only be set for CAs that have + been activated. + """ + + ca_certificate_access_url: str = proto.Field( + proto.STRING, + number=1, + ) + crl_access_urls: MutableSequence[str] = proto.RepeatedField( + proto.STRING, + number=2, + ) + + class KeyVersionSpec(proto.Message): + r"""A Cloud KMS key configuration that a + [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority] + will use. + + This message has `oneof`_ fields (mutually exclusive fields). + For each oneof, at most one member field can be set at the same time. + Setting any member of the oneof automatically clears all other + members. + + .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields + + Attributes: + cloud_kms_key_version (str): + The resource name for an existing Cloud KMS CryptoKeyVersion + in the format + ``projects/*/locations/*/keyRings/*/cryptoKeys/*/cryptoKeyVersions/*``. + This option enables full flexibility in the key's + capabilities and properties. + + This field is a member of `oneof`_ ``KeyVersion``. + algorithm (google.cloud.security.privateca_v1.types.CertificateAuthority.SignHashAlgorithm): + The algorithm to use for creating a managed Cloud KMS key + for a for a simplified experience. All managed keys will be + have their + [ProtectionLevel][google.cloud.kms.v1.ProtectionLevel] as + ``HSM``. + + This field is a member of `oneof`_ ``KeyVersion``. + """ + + cloud_kms_key_version: str = proto.Field( + proto.STRING, + number=1, + oneof='KeyVersion', + ) + algorithm: 'CertificateAuthority.SignHashAlgorithm' = proto.Field( + proto.ENUM, + number=2, + oneof='KeyVersion', + enum='CertificateAuthority.SignHashAlgorithm', + ) + + name: str = proto.Field( + proto.STRING, + number=1, + ) + type_: Type = proto.Field( + proto.ENUM, + number=2, + enum=Type, + ) + config: 'CertificateConfig' = proto.Field( + proto.MESSAGE, + number=3, + message='CertificateConfig', + ) + lifetime: duration_pb2.Duration = proto.Field( + proto.MESSAGE, + number=4, + message=duration_pb2.Duration, + ) + key_spec: KeyVersionSpec = proto.Field( + proto.MESSAGE, + number=5, + message=KeyVersionSpec, + ) + subordinate_config: 'SubordinateConfig' = proto.Field( + proto.MESSAGE, + number=6, + message='SubordinateConfig', + ) + tier: 'CaPool.Tier' = proto.Field( + proto.ENUM, + number=7, + enum='CaPool.Tier', + ) + state: State = proto.Field( + proto.ENUM, + number=8, + enum=State, + ) + pem_ca_certificates: MutableSequence[str] = proto.RepeatedField( + proto.STRING, + number=9, + ) + ca_certificate_descriptions: MutableSequence['CertificateDescription'] = proto.RepeatedField( + proto.MESSAGE, + number=10, + message='CertificateDescription', + ) + gcs_bucket: str = proto.Field( + proto.STRING, + number=11, + ) + access_urls: AccessUrls = proto.Field( + proto.MESSAGE, + number=12, + message=AccessUrls, + ) + create_time: timestamp_pb2.Timestamp = proto.Field( + proto.MESSAGE, + number=13, + message=timestamp_pb2.Timestamp, + ) + update_time: timestamp_pb2.Timestamp = proto.Field( + proto.MESSAGE, + number=14, + message=timestamp_pb2.Timestamp, + ) + delete_time: timestamp_pb2.Timestamp = proto.Field( + proto.MESSAGE, + number=15, + message=timestamp_pb2.Timestamp, + ) + expire_time: timestamp_pb2.Timestamp = proto.Field( + proto.MESSAGE, + number=16, + message=timestamp_pb2.Timestamp, + ) + labels: MutableMapping[str, str] = proto.MapField( + proto.STRING, + proto.STRING, + number=17, + ) + + +class CaPool(proto.Message): + r"""A [CaPool][google.cloud.security.privateca.v1.CaPool] represents a + group of + [CertificateAuthorities][google.cloud.security.privateca.v1.CertificateAuthority] + that form a trust anchor. A + [CaPool][google.cloud.security.privateca.v1.CaPool] can be used to + manage issuance policies for one or more + [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority] + resources and to rotate CA certificates in and out of the trust + anchor. + + Attributes: + name (str): + Output only. The resource name for this + [CaPool][google.cloud.security.privateca.v1.CaPool] in the + format ``projects/*/locations/*/caPools/*``. + tier (google.cloud.security.privateca_v1.types.CaPool.Tier): + Required. Immutable. The + [Tier][google.cloud.security.privateca.v1.CaPool.Tier] of + this [CaPool][google.cloud.security.privateca.v1.CaPool]. + issuance_policy (google.cloud.security.privateca_v1.types.CaPool.IssuancePolicy): + Optional. The + [IssuancePolicy][google.cloud.security.privateca.v1.CaPool.IssuancePolicy] + to control how + [Certificates][google.cloud.security.privateca.v1.Certificate] + will be issued from this + [CaPool][google.cloud.security.privateca.v1.CaPool]. + publishing_options (google.cloud.security.privateca_v1.types.CaPool.PublishingOptions): + Optional. The + [PublishingOptions][google.cloud.security.privateca.v1.CaPool.PublishingOptions] + to follow when issuing + [Certificates][google.cloud.security.privateca.v1.Certificate] + from any + [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority] + in this [CaPool][google.cloud.security.privateca.v1.CaPool]. + labels (MutableMapping[str, str]): + Optional. Labels with user-defined metadata. + """ + class Tier(proto.Enum): + r"""The tier of a [CaPool][google.cloud.security.privateca.v1.CaPool], + indicating its supported functionality and/or billing SKU. + + Values: + TIER_UNSPECIFIED (0): + Not specified. + ENTERPRISE (1): + Enterprise tier. + DEVOPS (2): + DevOps tier. + """ + TIER_UNSPECIFIED = 0 + ENTERPRISE = 1 + DEVOPS = 2 + + class PublishingOptions(proto.Message): + r"""Options relating to the publication of each + [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority]'s + CA certificate and CRLs and their inclusion as extensions in issued + [Certificates][google.cloud.security.privateca.v1.Certificate]. The + options set here apply to certificates issued by any + [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority] + in the [CaPool][google.cloud.security.privateca.v1.CaPool]. + + Attributes: + publish_ca_cert (bool): + Optional. When true, publishes each + [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority]'s + CA certificate and includes its URL in the "Authority + Information Access" X.509 extension in all issued + [Certificates][google.cloud.security.privateca.v1.Certificate]. + If this is false, the CA certificate will not be published + and the corresponding X.509 extension will not be written in + issued certificates. + publish_crl (bool): + Optional. When true, publishes each + [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority]'s + CRL and includes its URL in the "CRL Distribution Points" + X.509 extension in all issued + [Certificates][google.cloud.security.privateca.v1.Certificate]. + If this is false, CRLs will not be published and the + corresponding X.509 extension will not be written in issued + certificates. CRLs will expire 7 days from their creation. + However, we will rebuild daily. CRLs are also rebuilt + shortly after a certificate is revoked. + """ + + publish_ca_cert: bool = proto.Field( + proto.BOOL, + number=1, + ) + publish_crl: bool = proto.Field( + proto.BOOL, + number=2, + ) + + class IssuancePolicy(proto.Message): + r"""Defines controls over all certificate issuance within a + [CaPool][google.cloud.security.privateca.v1.CaPool]. + + Attributes: + allowed_key_types (MutableSequence[google.cloud.security.privateca_v1.types.CaPool.IssuancePolicy.AllowedKeyType]): + Optional. If any + [AllowedKeyType][google.cloud.security.privateca.v1.CaPool.IssuancePolicy.AllowedKeyType] + is specified, then the certificate request's public key must + match one of the key types listed here. Otherwise, any key + may be used. + maximum_lifetime (google.protobuf.duration_pb2.Duration): + Optional. The maximum lifetime allowed for issued + [Certificates][google.cloud.security.privateca.v1.Certificate]. + Note that if the issuing + [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority] + expires before a + [Certificate][google.cloud.security.privateca.v1.Certificate]'s + requested maximum_lifetime, the effective lifetime will be + explicitly truncated to match it. + allowed_issuance_modes (google.cloud.security.privateca_v1.types.CaPool.IssuancePolicy.IssuanceModes): + Optional. If specified, then only methods allowed in the + [IssuanceModes][google.cloud.security.privateca.v1.CaPool.IssuancePolicy.IssuanceModes] + may be used to issue + [Certificates][google.cloud.security.privateca.v1.Certificate]. + baseline_values (google.cloud.security.privateca_v1.types.X509Parameters): + Optional. A set of X.509 values that will be applied to all + certificates issued through this + [CaPool][google.cloud.security.privateca.v1.CaPool]. If a + certificate request includes conflicting values for the same + properties, they will be overwritten by the values defined + here. If a certificate request uses a + [CertificateTemplate][google.cloud.security.privateca.v1.CertificateTemplate] + that defines conflicting + [predefined_values][google.cloud.security.privateca.v1.CertificateTemplate.predefined_values] + for the same properties, the certificate issuance request + will fail. + identity_constraints (google.cloud.security.privateca_v1.types.CertificateIdentityConstraints): + Optional. Describes constraints on identities that may + appear in + [Certificates][google.cloud.security.privateca.v1.Certificate] + issued through this + [CaPool][google.cloud.security.privateca.v1.CaPool]. If this + is omitted, then this + [CaPool][google.cloud.security.privateca.v1.CaPool] will not + add restrictions on a certificate's identity. + passthrough_extensions (google.cloud.security.privateca_v1.types.CertificateExtensionConstraints): + Optional. Describes the set of X.509 extensions that may + appear in a + [Certificate][google.cloud.security.privateca.v1.Certificate] + issued through this + [CaPool][google.cloud.security.privateca.v1.CaPool]. If a + certificate request sets extensions that don't appear in the + [passthrough_extensions][google.cloud.security.privateca.v1.CaPool.IssuancePolicy.passthrough_extensions], + those extensions will be dropped. If a certificate request + uses a + [CertificateTemplate][google.cloud.security.privateca.v1.CertificateTemplate] + with + [predefined_values][google.cloud.security.privateca.v1.CertificateTemplate.predefined_values] + that don't appear here, the certificate issuance request + will fail. If this is omitted, then this + [CaPool][google.cloud.security.privateca.v1.CaPool] will not + add restrictions on a certificate's X.509 extensions. These + constraints do not apply to X.509 extensions set in this + [CaPool][google.cloud.security.privateca.v1.CaPool]'s + [baseline_values][google.cloud.security.privateca.v1.CaPool.IssuancePolicy.baseline_values]. + """ + + class AllowedKeyType(proto.Message): + r"""Describes a "type" of key that may be used in a + [Certificate][google.cloud.security.privateca.v1.Certificate] issued + from a [CaPool][google.cloud.security.privateca.v1.CaPool]. Note + that a single + [AllowedKeyType][google.cloud.security.privateca.v1.CaPool.IssuancePolicy.AllowedKeyType] + may refer to either a fully-qualified key algorithm, such as RSA + 4096, or a family of key algorithms, such as any RSA key. + + This message has `oneof`_ fields (mutually exclusive fields). + For each oneof, at most one member field can be set at the same time. + Setting any member of the oneof automatically clears all other + members. + + .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields + + Attributes: + rsa (google.cloud.security.privateca_v1.types.CaPool.IssuancePolicy.AllowedKeyType.RsaKeyType): + Represents an allowed RSA key type. + + This field is a member of `oneof`_ ``key_type``. + elliptic_curve (google.cloud.security.privateca_v1.types.CaPool.IssuancePolicy.AllowedKeyType.EcKeyType): + Represents an allowed Elliptic Curve key + type. + + This field is a member of `oneof`_ ``key_type``. + """ + + class RsaKeyType(proto.Message): + r"""Describes an RSA key that may be used in a + [Certificate][google.cloud.security.privateca.v1.Certificate] issued + from a [CaPool][google.cloud.security.privateca.v1.CaPool]. + + Attributes: + min_modulus_size (int): + Optional. The minimum allowed RSA modulus + size (inclusive), in bits. If this is not set, + or if set to zero, the service-level min RSA + modulus size will continue to apply. + max_modulus_size (int): + Optional. The maximum allowed RSA modulus + size (inclusive), in bits. If this is not set, + or if set to zero, the service will not enforce + an explicit upper bound on RSA modulus sizes. + """ + + min_modulus_size: int = proto.Field( + proto.INT64, + number=1, + ) + max_modulus_size: int = proto.Field( + proto.INT64, + number=2, + ) + + class EcKeyType(proto.Message): + r"""Describes an Elliptic Curve key that may be used in a + [Certificate][google.cloud.security.privateca.v1.Certificate] issued + from a [CaPool][google.cloud.security.privateca.v1.CaPool]. + + Attributes: + signature_algorithm (google.cloud.security.privateca_v1.types.CaPool.IssuancePolicy.AllowedKeyType.EcKeyType.EcSignatureAlgorithm): + Optional. A signature algorithm that must be + used. If this is omitted, any EC-based signature + algorithm will be allowed. + """ + class EcSignatureAlgorithm(proto.Enum): + r"""Describes an elliptic curve-based signature algorithm that may be + used in a + [Certificate][google.cloud.security.privateca.v1.Certificate] issued + from a [CaPool][google.cloud.security.privateca.v1.CaPool]. + + Values: + EC_SIGNATURE_ALGORITHM_UNSPECIFIED (0): + Not specified. Signifies that any signature + algorithm may be used. + ECDSA_P256 (1): + Refers to the Elliptic Curve Digital + Signature Algorithm over the NIST P-256 curve. + ECDSA_P384 (2): + Refers to the Elliptic Curve Digital + Signature Algorithm over the NIST P-384 curve. + EDDSA_25519 (3): + Refers to the Edwards-curve Digital Signature + Algorithm over curve 25519, as described in RFC + 8410. + """ + EC_SIGNATURE_ALGORITHM_UNSPECIFIED = 0 + ECDSA_P256 = 1 + ECDSA_P384 = 2 + EDDSA_25519 = 3 + + signature_algorithm: 'CaPool.IssuancePolicy.AllowedKeyType.EcKeyType.EcSignatureAlgorithm' = proto.Field( + proto.ENUM, + number=1, + enum='CaPool.IssuancePolicy.AllowedKeyType.EcKeyType.EcSignatureAlgorithm', + ) + + rsa: 'CaPool.IssuancePolicy.AllowedKeyType.RsaKeyType' = proto.Field( + proto.MESSAGE, + number=1, + oneof='key_type', + message='CaPool.IssuancePolicy.AllowedKeyType.RsaKeyType', + ) + elliptic_curve: 'CaPool.IssuancePolicy.AllowedKeyType.EcKeyType' = proto.Field( + proto.MESSAGE, + number=2, + oneof='key_type', + message='CaPool.IssuancePolicy.AllowedKeyType.EcKeyType', + ) + + class IssuanceModes(proto.Message): + r"""[IssuanceModes][google.cloud.security.privateca.v1.CaPool.IssuancePolicy.IssuanceModes] + specifies the allowed ways in which + [Certificates][google.cloud.security.privateca.v1.Certificate] may + be requested from this + [CaPool][google.cloud.security.privateca.v1.CaPool]. + + Attributes: + allow_csr_based_issuance (bool): + Optional. When true, allows callers to create + [Certificates][google.cloud.security.privateca.v1.Certificate] + by specifying a CSR. + allow_config_based_issuance (bool): + Optional. When true, allows callers to create + [Certificates][google.cloud.security.privateca.v1.Certificate] + by specifying a + [CertificateConfig][google.cloud.security.privateca.v1.CertificateConfig]. + """ + + allow_csr_based_issuance: bool = proto.Field( + proto.BOOL, + number=1, + ) + allow_config_based_issuance: bool = proto.Field( + proto.BOOL, + number=2, + ) + + allowed_key_types: MutableSequence['CaPool.IssuancePolicy.AllowedKeyType'] = proto.RepeatedField( + proto.MESSAGE, + number=1, + message='CaPool.IssuancePolicy.AllowedKeyType', + ) + maximum_lifetime: duration_pb2.Duration = proto.Field( + proto.MESSAGE, + number=2, + message=duration_pb2.Duration, + ) + allowed_issuance_modes: 'CaPool.IssuancePolicy.IssuanceModes' = proto.Field( + proto.MESSAGE, + number=3, + message='CaPool.IssuancePolicy.IssuanceModes', + ) + baseline_values: 'X509Parameters' = proto.Field( + proto.MESSAGE, + number=4, + message='X509Parameters', + ) + identity_constraints: 'CertificateIdentityConstraints' = proto.Field( + proto.MESSAGE, + number=5, + message='CertificateIdentityConstraints', + ) + passthrough_extensions: 'CertificateExtensionConstraints' = proto.Field( + proto.MESSAGE, + number=6, + message='CertificateExtensionConstraints', + ) + + name: str = proto.Field( + proto.STRING, + number=1, + ) + tier: Tier = proto.Field( + proto.ENUM, + number=2, + enum=Tier, + ) + issuance_policy: IssuancePolicy = proto.Field( + proto.MESSAGE, + number=3, + message=IssuancePolicy, + ) + publishing_options: PublishingOptions = proto.Field( + proto.MESSAGE, + number=4, + message=PublishingOptions, + ) + labels: MutableMapping[str, str] = proto.MapField( + proto.STRING, + proto.STRING, + number=5, + ) + + +class CertificateRevocationList(proto.Message): + r"""A + [CertificateRevocationList][google.cloud.security.privateca.v1.CertificateRevocationList] + corresponds to a signed X.509 certificate Revocation List (CRL). A + CRL contains the serial numbers of certificates that should no + longer be trusted. + + Attributes: + name (str): + Output only. The resource name for this + [CertificateRevocationList][google.cloud.security.privateca.v1.CertificateRevocationList] + in the format + ``projects/*/locations/*/caPools/*certificateAuthorities/*/ certificateRevocationLists/*``. + sequence_number (int): + Output only. The CRL sequence number that appears in + pem_crl. + revoked_certificates (MutableSequence[google.cloud.security.privateca_v1.types.CertificateRevocationList.RevokedCertificate]): + Output only. The revoked serial numbers that appear in + pem_crl. + pem_crl (str): + Output only. The PEM-encoded X.509 CRL. + access_url (str): + Output only. The location where 'pem_crl' can be accessed. + state (google.cloud.security.privateca_v1.types.CertificateRevocationList.State): + Output only. The + [State][google.cloud.security.privateca.v1.CertificateRevocationList.State] + for this + [CertificateRevocationList][google.cloud.security.privateca.v1.CertificateRevocationList]. + create_time (google.protobuf.timestamp_pb2.Timestamp): + Output only. The time at which this + [CertificateRevocationList][google.cloud.security.privateca.v1.CertificateRevocationList] + was created. + update_time (google.protobuf.timestamp_pb2.Timestamp): + Output only. The time at which this + [CertificateRevocationList][google.cloud.security.privateca.v1.CertificateRevocationList] + was updated. + revision_id (str): + Output only. The revision ID of this + [CertificateRevocationList][google.cloud.security.privateca.v1.CertificateRevocationList]. + A new revision is committed whenever a new CRL is published. + The format is an 8-character hexadecimal string. + labels (MutableMapping[str, str]): + Optional. Labels with user-defined metadata. + """ + class State(proto.Enum): + r"""The state of a + [CertificateRevocationList][google.cloud.security.privateca.v1.CertificateRevocationList], + indicating if it is current. + + Values: + STATE_UNSPECIFIED (0): + Not specified. + ACTIVE (1): + The + [CertificateRevocationList][google.cloud.security.privateca.v1.CertificateRevocationList] + is up to date. + SUPERSEDED (2): + The + [CertificateRevocationList][google.cloud.security.privateca.v1.CertificateRevocationList] + is no longer current. + """ + STATE_UNSPECIFIED = 0 + ACTIVE = 1 + SUPERSEDED = 2 + + class RevokedCertificate(proto.Message): + r"""Describes a revoked + [Certificate][google.cloud.security.privateca.v1.Certificate]. + + Attributes: + certificate (str): + The resource name for the + [Certificate][google.cloud.security.privateca.v1.Certificate] + in the format + ``projects/*/locations/*/caPools/*/certificates/*``. + hex_serial_number (str): + The serial number of the + [Certificate][google.cloud.security.privateca.v1.Certificate]. + revocation_reason (google.cloud.security.privateca_v1.types.RevocationReason): + The reason the + [Certificate][google.cloud.security.privateca.v1.Certificate] + was revoked. + """ + + certificate: str = proto.Field( + proto.STRING, + number=1, + ) + hex_serial_number: str = proto.Field( + proto.STRING, + number=2, + ) + revocation_reason: 'RevocationReason' = proto.Field( + proto.ENUM, + number=3, + enum='RevocationReason', + ) + + name: str = proto.Field( + proto.STRING, + number=1, + ) + sequence_number: int = proto.Field( + proto.INT64, + number=2, + ) + revoked_certificates: MutableSequence[RevokedCertificate] = proto.RepeatedField( + proto.MESSAGE, + number=3, + message=RevokedCertificate, + ) + pem_crl: str = proto.Field( + proto.STRING, + number=4, + ) + access_url: str = proto.Field( + proto.STRING, + number=5, + ) + state: State = proto.Field( + proto.ENUM, + number=6, + enum=State, + ) + create_time: timestamp_pb2.Timestamp = proto.Field( + proto.MESSAGE, + number=7, + message=timestamp_pb2.Timestamp, + ) + update_time: timestamp_pb2.Timestamp = proto.Field( + proto.MESSAGE, + number=8, + message=timestamp_pb2.Timestamp, + ) + revision_id: str = proto.Field( + proto.STRING, + number=9, + ) + labels: MutableMapping[str, str] = proto.MapField( + proto.STRING, + proto.STRING, + number=10, + ) + + +class Certificate(proto.Message): + r"""A [Certificate][google.cloud.security.privateca.v1.Certificate] + corresponds to a signed X.509 certificate issued by a + [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority]. + + This message has `oneof`_ fields (mutually exclusive fields). + For each oneof, at most one member field can be set at the same time. + Setting any member of the oneof automatically clears all other + members. + + .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields + + Attributes: + name (str): + Output only. The resource name for this + [Certificate][google.cloud.security.privateca.v1.Certificate] + in the format + ``projects/*/locations/*/caPools/*/certificates/*``. + pem_csr (str): + Immutable. A pem-encoded X.509 certificate + signing request (CSR). + + This field is a member of `oneof`_ ``certificate_config``. + config (google.cloud.security.privateca_v1.types.CertificateConfig): + Immutable. A description of the certificate + and key that does not require X.509 or ASN.1. + + This field is a member of `oneof`_ ``certificate_config``. + issuer_certificate_authority (str): + Output only. The resource name of the issuing + [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority] + in the format + ``projects/*/locations/*/caPools/*/certificateAuthorities/*``. + lifetime (google.protobuf.duration_pb2.Duration): + Required. Immutable. The desired lifetime of a certificate. + Used to create the "not_before_time" and "not_after_time" + fields inside an X.509 certificate. Note that the lifetime + may be truncated if it would extend past the life of any + certificate authority in the issuing chain. + certificate_template (str): + Immutable. The resource name for a + [CertificateTemplate][google.cloud.security.privateca.v1.CertificateTemplate] + used to issue this certificate, in the format + ``projects/*/locations/*/certificateTemplates/*``. If this + is specified, the caller must have the necessary permission + to use this template. If this is omitted, no template will + be used. This template must be in the same location as the + [Certificate][google.cloud.security.privateca.v1.Certificate]. + subject_mode (google.cloud.security.privateca_v1.types.SubjectRequestMode): + Immutable. Specifies how the + [Certificate][google.cloud.security.privateca.v1.Certificate]'s + identity fields are to be decided. If this is omitted, the + ``DEFAULT`` subject mode will be used. + revocation_details (google.cloud.security.privateca_v1.types.Certificate.RevocationDetails): + Output only. Details regarding the revocation of this + [Certificate][google.cloud.security.privateca.v1.Certificate]. + This + [Certificate][google.cloud.security.privateca.v1.Certificate] + is considered revoked if and only if this field is present. + pem_certificate (str): + Output only. The pem-encoded, signed X.509 + certificate. + certificate_description (google.cloud.security.privateca_v1.types.CertificateDescription): + Output only. A structured description of the + issued X.509 certificate. + pem_certificate_chain (MutableSequence[str]): + Output only. The chain that may be used to + verify the X.509 certificate. Expected to be in + issuer-to-root order according to RFC 5246. + create_time (google.protobuf.timestamp_pb2.Timestamp): + Output only. The time at which this + [Certificate][google.cloud.security.privateca.v1.Certificate] + was created. + update_time (google.protobuf.timestamp_pb2.Timestamp): + Output only. The time at which this + [Certificate][google.cloud.security.privateca.v1.Certificate] + was updated. + labels (MutableMapping[str, str]): + Optional. Labels with user-defined metadata. + """ + + class RevocationDetails(proto.Message): + r"""Describes fields that are relavent to the revocation of a + [Certificate][google.cloud.security.privateca.v1.Certificate]. + + Attributes: + revocation_state (google.cloud.security.privateca_v1.types.RevocationReason): + Indicates why a + [Certificate][google.cloud.security.privateca.v1.Certificate] + was revoked. + revocation_time (google.protobuf.timestamp_pb2.Timestamp): + The time at which this + [Certificate][google.cloud.security.privateca.v1.Certificate] + was revoked. + """ + + revocation_state: 'RevocationReason' = proto.Field( + proto.ENUM, + number=1, + enum='RevocationReason', + ) + revocation_time: timestamp_pb2.Timestamp = proto.Field( + proto.MESSAGE, + number=2, + message=timestamp_pb2.Timestamp, + ) + + name: str = proto.Field( + proto.STRING, + number=1, + ) + pem_csr: str = proto.Field( + proto.STRING, + number=2, + oneof='certificate_config', + ) + config: 'CertificateConfig' = proto.Field( + proto.MESSAGE, + number=3, + oneof='certificate_config', + message='CertificateConfig', + ) + issuer_certificate_authority: str = proto.Field( + proto.STRING, + number=4, + ) + lifetime: duration_pb2.Duration = proto.Field( + proto.MESSAGE, + number=5, + message=duration_pb2.Duration, + ) + certificate_template: str = proto.Field( + proto.STRING, + number=6, + ) + subject_mode: 'SubjectRequestMode' = proto.Field( + proto.ENUM, + number=7, + enum='SubjectRequestMode', + ) + revocation_details: RevocationDetails = proto.Field( + proto.MESSAGE, + number=8, + message=RevocationDetails, + ) + pem_certificate: str = proto.Field( + proto.STRING, + number=9, + ) + certificate_description: 'CertificateDescription' = proto.Field( + proto.MESSAGE, + number=10, + message='CertificateDescription', + ) + pem_certificate_chain: MutableSequence[str] = proto.RepeatedField( + proto.STRING, + number=11, + ) + create_time: timestamp_pb2.Timestamp = proto.Field( + proto.MESSAGE, + number=12, + message=timestamp_pb2.Timestamp, + ) + update_time: timestamp_pb2.Timestamp = proto.Field( + proto.MESSAGE, + number=13, + message=timestamp_pb2.Timestamp, + ) + labels: MutableMapping[str, str] = proto.MapField( + proto.STRING, + proto.STRING, + number=14, + ) + + +class CertificateTemplate(proto.Message): + r"""A + [CertificateTemplate][google.cloud.security.privateca.v1.CertificateTemplate] + refers to a managed template for certificate issuance. + + Attributes: + name (str): + Output only. The resource name for this + [CertificateTemplate][google.cloud.security.privateca.v1.CertificateTemplate] + in the format + ``projects/*/locations/*/certificateTemplates/*``. + predefined_values (google.cloud.security.privateca_v1.types.X509Parameters): + Optional. A set of X.509 values that will be applied to all + issued certificates that use this template. If the + certificate request includes conflicting values for the same + properties, they will be overwritten by the values defined + here. If the issuing + [CaPool][google.cloud.security.privateca.v1.CaPool]'s + [IssuancePolicy][google.cloud.security.privateca.v1.CaPool.IssuancePolicy] + defines conflicting + [baseline_values][google.cloud.security.privateca.v1.CaPool.IssuancePolicy.baseline_values] + for the same properties, the certificate issuance request + will fail. + identity_constraints (google.cloud.security.privateca_v1.types.CertificateIdentityConstraints): + Optional. Describes constraints on identities that may be + appear in + [Certificates][google.cloud.security.privateca.v1.Certificate] + issued using this template. If this is omitted, then this + template will not add restrictions on a certificate's + identity. + passthrough_extensions (google.cloud.security.privateca_v1.types.CertificateExtensionConstraints): + Optional. Describes the set of X.509 extensions that may + appear in a + [Certificate][google.cloud.security.privateca.v1.Certificate] + issued using this + [CertificateTemplate][google.cloud.security.privateca.v1.CertificateTemplate]. + If a certificate request sets extensions that don't appear + in the + [passthrough_extensions][google.cloud.security.privateca.v1.CertificateTemplate.passthrough_extensions], + those extensions will be dropped. If the issuing + [CaPool][google.cloud.security.privateca.v1.CaPool]'s + [IssuancePolicy][google.cloud.security.privateca.v1.CaPool.IssuancePolicy] + defines + [baseline_values][google.cloud.security.privateca.v1.CaPool.IssuancePolicy.baseline_values] + that don't appear here, the certificate issuance request + will fail. If this is omitted, then this template will not + add restrictions on a certificate's X.509 extensions. These + constraints do not apply to X.509 extensions set in this + [CertificateTemplate][google.cloud.security.privateca.v1.CertificateTemplate]'s + [predefined_values][google.cloud.security.privateca.v1.CertificateTemplate.predefined_values]. + description (str): + Optional. A human-readable description of + scenarios this template is intended for. + create_time (google.protobuf.timestamp_pb2.Timestamp): + Output only. The time at which this + [CertificateTemplate][google.cloud.security.privateca.v1.CertificateTemplate] + was created. + update_time (google.protobuf.timestamp_pb2.Timestamp): + Output only. The time at which this + [CertificateTemplate][google.cloud.security.privateca.v1.CertificateTemplate] + was updated. + labels (MutableMapping[str, str]): + Optional. Labels with user-defined metadata. + """ + + name: str = proto.Field( + proto.STRING, + number=1, + ) + predefined_values: 'X509Parameters' = proto.Field( + proto.MESSAGE, + number=2, + message='X509Parameters', + ) + identity_constraints: 'CertificateIdentityConstraints' = proto.Field( + proto.MESSAGE, + number=3, + message='CertificateIdentityConstraints', + ) + passthrough_extensions: 'CertificateExtensionConstraints' = proto.Field( + proto.MESSAGE, + number=4, + message='CertificateExtensionConstraints', + ) + description: str = proto.Field( + proto.STRING, + number=5, + ) + create_time: timestamp_pb2.Timestamp = proto.Field( + proto.MESSAGE, + number=6, + message=timestamp_pb2.Timestamp, + ) + update_time: timestamp_pb2.Timestamp = proto.Field( + proto.MESSAGE, + number=7, + message=timestamp_pb2.Timestamp, + ) + labels: MutableMapping[str, str] = proto.MapField( + proto.STRING, + proto.STRING, + number=8, + ) + + +class X509Parameters(proto.Message): + r"""An + [X509Parameters][google.cloud.security.privateca.v1.X509Parameters] + is used to describe certain fields of an X.509 certificate, such as + the key usage fields, fields specific to CA certificates, + certificate policy extensions and custom extensions. + + Attributes: + key_usage (google.cloud.security.privateca_v1.types.KeyUsage): + Optional. Indicates the intended use for keys + that correspond to a certificate. + ca_options (google.cloud.security.privateca_v1.types.X509Parameters.CaOptions): + Optional. Describes options in this + [X509Parameters][google.cloud.security.privateca.v1.X509Parameters] + that are relevant in a CA certificate. + policy_ids (MutableSequence[google.cloud.security.privateca_v1.types.ObjectId]): + Optional. Describes the X.509 certificate + policy object identifiers, per + https://tools.ietf.org/html/rfc5280#section-4.2.1.4. + aia_ocsp_servers (MutableSequence[str]): + Optional. Describes Online Certificate Status + Protocol (OCSP) endpoint addresses that appear + in the "Authority Information Access" extension + in the certificate. + additional_extensions (MutableSequence[google.cloud.security.privateca_v1.types.X509Extension]): + Optional. Describes custom X.509 extensions. + """ + + class CaOptions(proto.Message): + r"""Describes values that are relevant in a CA certificate. + + .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields + + Attributes: + is_ca (bool): + Optional. Refers to the "CA" X.509 extension, + which is a boolean value. When this value is + missing, the extension will be omitted from the + CA certificate. + + This field is a member of `oneof`_ ``_is_ca``. + max_issuer_path_length (int): + Optional. Refers to the path length + restriction X.509 extension. For a CA + certificate, this value describes the depth of + subordinate CA certificates that are allowed. + If this value is less than 0, the request will + fail. If this value is missing, the max path + length will be omitted from the CA certificate. + + This field is a member of `oneof`_ ``_max_issuer_path_length``. + """ + + is_ca: bool = proto.Field( + proto.BOOL, + number=1, + optional=True, + ) + max_issuer_path_length: int = proto.Field( + proto.INT32, + number=2, + optional=True, + ) + + key_usage: 'KeyUsage' = proto.Field( + proto.MESSAGE, + number=1, + message='KeyUsage', + ) + ca_options: CaOptions = proto.Field( + proto.MESSAGE, + number=2, + message=CaOptions, + ) + policy_ids: MutableSequence['ObjectId'] = proto.RepeatedField( + proto.MESSAGE, + number=3, + message='ObjectId', + ) + aia_ocsp_servers: MutableSequence[str] = proto.RepeatedField( + proto.STRING, + number=4, + ) + additional_extensions: MutableSequence['X509Extension'] = proto.RepeatedField( + proto.MESSAGE, + number=5, + message='X509Extension', + ) + + +class SubordinateConfig(proto.Message): + r"""Describes a subordinate CA's issuers. This is either a resource name + to a known issuing + [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority], + or a PEM issuer certificate chain. + + This message has `oneof`_ fields (mutually exclusive fields). + For each oneof, at most one member field can be set at the same time. + Setting any member of the oneof automatically clears all other + members. + + .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields + + Attributes: + certificate_authority (str): + Required. This can refer to a + [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority] + that was used to create a subordinate + [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority]. + This field is used for information and usability purposes + only. The resource name is in the format + ``projects/*/locations/*/caPools/*/certificateAuthorities/*``. + + This field is a member of `oneof`_ ``subordinate_config``. + pem_issuer_chain (google.cloud.security.privateca_v1.types.SubordinateConfig.SubordinateConfigChain): + Required. Contains the PEM certificate chain for the issuers + of this + [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority], + but not pem certificate for this CA itself. + + This field is a member of `oneof`_ ``subordinate_config``. + """ + + class SubordinateConfigChain(proto.Message): + r"""This message describes a subordinate CA's issuer certificate + chain. This wrapper exists for compatibility reasons. + + Attributes: + pem_certificates (MutableSequence[str]): + Required. Expected to be in leaf-to-root + order according to RFC 5246. + """ + + pem_certificates: MutableSequence[str] = proto.RepeatedField( + proto.STRING, + number=1, + ) + + certificate_authority: str = proto.Field( + proto.STRING, + number=1, + oneof='subordinate_config', + ) + pem_issuer_chain: SubordinateConfigChain = proto.Field( + proto.MESSAGE, + number=2, + oneof='subordinate_config', + message=SubordinateConfigChain, + ) + + +class PublicKey(proto.Message): + r"""A [PublicKey][google.cloud.security.privateca.v1.PublicKey] + describes a public key. + + Attributes: + key (bytes): + Required. A public key. The padding and encoding must match + with the ``KeyFormat`` value specified for the ``format`` + field. + format_ (google.cloud.security.privateca_v1.types.PublicKey.KeyFormat): + Required. The format of the public key. + """ + class KeyFormat(proto.Enum): + r"""Types of public keys formats that are supported. Currently, only + ``PEM`` format is supported. + + Values: + KEY_FORMAT_UNSPECIFIED (0): + Default unspecified value. + PEM (1): + The key is PEM-encoded as defined in `RFC + 7468 `__. It can be any + of the following: a PEM-encoded PKCS#1/RFC 3447 RSAPublicKey + structure, an RFC 5280 + `SubjectPublicKeyInfo `__ + or a PEM-encoded X.509 certificate signing request (CSR). If + a + `SubjectPublicKeyInfo `__ + is specified, it can contain a A PEM-encoded PKCS#1/RFC 3447 + RSAPublicKey or a NIST P-256/secp256r1/prime256v1 or P-384 + key. If a CSR is specified, it will used solely for the + purpose of extracting the public key. When generated by the + service, it will always be an RFC 5280 + `SubjectPublicKeyInfo `__ + structure containing an algorithm identifier and a key. + """ + KEY_FORMAT_UNSPECIFIED = 0 + PEM = 1 + + key: bytes = proto.Field( + proto.BYTES, + number=1, + ) + format_: KeyFormat = proto.Field( + proto.ENUM, + number=2, + enum=KeyFormat, + ) + + +class CertificateConfig(proto.Message): + r"""A + [CertificateConfig][google.cloud.security.privateca.v1.CertificateConfig] + describes an X.509 certificate or CSR that is to be created, as an + alternative to using ASN.1. + + Attributes: + subject_config (google.cloud.security.privateca_v1.types.CertificateConfig.SubjectConfig): + Required. Specifies some of the values in a + certificate that are related to the subject. + x509_config (google.cloud.security.privateca_v1.types.X509Parameters): + Required. Describes how some of the technical + X.509 fields in a certificate should be + populated. + public_key (google.cloud.security.privateca_v1.types.PublicKey): + Optional. The public key that corresponds to this config. + This is, for example, used when issuing + [Certificates][google.cloud.security.privateca.v1.Certificate], + but not when creating a self-signed + [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority] + or + [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority] + CSR. + """ + + class SubjectConfig(proto.Message): + r"""These values are used to create the distinguished name and + subject alternative name fields in an X.509 certificate. + + Attributes: + subject (google.cloud.security.privateca_v1.types.Subject): + Required. Contains distinguished name fields + such as the common name, location and + organization. + subject_alt_name (google.cloud.security.privateca_v1.types.SubjectAltNames): + Optional. The subject alternative name + fields. + """ + + subject: 'Subject' = proto.Field( + proto.MESSAGE, + number=1, + message='Subject', + ) + subject_alt_name: 'SubjectAltNames' = proto.Field( + proto.MESSAGE, + number=2, + message='SubjectAltNames', + ) + + subject_config: SubjectConfig = proto.Field( + proto.MESSAGE, + number=1, + message=SubjectConfig, + ) + x509_config: 'X509Parameters' = proto.Field( + proto.MESSAGE, + number=2, + message='X509Parameters', + ) + public_key: 'PublicKey' = proto.Field( + proto.MESSAGE, + number=3, + message='PublicKey', + ) + + +class CertificateDescription(proto.Message): + r"""A + [CertificateDescription][google.cloud.security.privateca.v1.CertificateDescription] + describes an X.509 certificate or CSR that has been issued, as an + alternative to using ASN.1 / X.509. + + Attributes: + subject_description (google.cloud.security.privateca_v1.types.CertificateDescription.SubjectDescription): + Describes some of the values in a certificate + that are related to the subject and lifetime. + x509_description (google.cloud.security.privateca_v1.types.X509Parameters): + Describes some of the technical X.509 fields + in a certificate. + public_key (google.cloud.security.privateca_v1.types.PublicKey): + The public key that corresponds to an issued + certificate. + subject_key_id (google.cloud.security.privateca_v1.types.CertificateDescription.KeyId): + Provides a means of identifiying certificates + that contain a particular public key, per + https://tools.ietf.org/html/rfc5280#section-4.2.1.2. + authority_key_id (google.cloud.security.privateca_v1.types.CertificateDescription.KeyId): + Identifies the subject_key_id of the parent certificate, per + https://tools.ietf.org/html/rfc5280#section-4.2.1.1 + crl_distribution_points (MutableSequence[str]): + Describes a list of locations to obtain CRL + information, i.e. the DistributionPoint.fullName + described by + https://tools.ietf.org/html/rfc5280#section-4.2.1.13 + aia_issuing_certificate_urls (MutableSequence[str]): + Describes lists of issuer CA certificate URLs + that appear in the "Authority Information + Access" extension in the certificate. + cert_fingerprint (google.cloud.security.privateca_v1.types.CertificateDescription.CertificateFingerprint): + The hash of the x.509 certificate. + """ + + class SubjectDescription(proto.Message): + r"""These values describe fields in an issued X.509 certificate + such as the distinguished name, subject alternative names, + serial number, and lifetime. + + Attributes: + subject (google.cloud.security.privateca_v1.types.Subject): + Contains distinguished name fields such as + the common name, location and / organization. + subject_alt_name (google.cloud.security.privateca_v1.types.SubjectAltNames): + The subject alternative name fields. + hex_serial_number (str): + The serial number encoded in lowercase + hexadecimal. + lifetime (google.protobuf.duration_pb2.Duration): + For convenience, the actual lifetime of an + issued certificate. + not_before_time (google.protobuf.timestamp_pb2.Timestamp): + The time at which the certificate becomes + valid. + not_after_time (google.protobuf.timestamp_pb2.Timestamp): + The time after which the certificate is expired. Per RFC + 5280, the validity period for a certificate is the period of + time from not_before_time through not_after_time, inclusive. + Corresponds to 'not_before_time' + 'lifetime' - 1 second. + """ + + subject: 'Subject' = proto.Field( + proto.MESSAGE, + number=1, + message='Subject', + ) + subject_alt_name: 'SubjectAltNames' = proto.Field( + proto.MESSAGE, + number=2, + message='SubjectAltNames', + ) + hex_serial_number: str = proto.Field( + proto.STRING, + number=3, + ) + lifetime: duration_pb2.Duration = proto.Field( + proto.MESSAGE, + number=4, + message=duration_pb2.Duration, + ) + not_before_time: timestamp_pb2.Timestamp = proto.Field( + proto.MESSAGE, + number=5, + message=timestamp_pb2.Timestamp, + ) + not_after_time: timestamp_pb2.Timestamp = proto.Field( + proto.MESSAGE, + number=6, + message=timestamp_pb2.Timestamp, + ) + + class KeyId(proto.Message): + r"""A KeyId identifies a specific public key, usually by hashing + the public key. + + Attributes: + key_id (str): + Optional. The value of this KeyId encoded in + lowercase hexadecimal. This is most likely the + 160 bit SHA-1 hash of the public key. + """ + + key_id: str = 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: str = proto.Field( + proto.STRING, + number=1, + ) + + subject_description: SubjectDescription = proto.Field( + proto.MESSAGE, + number=1, + message=SubjectDescription, + ) + x509_description: 'X509Parameters' = proto.Field( + proto.MESSAGE, + number=2, + message='X509Parameters', + ) + public_key: 'PublicKey' = proto.Field( + proto.MESSAGE, + number=3, + message='PublicKey', + ) + subject_key_id: KeyId = proto.Field( + proto.MESSAGE, + number=4, + message=KeyId, + ) + authority_key_id: KeyId = proto.Field( + proto.MESSAGE, + number=5, + message=KeyId, + ) + crl_distribution_points: MutableSequence[str] = proto.RepeatedField( + proto.STRING, + number=6, + ) + aia_issuing_certificate_urls: MutableSequence[str] = proto.RepeatedField( + proto.STRING, + number=7, + ) + cert_fingerprint: CertificateFingerprint = proto.Field( + proto.MESSAGE, + number=8, + message=CertificateFingerprint, + ) + + +class ObjectId(proto.Message): + r"""An [ObjectId][google.cloud.security.privateca.v1.ObjectId] specifies + an object identifier (OID). These provide context and describe types + in ASN.1 messages. + + Attributes: + object_id_path (MutableSequence[int]): + Required. The parts of an OID path. The most + significant parts of the path come first. + """ + + object_id_path: MutableSequence[int] = proto.RepeatedField( + proto.INT32, + number=1, + ) + + +class X509Extension(proto.Message): + r"""An [X509Extension][google.cloud.security.privateca.v1.X509Extension] + specifies an X.509 extension, which may be used in different parts + of X.509 objects like certificates, CSRs, and CRLs. + + Attributes: + object_id (google.cloud.security.privateca_v1.types.ObjectId): + Required. The OID for this X.509 extension. + critical (bool): + Optional. Indicates whether or not this + extension is critical (i.e., if the client does + not know how to handle this extension, the + client should consider this to be an error). + value (bytes): + Required. The value of this X.509 extension. + """ + + object_id: 'ObjectId' = proto.Field( + proto.MESSAGE, + number=1, + message='ObjectId', + ) + critical: bool = proto.Field( + proto.BOOL, + number=2, + ) + value: bytes = proto.Field( + proto.BYTES, + number=3, + ) + + +class KeyUsage(proto.Message): + r"""A [KeyUsage][google.cloud.security.privateca.v1.KeyUsage] describes + key usage values that may appear in an X.509 certificate. + + Attributes: + base_key_usage (google.cloud.security.privateca_v1.types.KeyUsage.KeyUsageOptions): + Describes high-level ways in which a key may + be used. + extended_key_usage (google.cloud.security.privateca_v1.types.KeyUsage.ExtendedKeyUsageOptions): + Detailed scenarios in which a key may be + used. + unknown_extended_key_usages (MutableSequence[google.cloud.security.privateca_v1.types.ObjectId]): + Used to describe extended key usages that are not listed in + the + [KeyUsage.ExtendedKeyUsageOptions][google.cloud.security.privateca.v1.KeyUsage.ExtendedKeyUsageOptions] + message. + """ + + class KeyUsageOptions(proto.Message): + r"""[KeyUsage.KeyUsageOptions][google.cloud.security.privateca.v1.KeyUsage.KeyUsageOptions] + corresponds to the key usage values described in + https://tools.ietf.org/html/rfc5280#section-4.2.1.3. + + Attributes: + digital_signature (bool): + The key may be used for digital signatures. + content_commitment (bool): + The key may be used for cryptographic + commitments. Note that this may also be referred + to as "non-repudiation". + key_encipherment (bool): + The key may be used to encipher other keys. + data_encipherment (bool): + The key may be used to encipher data. + key_agreement (bool): + The key may be used in a key agreement + protocol. + cert_sign (bool): + The key may be used to sign certificates. + crl_sign (bool): + The key may be used sign certificate + revocation lists. + encipher_only (bool): + The key may be used to encipher only. + decipher_only (bool): + The key may be used to decipher only. + """ + + digital_signature: bool = proto.Field( + proto.BOOL, + number=1, + ) + content_commitment: bool = proto.Field( + proto.BOOL, + number=2, + ) + key_encipherment: bool = proto.Field( + proto.BOOL, + number=3, + ) + data_encipherment: bool = proto.Field( + proto.BOOL, + number=4, + ) + key_agreement: bool = proto.Field( + proto.BOOL, + number=5, + ) + cert_sign: bool = proto.Field( + proto.BOOL, + number=6, + ) + crl_sign: bool = proto.Field( + proto.BOOL, + number=7, + ) + encipher_only: bool = proto.Field( + proto.BOOL, + number=8, + ) + decipher_only: bool = proto.Field( + proto.BOOL, + number=9, + ) + + class ExtendedKeyUsageOptions(proto.Message): + r"""[KeyUsage.ExtendedKeyUsageOptions][google.cloud.security.privateca.v1.KeyUsage.ExtendedKeyUsageOptions] + has fields that correspond to certain common OIDs that could be + specified as an extended key usage value. + + Attributes: + server_auth (bool): + Corresponds to OID 1.3.6.1.5.5.7.3.1. + Officially described as "TLS WWW server + authentication", though regularly used for + non-WWW TLS. + client_auth (bool): + Corresponds to OID 1.3.6.1.5.5.7.3.2. + Officially described as "TLS WWW client + authentication", though regularly used for + non-WWW TLS. + code_signing (bool): + Corresponds to OID 1.3.6.1.5.5.7.3.3. + Officially described as "Signing of downloadable + executable code client authentication". + email_protection (bool): + Corresponds to OID 1.3.6.1.5.5.7.3.4. + Officially described as "Email protection". + time_stamping (bool): + Corresponds to OID 1.3.6.1.5.5.7.3.8. + Officially described as "Binding the hash of an + object to a time". + ocsp_signing (bool): + Corresponds to OID 1.3.6.1.5.5.7.3.9. + Officially described as "Signing OCSP + responses". + """ + + server_auth: bool = proto.Field( + proto.BOOL, + number=1, + ) + client_auth: bool = proto.Field( + proto.BOOL, + number=2, + ) + code_signing: bool = proto.Field( + proto.BOOL, + number=3, + ) + email_protection: bool = proto.Field( + proto.BOOL, + number=4, + ) + time_stamping: bool = proto.Field( + proto.BOOL, + number=5, + ) + ocsp_signing: bool = proto.Field( + proto.BOOL, + number=6, + ) + + base_key_usage: KeyUsageOptions = proto.Field( + proto.MESSAGE, + number=1, + message=KeyUsageOptions, + ) + extended_key_usage: ExtendedKeyUsageOptions = proto.Field( + proto.MESSAGE, + number=2, + message=ExtendedKeyUsageOptions, + ) + unknown_extended_key_usages: MutableSequence['ObjectId'] = proto.RepeatedField( + proto.MESSAGE, + number=3, + message='ObjectId', + ) + + +class Subject(proto.Message): + r"""[Subject][google.cloud.security.privateca.v1.Subject] describes + parts of a distinguished name that, in turn, describes the subject + of the certificate. + + Attributes: + common_name (str): + The "common name" of the subject. + country_code (str): + The country code of the subject. + organization (str): + The organization of the subject. + organizational_unit (str): + The organizational_unit of the subject. + locality (str): + The locality or city of the subject. + province (str): + The province, territory, or regional state of + the subject. + street_address (str): + The street address of the subject. + postal_code (str): + The postal code of the subject. + """ + + common_name: str = proto.Field( + proto.STRING, + number=1, + ) + country_code: str = proto.Field( + proto.STRING, + number=2, + ) + organization: str = proto.Field( + proto.STRING, + number=3, + ) + organizational_unit: str = proto.Field( + proto.STRING, + number=4, + ) + locality: str = proto.Field( + proto.STRING, + number=5, + ) + province: str = proto.Field( + proto.STRING, + number=6, + ) + street_address: str = proto.Field( + proto.STRING, + number=7, + ) + postal_code: str = proto.Field( + proto.STRING, + number=8, + ) + + +class SubjectAltNames(proto.Message): + r"""[SubjectAltNames][google.cloud.security.privateca.v1.SubjectAltNames] + corresponds to a more modern way of listing what the asserted + identity is in a certificate (i.e., compared to the "common name" in + the distinguished name). + + Attributes: + dns_names (MutableSequence[str]): + Contains only valid, fully-qualified host + names. + uris (MutableSequence[str]): + Contains only valid RFC 3986 URIs. + email_addresses (MutableSequence[str]): + Contains only valid RFC 2822 E-mail + addresses. + ip_addresses (MutableSequence[str]): + Contains only valid 32-bit IPv4 addresses or + RFC 4291 IPv6 addresses. + custom_sans (MutableSequence[google.cloud.security.privateca_v1.types.X509Extension]): + Contains additional subject alternative name values. For + each custom_san, the ``value`` field must contain an ASN.1 + encoded UTF8String. + """ + + dns_names: MutableSequence[str] = proto.RepeatedField( + proto.STRING, + number=1, + ) + uris: MutableSequence[str] = proto.RepeatedField( + proto.STRING, + number=2, + ) + email_addresses: MutableSequence[str] = proto.RepeatedField( + proto.STRING, + number=3, + ) + ip_addresses: MutableSequence[str] = proto.RepeatedField( + proto.STRING, + number=4, + ) + custom_sans: MutableSequence['X509Extension'] = proto.RepeatedField( + proto.MESSAGE, + number=5, + message='X509Extension', + ) + + +class CertificateIdentityConstraints(proto.Message): + r"""Describes constraints on a + [Certificate][google.cloud.security.privateca.v1.Certificate]'s + [Subject][google.cloud.security.privateca.v1.Subject] and + [SubjectAltNames][google.cloud.security.privateca.v1.SubjectAltNames]. + + + .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields + + Attributes: + cel_expression (google.type.expr_pb2.Expr): + Optional. A CEL expression that may be used + to validate the resolved X.509 Subject and/or + Subject Alternative Name before a certificate is + signed. To see the full allowed syntax and some + examples, see + https://cloud.google.com/certificate-authority-service/docs/using-cel + allow_subject_passthrough (bool): + 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. + + This field is a member of `oneof`_ ``_allow_subject_passthrough``. + allow_subject_alt_names_passthrough (bool): + 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. + + This field is a member of `oneof`_ ``_allow_subject_alt_names_passthrough``. + """ + + cel_expression: expr_pb2.Expr = proto.Field( + proto.MESSAGE, + number=1, + message=expr_pb2.Expr, + ) + allow_subject_passthrough: bool = proto.Field( + proto.BOOL, + number=2, + optional=True, + ) + allow_subject_alt_names_passthrough: bool = proto.Field( + proto.BOOL, + number=3, + optional=True, + ) + + +class CertificateExtensionConstraints(proto.Message): + r"""Describes a set of X.509 extensions that may be part of some + certificate issuance controls. + + Attributes: + known_extensions (MutableSequence[google.cloud.security.privateca_v1.types.CertificateExtensionConstraints.KnownCertificateExtension]): + Optional. A set of named X.509 extensions. Will be combined + with + [additional_extensions][google.cloud.security.privateca.v1.CertificateExtensionConstraints.additional_extensions] + to determine the full set of X.509 extensions. + additional_extensions (MutableSequence[google.cloud.security.privateca_v1.types.ObjectId]): + Optional. A set of + [ObjectIds][google.cloud.security.privateca.v1.ObjectId] + identifying custom X.509 extensions. Will be combined with + [known_extensions][google.cloud.security.privateca.v1.CertificateExtensionConstraints.known_extensions] + to determine the full set of X.509 extensions. + """ + class KnownCertificateExtension(proto.Enum): + r"""Describes well-known X.509 extensions that can appear in a + [Certificate][google.cloud.security.privateca.v1.Certificate], not + including the + [SubjectAltNames][google.cloud.security.privateca.v1.SubjectAltNames] + extension. + + Values: + KNOWN_CERTIFICATE_EXTENSION_UNSPECIFIED (0): + Not specified. + BASE_KEY_USAGE (1): + Refers to a certificate's Key Usage extension, as described + in `RFC 5280 section + 4.2.1.3 `__. + This corresponds to the + [KeyUsage.base_key_usage][google.cloud.security.privateca.v1.KeyUsage.base_key_usage] + field. + EXTENDED_KEY_USAGE (2): + Refers to a certificate's Extended Key Usage extension, as + described in `RFC 5280 section + 4.2.1.12 `__. + This corresponds to the + [KeyUsage.extended_key_usage][google.cloud.security.privateca.v1.KeyUsage.extended_key_usage] + message. + CA_OPTIONS (3): + Refers to a certificate's Basic Constraints extension, as + described in `RFC 5280 section + 4.2.1.9 `__. + This corresponds to the + [X509Parameters.ca_options][google.cloud.security.privateca.v1.X509Parameters.ca_options] + field. + POLICY_IDS (4): + Refers to a certificate's Policy object identifiers, as + described in `RFC 5280 section + 4.2.1.4 `__. + This corresponds to the + [X509Parameters.policy_ids][google.cloud.security.privateca.v1.X509Parameters.policy_ids] + field. + AIA_OCSP_SERVERS (5): + Refers to OCSP servers in a certificate's Authority + Information Access extension, as described in `RFC 5280 + section + 4.2.2.1 `__, + This corresponds to the + [X509Parameters.aia_ocsp_servers][google.cloud.security.privateca.v1.X509Parameters.aia_ocsp_servers] + field. + """ + KNOWN_CERTIFICATE_EXTENSION_UNSPECIFIED = 0 + BASE_KEY_USAGE = 1 + EXTENDED_KEY_USAGE = 2 + CA_OPTIONS = 3 + POLICY_IDS = 4 + AIA_OCSP_SERVERS = 5 + + known_extensions: MutableSequence[KnownCertificateExtension] = proto.RepeatedField( + proto.ENUM, + number=1, + enum=KnownCertificateExtension, + ) + additional_extensions: MutableSequence['ObjectId'] = proto.RepeatedField( + proto.MESSAGE, + number=2, + message='ObjectId', + ) + + +__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/owl-bot-staging/v1/google/cloud/security/privateca_v1/types/service.py b/owl-bot-staging/v1/google/cloud/security/privateca_v1/types/service.py new file mode 100644 index 0000000..cc04e4a --- /dev/null +++ b/owl-bot-staging/v1/google/cloud/security/privateca_v1/types/service.py @@ -0,0 +1,1671 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +from typing import MutableMapping, MutableSequence + +import proto # type: ignore + +from google.cloud.security.privateca_v1.types import resources +from google.protobuf import field_mask_pb2 # type: ignore +from google.protobuf import timestamp_pb2 # type: ignore + + +__protobuf__ = proto.module( + package='google.cloud.security.privateca.v1', + manifest={ + 'CreateCertificateRequest', + 'GetCertificateRequest', + 'ListCertificatesRequest', + 'ListCertificatesResponse', + 'RevokeCertificateRequest', + 'UpdateCertificateRequest', + 'ActivateCertificateAuthorityRequest', + 'CreateCertificateAuthorityRequest', + 'DisableCertificateAuthorityRequest', + 'EnableCertificateAuthorityRequest', + 'FetchCertificateAuthorityCsrRequest', + 'FetchCertificateAuthorityCsrResponse', + 'GetCertificateAuthorityRequest', + 'ListCertificateAuthoritiesRequest', + 'ListCertificateAuthoritiesResponse', + 'UndeleteCertificateAuthorityRequest', + 'DeleteCertificateAuthorityRequest', + 'UpdateCertificateAuthorityRequest', + 'CreateCaPoolRequest', + 'UpdateCaPoolRequest', + 'DeleteCaPoolRequest', + 'FetchCaCertsRequest', + 'FetchCaCertsResponse', + 'GetCaPoolRequest', + 'ListCaPoolsRequest', + 'ListCaPoolsResponse', + 'GetCertificateRevocationListRequest', + 'ListCertificateRevocationListsRequest', + 'ListCertificateRevocationListsResponse', + 'UpdateCertificateRevocationListRequest', + 'CreateCertificateTemplateRequest', + 'DeleteCertificateTemplateRequest', + 'GetCertificateTemplateRequest', + 'ListCertificateTemplatesRequest', + 'ListCertificateTemplatesResponse', + 'UpdateCertificateTemplateRequest', + 'OperationMetadata', + }, +) + + +class CreateCertificateRequest(proto.Message): + r"""Request message for + [CertificateAuthorityService.CreateCertificate][google.cloud.security.privateca.v1.CertificateAuthorityService.CreateCertificate]. + + Attributes: + parent (str): + Required. The resource name of the + [CaPool][google.cloud.security.privateca.v1.CaPool] + associated with the + [Certificate][google.cloud.security.privateca.v1.Certificate], + in the format ``projects/*/locations/*/caPools/*``. + certificate_id (str): + Optional. It must be unique within a location and match the + regular expression ``[a-zA-Z0-9_-]{1,63}``. This field is + required when using a + [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority] + in the Enterprise [CertificateAuthority.Tier][], but is + optional and its value is ignored otherwise. + certificate (google.cloud.security.privateca_v1.types.Certificate): + Required. A + [Certificate][google.cloud.security.privateca.v1.Certificate] + with initial field values. + request_id (str): + Optional. An ID to identify requests. Specify + a unique request ID so that if you must retry + your request, the server will know to ignore the + request if it has already been completed. The + server will guarantee that for at least 60 + minutes since the first request. + + For example, consider a situation where you make + an initial request and the request times out. If + you make the request again with the same request + ID, the server can check if original operation + with the same request ID was received, and if + so, will ignore the second request. This + prevents clients from accidentally creating + duplicate commitments. + The request ID must be a valid UUID with the + exception that zero UUID is not supported + (00000000-0000-0000-0000-000000000000). + validate_only (bool): + Optional. If this is true, no + [Certificate][google.cloud.security.privateca.v1.Certificate] + resource will be persisted regardless of the + [CaPool][google.cloud.security.privateca.v1.CaPool]'s + [tier][google.cloud.security.privateca.v1.CaPool.tier], and + the returned + [Certificate][google.cloud.security.privateca.v1.Certificate] + will not contain the + [pem_certificate][google.cloud.security.privateca.v1.Certificate.pem_certificate] + field. + issuing_certificate_authority_id (str): + Optional. The resource ID of the + [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority] + that should issue the certificate. This optional field will + ignore the load-balancing scheme of the Pool and directly + issue the certificate from the CA with the specified ID, + contained in the same + [CaPool][google.cloud.security.privateca.v1.CaPool] + referenced by ``parent``. Per-CA quota rules apply. If left + empty, a + [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority] + will be chosen from the + [CaPool][google.cloud.security.privateca.v1.CaPool] by the + service. For example, to issue a + [Certificate][google.cloud.security.privateca.v1.Certificate] + from a Certificate Authority with resource name + "projects/my-project/locations/us-central1/caPools/my-pool/certificateAuthorities/my-ca", + you can set the + [parent][google.cloud.security.privateca.v1.CreateCertificateRequest.parent] + to + "projects/my-project/locations/us-central1/caPools/my-pool" + and the + [issuing_certificate_authority_id][google.cloud.security.privateca.v1.CreateCertificateRequest.issuing_certificate_authority_id] + to "my-ca". + """ + + parent: str = proto.Field( + proto.STRING, + number=1, + ) + certificate_id: str = proto.Field( + proto.STRING, + number=2, + ) + certificate: resources.Certificate = proto.Field( + proto.MESSAGE, + number=3, + message=resources.Certificate, + ) + request_id: str = proto.Field( + proto.STRING, + number=4, + ) + validate_only: bool = proto.Field( + proto.BOOL, + number=5, + ) + issuing_certificate_authority_id: str = proto.Field( + proto.STRING, + number=6, + ) + + +class GetCertificateRequest(proto.Message): + r"""Request message for + [CertificateAuthorityService.GetCertificate][google.cloud.security.privateca.v1.CertificateAuthorityService.GetCertificate]. + + Attributes: + name (str): + Required. The + [name][google.cloud.security.privateca.v1.Certificate.name] + of the + [Certificate][google.cloud.security.privateca.v1.Certificate] + to get. + """ + + name: str = proto.Field( + proto.STRING, + number=1, + ) + + +class ListCertificatesRequest(proto.Message): + r"""Request message for + [CertificateAuthorityService.ListCertificates][google.cloud.security.privateca.v1.CertificateAuthorityService.ListCertificates]. + + Attributes: + parent (str): + Required. The resource name of the location associated with + the + [Certificates][google.cloud.security.privateca.v1.Certificate], + in the format ``projects/*/locations/*/caPools/*``. + page_size (int): + Optional. Limit on the number of + [Certificates][google.cloud.security.privateca.v1.Certificate] + to include in the response. Further + [Certificates][google.cloud.security.privateca.v1.Certificate] + can subsequently be obtained by including the + [ListCertificatesResponse.next_page_token][google.cloud.security.privateca.v1.ListCertificatesResponse.next_page_token] + in a subsequent request. If unspecified, the server will + pick an appropriate default. + page_token (str): + Optional. Pagination token, returned earlier via + [ListCertificatesResponse.next_page_token][google.cloud.security.privateca.v1.ListCertificatesResponse.next_page_token]. + filter (str): + Optional. Only include resources that match the filter in + the response. For details on supported filters and syntax, + see `Certificates Filtering + documentation `__. + order_by (str): + Optional. Specify how the results should be sorted. For + details on supported fields and syntax, see `Certificates + Sorting + documentation `__. + """ + + parent: str = proto.Field( + proto.STRING, + number=1, + ) + page_size: int = proto.Field( + proto.INT32, + number=2, + ) + page_token: str = proto.Field( + proto.STRING, + number=3, + ) + filter: str = proto.Field( + proto.STRING, + number=4, + ) + order_by: str = proto.Field( + proto.STRING, + number=5, + ) + + +class ListCertificatesResponse(proto.Message): + r"""Response message for + [CertificateAuthorityService.ListCertificates][google.cloud.security.privateca.v1.CertificateAuthorityService.ListCertificates]. + + Attributes: + certificates (MutableSequence[google.cloud.security.privateca_v1.types.Certificate]): + The list of + [Certificates][google.cloud.security.privateca.v1.Certificate]. + next_page_token (str): + A token to retrieve next page of results. Pass this value in + [ListCertificatesRequest.next_page_token][] to retrieve the + next page of results. + unreachable (MutableSequence[str]): + A list of locations (e.g. "us-west1") that + could not be reached. + """ + + @property + def raw_page(self): + return self + + certificates: MutableSequence[resources.Certificate] = proto.RepeatedField( + proto.MESSAGE, + number=1, + message=resources.Certificate, + ) + next_page_token: str = proto.Field( + proto.STRING, + number=2, + ) + unreachable: MutableSequence[str] = proto.RepeatedField( + proto.STRING, + number=3, + ) + + +class RevokeCertificateRequest(proto.Message): + r"""Request message for + [CertificateAuthorityService.RevokeCertificate][google.cloud.security.privateca.v1.CertificateAuthorityService.RevokeCertificate]. + + Attributes: + name (str): + Required. The resource name for this + [Certificate][google.cloud.security.privateca.v1.Certificate] + in the format + ``projects/*/locations/*/caPools/*/certificates/*``. + reason (google.cloud.security.privateca_v1.types.RevocationReason): + Required. The + [RevocationReason][google.cloud.security.privateca.v1.RevocationReason] + for revoking this certificate. + request_id (str): + Optional. An ID to identify requests. Specify + a unique request ID so that if you must retry + your request, the server will know to ignore the + request if it has already been completed. The + server will guarantee that for at least 60 + minutes since the first request. + + For example, consider a situation where you make + an initial request and t he request times out. + If you make the request again with the same + request ID, the server can check if original + operation with the same request ID was received, + and if so, will ignore the second request. This + prevents clients from accidentally creating + duplicate commitments. + The request ID must be a valid UUID with the + exception that zero UUID is not supported + (00000000-0000-0000-0000-000000000000). + """ + + name: str = proto.Field( + proto.STRING, + number=1, + ) + reason: resources.RevocationReason = proto.Field( + proto.ENUM, + number=2, + enum=resources.RevocationReason, + ) + request_id: str = proto.Field( + proto.STRING, + number=3, + ) + + +class UpdateCertificateRequest(proto.Message): + r"""Request message for + [CertificateAuthorityService.UpdateCertificate][google.cloud.security.privateca.v1.CertificateAuthorityService.UpdateCertificate]. + + Attributes: + certificate (google.cloud.security.privateca_v1.types.Certificate): + Required. + [Certificate][google.cloud.security.privateca.v1.Certificate] + with updated values. + update_mask (google.protobuf.field_mask_pb2.FieldMask): + Required. A list of fields to be updated in + this request. + request_id (str): + Optional. An ID to identify requests. Specify + a unique request ID so that if you must retry + your request, the server will know to ignore the + request if it has already been completed. The + server will guarantee that for at least 60 + minutes since the first request. + + For example, consider a situation where you make + an initial request and t he request times out. + If you make the request again with the same + request ID, the server can check if original + operation with the same request ID was received, + and if so, will ignore the second request. This + prevents clients from accidentally creating + duplicate commitments. + The request ID must be a valid UUID with the + exception that zero UUID is not supported + (00000000-0000-0000-0000-000000000000). + """ + + certificate: resources.Certificate = proto.Field( + proto.MESSAGE, + number=1, + message=resources.Certificate, + ) + update_mask: field_mask_pb2.FieldMask = proto.Field( + proto.MESSAGE, + number=2, + message=field_mask_pb2.FieldMask, + ) + request_id: str = proto.Field( + proto.STRING, + number=3, + ) + + +class ActivateCertificateAuthorityRequest(proto.Message): + r"""Request message for + [CertificateAuthorityService.ActivateCertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthorityService.ActivateCertificateAuthority]. + + Attributes: + name (str): + Required. The resource name for this + [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority] + in the format + ``projects/*/locations/*/caPools/*/certificateAuthorities/*``. + pem_ca_certificate (str): + Required. The signed CA certificate issued from + [FetchCertificateAuthorityCsrResponse.pem_csr][google.cloud.security.privateca.v1.FetchCertificateAuthorityCsrResponse.pem_csr]. + subordinate_config (google.cloud.security.privateca_v1.types.SubordinateConfig): + Required. Must include information about the issuer of + 'pem_ca_certificate', and any further issuers until the + self-signed CA. + request_id (str): + Optional. An ID to identify requests. Specify + a unique request ID so that if you must retry + your request, the server will know to ignore the + request if it has already been completed. The + server will guarantee that for at least 60 + minutes since the first request. + + For example, consider a situation where you make + an initial request and t he request times out. + If you make the request again with the same + request ID, the server can check if original + operation with the same request ID was received, + and if so, will ignore the second request. This + prevents clients from accidentally creating + duplicate commitments. + The request ID must be a valid UUID with the + exception that zero UUID is not supported + (00000000-0000-0000-0000-000000000000). + """ + + name: str = proto.Field( + proto.STRING, + number=1, + ) + pem_ca_certificate: str = proto.Field( + proto.STRING, + number=2, + ) + subordinate_config: resources.SubordinateConfig = proto.Field( + proto.MESSAGE, + number=3, + message=resources.SubordinateConfig, + ) + request_id: str = proto.Field( + proto.STRING, + number=4, + ) + + +class CreateCertificateAuthorityRequest(proto.Message): + r"""Request message for + [CertificateAuthorityService.CreateCertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthorityService.CreateCertificateAuthority]. + + Attributes: + parent (str): + Required. The resource name of the + [CaPool][google.cloud.security.privateca.v1.CaPool] + associated with the + [CertificateAuthorities][google.cloud.security.privateca.v1.CertificateAuthority], + in the format ``projects/*/locations/*/caPools/*``. + certificate_authority_id (str): + Required. It must be unique within a location and match the + regular expression ``[a-zA-Z0-9_-]{1,63}`` + certificate_authority (google.cloud.security.privateca_v1.types.CertificateAuthority): + Required. A + [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority] + with initial field values. + request_id (str): + Optional. An ID to identify requests. Specify + a unique request ID so that if you must retry + your request, the server will know to ignore the + request if it has already been completed. The + server will guarantee that for at least 60 + minutes since the first request. + + For example, consider a situation where you make + an initial request and t he request times out. + If you make the request again with the same + request ID, the server can check if original + operation with the same request ID was received, + and if so, will ignore the second request. This + prevents clients from accidentally creating + duplicate commitments. + The request ID must be a valid UUID with the + exception that zero UUID is not supported + (00000000-0000-0000-0000-000000000000). + """ + + parent: str = proto.Field( + proto.STRING, + number=1, + ) + certificate_authority_id: str = proto.Field( + proto.STRING, + number=2, + ) + certificate_authority: resources.CertificateAuthority = proto.Field( + proto.MESSAGE, + number=3, + message=resources.CertificateAuthority, + ) + request_id: str = proto.Field( + proto.STRING, + number=4, + ) + + +class DisableCertificateAuthorityRequest(proto.Message): + r"""Request message for + [CertificateAuthorityService.DisableCertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthorityService.DisableCertificateAuthority]. + + Attributes: + name (str): + Required. The resource name for this + [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority] + in the format + ``projects/*/locations/*/caPools/*/certificateAuthorities/*``. + request_id (str): + Optional. An ID to identify requests. Specify + a unique request ID so that if you must retry + your request, the server will know to ignore the + request if it has already been completed. The + server will guarantee that for at least 60 + minutes since the first request. + + For example, consider a situation where you make + an initial request and t he request times out. + If you make the request again with the same + request ID, the server can check if original + operation with the same request ID was received, + and if so, will ignore the second request. This + prevents clients from accidentally creating + duplicate commitments. + The request ID must be a valid UUID with the + exception that zero UUID is not supported + (00000000-0000-0000-0000-000000000000). + """ + + name: str = proto.Field( + proto.STRING, + number=1, + ) + request_id: str = proto.Field( + proto.STRING, + number=2, + ) + + +class EnableCertificateAuthorityRequest(proto.Message): + r"""Request message for + [CertificateAuthorityService.EnableCertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthorityService.EnableCertificateAuthority]. + + Attributes: + name (str): + Required. The resource name for this + [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority] + in the format + ``projects/*/locations/*/caPools/*/certificateAuthorities/*``. + request_id (str): + Optional. An ID to identify requests. Specify + a unique request ID so that if you must retry + your request, the server will know to ignore the + request if it has already been completed. The + server will guarantee that for at least 60 + minutes since the first request. + + For example, consider a situation where you make + an initial request and t he request times out. + If you make the request again with the same + request ID, the server can check if original + operation with the same request ID was received, + and if so, will ignore the second request. This + prevents clients from accidentally creating + duplicate commitments. + The request ID must be a valid UUID with the + exception that zero UUID is not supported + (00000000-0000-0000-0000-000000000000). + """ + + name: str = proto.Field( + proto.STRING, + number=1, + ) + request_id: str = proto.Field( + proto.STRING, + number=2, + ) + + +class FetchCertificateAuthorityCsrRequest(proto.Message): + r"""Request message for + [CertificateAuthorityService.FetchCertificateAuthorityCsr][google.cloud.security.privateca.v1.CertificateAuthorityService.FetchCertificateAuthorityCsr]. + + Attributes: + name (str): + Required. The resource name for this + [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority] + in the format + ``projects/*/locations/*/caPools/*/certificateAuthorities/*``. + """ + + name: str = proto.Field( + proto.STRING, + number=1, + ) + + +class FetchCertificateAuthorityCsrResponse(proto.Message): + r"""Response message for + [CertificateAuthorityService.FetchCertificateAuthorityCsr][google.cloud.security.privateca.v1.CertificateAuthorityService.FetchCertificateAuthorityCsr]. + + Attributes: + pem_csr (str): + Output only. The PEM-encoded signed + certificate signing request (CSR). + """ + + pem_csr: str = proto.Field( + proto.STRING, + number=1, + ) + + +class GetCertificateAuthorityRequest(proto.Message): + r"""Request message for + [CertificateAuthorityService.GetCertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthorityService.GetCertificateAuthority]. + + Attributes: + name (str): + Required. The + [name][google.cloud.security.privateca.v1.CertificateAuthority.name] + of the + [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority] + to get. + """ + + name: str = proto.Field( + proto.STRING, + number=1, + ) + + +class ListCertificateAuthoritiesRequest(proto.Message): + r"""Request message for + [CertificateAuthorityService.ListCertificateAuthorities][google.cloud.security.privateca.v1.CertificateAuthorityService.ListCertificateAuthorities]. + + Attributes: + parent (str): + Required. The resource name of the + [CaPool][google.cloud.security.privateca.v1.CaPool] + associated with the + [CertificateAuthorities][google.cloud.security.privateca.v1.CertificateAuthority], + in the format ``projects/*/locations/*/caPools/*``. + page_size (int): + Optional. Limit on the number of + [CertificateAuthorities][google.cloud.security.privateca.v1.CertificateAuthority] + to include in the response. Further + [CertificateAuthorities][google.cloud.security.privateca.v1.CertificateAuthority] + can subsequently be obtained by including the + [ListCertificateAuthoritiesResponse.next_page_token][google.cloud.security.privateca.v1.ListCertificateAuthoritiesResponse.next_page_token] + in a subsequent request. If unspecified, the server will + pick an appropriate default. + page_token (str): + Optional. Pagination token, returned earlier via + [ListCertificateAuthoritiesResponse.next_page_token][google.cloud.security.privateca.v1.ListCertificateAuthoritiesResponse.next_page_token]. + filter (str): + Optional. Only include resources that match + the filter in the response. + order_by (str): + Optional. Specify how the results should be + sorted. + """ + + parent: str = proto.Field( + proto.STRING, + number=1, + ) + page_size: int = proto.Field( + proto.INT32, + number=2, + ) + page_token: str = proto.Field( + proto.STRING, + number=3, + ) + filter: str = proto.Field( + proto.STRING, + number=4, + ) + order_by: str = proto.Field( + proto.STRING, + number=5, + ) + + +class ListCertificateAuthoritiesResponse(proto.Message): + r"""Response message for + [CertificateAuthorityService.ListCertificateAuthorities][google.cloud.security.privateca.v1.CertificateAuthorityService.ListCertificateAuthorities]. + + Attributes: + certificate_authorities (MutableSequence[google.cloud.security.privateca_v1.types.CertificateAuthority]): + The list of + [CertificateAuthorities][google.cloud.security.privateca.v1.CertificateAuthority]. + next_page_token (str): + A token to retrieve next page of results. Pass this value in + [ListCertificateAuthoritiesRequest.next_page_token][] to + retrieve the next page of results. + unreachable (MutableSequence[str]): + A list of locations (e.g. "us-west1") that + could not be reached. + """ + + @property + def raw_page(self): + return self + + certificate_authorities: MutableSequence[resources.CertificateAuthority] = proto.RepeatedField( + proto.MESSAGE, + number=1, + message=resources.CertificateAuthority, + ) + next_page_token: str = proto.Field( + proto.STRING, + number=2, + ) + unreachable: MutableSequence[str] = proto.RepeatedField( + proto.STRING, + number=3, + ) + + +class UndeleteCertificateAuthorityRequest(proto.Message): + r"""Request message for + [CertificateAuthorityService.UndeleteCertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthorityService.UndeleteCertificateAuthority]. + + Attributes: + name (str): + Required. The resource name for this + [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority] + in the format + ``projects/*/locations/*/caPools/*/certificateAuthorities/*``. + request_id (str): + Optional. An ID to identify requests. Specify + a unique request ID so that if you must retry + your request, the server will know to ignore the + request if it has already been completed. The + server will guarantee that for at least 60 + minutes since the first request. + + For example, consider a situation where you make + an initial request and t he request times out. + If you make the request again with the same + request ID, the server can check if original + operation with the same request ID was received, + and if so, will ignore the second request. This + prevents clients from accidentally creating + duplicate commitments. + The request ID must be a valid UUID with the + exception that zero UUID is not supported + (00000000-0000-0000-0000-000000000000). + """ + + name: str = proto.Field( + proto.STRING, + number=1, + ) + request_id: str = proto.Field( + proto.STRING, + number=2, + ) + + +class DeleteCertificateAuthorityRequest(proto.Message): + r"""Request message for + [CertificateAuthorityService.DeleteCertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthorityService.DeleteCertificateAuthority]. + + Attributes: + name (str): + Required. The resource name for this + [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority] + in the format + ``projects/*/locations/*/caPools/*/certificateAuthorities/*``. + request_id (str): + Optional. An ID to identify requests. Specify + a unique request ID so that if you must retry + your request, the server will know to ignore the + request if it has already been completed. The + server will guarantee that for at least 60 + minutes since the first request. + + For example, consider a situation where you make + an initial request and t he request times out. + If you make the request again with the same + request ID, the server can check if original + operation with the same request ID was received, + and if so, will ignore the second request. This + prevents clients from accidentally creating + duplicate commitments. + The request ID must be a valid UUID with the + exception that zero UUID is not supported + (00000000-0000-0000-0000-000000000000). + ignore_active_certificates (bool): + Optional. This field allows the CA to be + deleted even if the CA has active certs. Active + certs include both unrevoked and unexpired + certs. + skip_grace_period (bool): + Optional. If this flag is set, the + Certificate Authority will be deleted as soon as + possible without a 30-day grace period where + undeletion would have been allowed. If you + proceed, there will be no way to recover this + CA. + """ + + name: str = proto.Field( + proto.STRING, + number=1, + ) + request_id: str = proto.Field( + proto.STRING, + number=2, + ) + ignore_active_certificates: bool = proto.Field( + proto.BOOL, + number=4, + ) + skip_grace_period: bool = proto.Field( + proto.BOOL, + number=5, + ) + + +class UpdateCertificateAuthorityRequest(proto.Message): + r"""Request message for + [CertificateAuthorityService.UpdateCertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthorityService.UpdateCertificateAuthority]. + + Attributes: + certificate_authority (google.cloud.security.privateca_v1.types.CertificateAuthority): + Required. + [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority] + with updated values. + update_mask (google.protobuf.field_mask_pb2.FieldMask): + Required. A list of fields to be updated in + this request. + request_id (str): + Optional. An ID to identify requests. Specify + a unique request ID so that if you must retry + your request, the server will know to ignore the + request if it has already been completed. The + server will guarantee that for at least 60 + minutes since the first request. + + For example, consider a situation where you make + an initial request and t he request times out. + If you make the request again with the same + request ID, the server can check if original + operation with the same request ID was received, + and if so, will ignore the second request. This + prevents clients from accidentally creating + duplicate commitments. + The request ID must be a valid UUID with the + exception that zero UUID is not supported + (00000000-0000-0000-0000-000000000000). + """ + + certificate_authority: resources.CertificateAuthority = proto.Field( + proto.MESSAGE, + number=1, + message=resources.CertificateAuthority, + ) + update_mask: field_mask_pb2.FieldMask = proto.Field( + proto.MESSAGE, + number=2, + message=field_mask_pb2.FieldMask, + ) + request_id: str = proto.Field( + proto.STRING, + number=3, + ) + + +class CreateCaPoolRequest(proto.Message): + r"""Request message for + [CertificateAuthorityService.CreateCaPool][google.cloud.security.privateca.v1.CertificateAuthorityService.CreateCaPool]. + + Attributes: + parent (str): + Required. The resource name of the location associated with + the [CaPool][google.cloud.security.privateca.v1.CaPool], in + the format ``projects/*/locations/*``. + ca_pool_id (str): + Required. It must be unique within a location and match the + regular expression ``[a-zA-Z0-9_-]{1,63}`` + ca_pool (google.cloud.security.privateca_v1.types.CaPool): + Required. A + [CaPool][google.cloud.security.privateca.v1.CaPool] with + initial field values. + request_id (str): + Optional. An ID to identify requests. Specify + a unique request ID so that if you must retry + your request, the server will know to ignore the + request if it has already been completed. The + server will guarantee that for at least 60 + minutes since the first request. + + For example, consider a situation where you make + an initial request and t he request times out. + If you make the request again with the same + request ID, the server can check if original + operation with the same request ID was received, + and if so, will ignore the second request. This + prevents clients from accidentally creating + duplicate commitments. + The request ID must be a valid UUID with the + exception that zero UUID is not supported + (00000000-0000-0000-0000-000000000000). + """ + + parent: str = proto.Field( + proto.STRING, + number=1, + ) + ca_pool_id: str = proto.Field( + proto.STRING, + number=2, + ) + ca_pool: resources.CaPool = proto.Field( + proto.MESSAGE, + number=3, + message=resources.CaPool, + ) + request_id: str = proto.Field( + proto.STRING, + number=4, + ) + + +class UpdateCaPoolRequest(proto.Message): + r"""Request message for + [CertificateAuthorityService.UpdateCaPool][google.cloud.security.privateca.v1.CertificateAuthorityService.UpdateCaPool]. + + Attributes: + ca_pool (google.cloud.security.privateca_v1.types.CaPool): + Required. + [CaPool][google.cloud.security.privateca.v1.CaPool] with + updated values. + update_mask (google.protobuf.field_mask_pb2.FieldMask): + Required. A list of fields to be updated in + this request. + request_id (str): + Optional. An ID to identify requests. Specify + a unique request ID so that if you must retry + your request, the server will know to ignore the + request if it has already been completed. The + server will guarantee that for at least 60 + minutes since the first request. + + For example, consider a situation where you make + an initial request and t he request times out. + If you make the request again with the same + request ID, the server can check if original + operation with the same request ID was received, + and if so, will ignore the second request. This + prevents clients from accidentally creating + duplicate commitments. + The request ID must be a valid UUID with the + exception that zero UUID is not supported + (00000000-0000-0000-0000-000000000000). + """ + + ca_pool: resources.CaPool = proto.Field( + proto.MESSAGE, + number=1, + message=resources.CaPool, + ) + update_mask: field_mask_pb2.FieldMask = proto.Field( + proto.MESSAGE, + number=2, + message=field_mask_pb2.FieldMask, + ) + request_id: str = proto.Field( + proto.STRING, + number=3, + ) + + +class DeleteCaPoolRequest(proto.Message): + r"""Request message for + [CertificateAuthorityService.DeleteCaPool][google.cloud.security.privateca.v1.CertificateAuthorityService.DeleteCaPool]. + + Attributes: + name (str): + Required. The resource name for this + [CaPool][google.cloud.security.privateca.v1.CaPool] in the + format ``projects/*/locations/*/caPools/*``. + request_id (str): + Optional. An ID to identify requests. Specify + a unique request ID so that if you must retry + your request, the server will know to ignore the + request if it has already been completed. The + server will guarantee that for at least 60 + minutes since the first request. + + For example, consider a situation where you make + an initial request and t he request times out. + If you make the request again with the same + request ID, the server can check if original + operation with the same request ID was received, + and if so, will ignore the second request. This + prevents clients from accidentally creating + duplicate commitments. + The request ID must be a valid UUID with the + exception that zero UUID is not supported + (00000000-0000-0000-0000-000000000000). + """ + + name: str = proto.Field( + proto.STRING, + number=1, + ) + request_id: str = proto.Field( + proto.STRING, + number=2, + ) + + +class FetchCaCertsRequest(proto.Message): + r"""Request message for + [CertificateAuthorityService.FetchCaCerts][google.cloud.security.privateca.v1.CertificateAuthorityService.FetchCaCerts]. + + Attributes: + ca_pool (str): + Required. The resource name for the + [CaPool][google.cloud.security.privateca.v1.CaPool] in the + format ``projects/*/locations/*/caPools/*``. + request_id (str): + Optional. An ID to identify requests. Specify + a unique request ID so that if you must retry + your request, the server will know to ignore the + request if it has already been completed. The + server will guarantee that for at least 60 + minutes since the first request. + + For example, consider a situation where you make + an initial request and t he request times out. + If you make the request again with the same + request ID, the server can check if original + operation with the same request ID was received, + and if so, will ignore the second request. This + prevents clients from accidentally creating + duplicate commitments. + The request ID must be a valid UUID with the + exception that zero UUID is not supported + (00000000-0000-0000-0000-000000000000). + """ + + ca_pool: str = proto.Field( + proto.STRING, + number=1, + ) + request_id: str = proto.Field( + proto.STRING, + number=2, + ) + + +class FetchCaCertsResponse(proto.Message): + r"""Response message for + [CertificateAuthorityService.FetchCaCerts][google.cloud.security.privateca.v1.CertificateAuthorityService.FetchCaCerts]. + + Attributes: + ca_certs (MutableSequence[google.cloud.security.privateca_v1.types.FetchCaCertsResponse.CertChain]): + The PEM encoded CA certificate chains of all + [ACTIVE][CertificateAuthority.State.ACTIVE] + [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority] + resources in this + [CaPool][google.cloud.security.privateca.v1.CaPool]. + """ + + class CertChain(proto.Message): + r""" + + Attributes: + certificates (MutableSequence[str]): + The certificates that form the CA chain, from + leaf to root order. + """ + + certificates: MutableSequence[str] = proto.RepeatedField( + proto.STRING, + number=1, + ) + + ca_certs: MutableSequence[CertChain] = proto.RepeatedField( + proto.MESSAGE, + number=1, + message=CertChain, + ) + + +class GetCaPoolRequest(proto.Message): + r"""Request message for + [CertificateAuthorityService.GetCaPool][google.cloud.security.privateca.v1.CertificateAuthorityService.GetCaPool]. + + Attributes: + name (str): + Required. The + [name][google.cloud.security.privateca.v1.CaPool.name] of + the [CaPool][google.cloud.security.privateca.v1.CaPool] to + get. + """ + + name: str = proto.Field( + proto.STRING, + number=1, + ) + + +class ListCaPoolsRequest(proto.Message): + r"""Request message for + [CertificateAuthorityService.ListCaPools][google.cloud.security.privateca.v1.CertificateAuthorityService.ListCaPools]. + + Attributes: + parent (str): + Required. The resource name of the location associated with + the [CaPools][google.cloud.security.privateca.v1.CaPool], in + the format ``projects/*/locations/*``. + page_size (int): + Optional. Limit on the number of + [CaPools][google.cloud.security.privateca.v1.CaPool] to + include in the response. Further + [CaPools][google.cloud.security.privateca.v1.CaPool] can + subsequently be obtained by including the + [ListCaPoolsResponse.next_page_token][google.cloud.security.privateca.v1.ListCaPoolsResponse.next_page_token] + in a subsequent request. If unspecified, the server will + pick an appropriate default. + page_token (str): + Optional. Pagination token, returned earlier via + [ListCaPoolsResponse.next_page_token][google.cloud.security.privateca.v1.ListCaPoolsResponse.next_page_token]. + filter (str): + Optional. Only include resources that match + the filter in the response. + order_by (str): + Optional. Specify how the results should be + sorted. + """ + + parent: str = proto.Field( + proto.STRING, + number=1, + ) + page_size: int = proto.Field( + proto.INT32, + number=2, + ) + page_token: str = proto.Field( + proto.STRING, + number=3, + ) + filter: str = proto.Field( + proto.STRING, + number=4, + ) + order_by: str = proto.Field( + proto.STRING, + number=5, + ) + + +class ListCaPoolsResponse(proto.Message): + r"""Response message for + [CertificateAuthorityService.ListCaPools][google.cloud.security.privateca.v1.CertificateAuthorityService.ListCaPools]. + + Attributes: + ca_pools (MutableSequence[google.cloud.security.privateca_v1.types.CaPool]): + The list of + [CaPools][google.cloud.security.privateca.v1.CaPool]. + next_page_token (str): + A token to retrieve next page of results. Pass this value in + [ListCertificateAuthoritiesRequest.next_page_token][] to + retrieve the next page of results. + unreachable (MutableSequence[str]): + A list of locations (e.g. "us-west1") that + could not be reached. + """ + + @property + def raw_page(self): + return self + + ca_pools: MutableSequence[resources.CaPool] = proto.RepeatedField( + proto.MESSAGE, + number=1, + message=resources.CaPool, + ) + next_page_token: str = proto.Field( + proto.STRING, + number=2, + ) + unreachable: MutableSequence[str] = proto.RepeatedField( + proto.STRING, + number=3, + ) + + +class GetCertificateRevocationListRequest(proto.Message): + r"""Request message for + [CertificateAuthorityService.GetCertificateRevocationList][google.cloud.security.privateca.v1.CertificateAuthorityService.GetCertificateRevocationList]. + + Attributes: + name (str): + Required. The + [name][google.cloud.security.privateca.v1.CertificateRevocationList.name] + of the + [CertificateRevocationList][google.cloud.security.privateca.v1.CertificateRevocationList] + to get. + """ + + name: str = proto.Field( + proto.STRING, + number=1, + ) + + +class ListCertificateRevocationListsRequest(proto.Message): + r"""Request message for + [CertificateAuthorityService.ListCertificateRevocationLists][google.cloud.security.privateca.v1.CertificateAuthorityService.ListCertificateRevocationLists]. + + Attributes: + parent (str): + Required. The resource name of the location associated with + the + [CertificateRevocationLists][google.cloud.security.privateca.v1.CertificateRevocationList], + in the format + ``projects/*/locations/*/caPools/*/certificateAuthorities/*``. + page_size (int): + Optional. Limit on the number of + [CertificateRevocationLists][google.cloud.security.privateca.v1.CertificateRevocationList] + to include in the response. Further + [CertificateRevocationLists][google.cloud.security.privateca.v1.CertificateRevocationList] + can subsequently be obtained by including the + [ListCertificateRevocationListsResponse.next_page_token][google.cloud.security.privateca.v1.ListCertificateRevocationListsResponse.next_page_token] + in a subsequent request. If unspecified, the server will + pick an appropriate default. + page_token (str): + Optional. Pagination token, returned earlier via + [ListCertificateRevocationListsResponse.next_page_token][google.cloud.security.privateca.v1.ListCertificateRevocationListsResponse.next_page_token]. + filter (str): + Optional. Only include resources that match + the filter in the response. + order_by (str): + Optional. Specify how the results should be + sorted. + """ + + parent: str = proto.Field( + proto.STRING, + number=1, + ) + page_size: int = proto.Field( + proto.INT32, + number=2, + ) + page_token: str = proto.Field( + proto.STRING, + number=3, + ) + filter: str = proto.Field( + proto.STRING, + number=4, + ) + order_by: str = proto.Field( + proto.STRING, + number=5, + ) + + +class ListCertificateRevocationListsResponse(proto.Message): + r"""Response message for + [CertificateAuthorityService.ListCertificateRevocationLists][google.cloud.security.privateca.v1.CertificateAuthorityService.ListCertificateRevocationLists]. + + Attributes: + certificate_revocation_lists (MutableSequence[google.cloud.security.privateca_v1.types.CertificateRevocationList]): + The list of + [CertificateRevocationLists][google.cloud.security.privateca.v1.CertificateRevocationList]. + next_page_token (str): + A token to retrieve next page of results. Pass this value in + [ListCertificateRevocationListsRequest.next_page_token][] to + retrieve the next page of results. + unreachable (MutableSequence[str]): + A list of locations (e.g. "us-west1") that + could not be reached. + """ + + @property + def raw_page(self): + return self + + certificate_revocation_lists: MutableSequence[resources.CertificateRevocationList] = proto.RepeatedField( + proto.MESSAGE, + number=1, + message=resources.CertificateRevocationList, + ) + next_page_token: str = proto.Field( + proto.STRING, + number=2, + ) + unreachable: MutableSequence[str] = proto.RepeatedField( + proto.STRING, + number=3, + ) + + +class UpdateCertificateRevocationListRequest(proto.Message): + r"""Request message for + [CertificateAuthorityService.UpdateCertificateRevocationList][google.cloud.security.privateca.v1.CertificateAuthorityService.UpdateCertificateRevocationList]. + + Attributes: + certificate_revocation_list (google.cloud.security.privateca_v1.types.CertificateRevocationList): + Required. + [CertificateRevocationList][google.cloud.security.privateca.v1.CertificateRevocationList] + with updated values. + update_mask (google.protobuf.field_mask_pb2.FieldMask): + Required. A list of fields to be updated in + this request. + request_id (str): + Optional. An ID to identify requests. Specify + a unique request ID so that if you must retry + your request, the server will know to ignore the + request if it has already been completed. The + server will guarantee that for at least 60 + minutes since the first request. + + For example, consider a situation where you make + an initial request and t he request times out. + If you make the request again with the same + request ID, the server can check if original + operation with the same request ID was received, + and if so, will ignore the second request. This + prevents clients from accidentally creating + duplicate commitments. + The request ID must be a valid UUID with the + exception that zero UUID is not supported + (00000000-0000-0000-0000-000000000000). + """ + + certificate_revocation_list: resources.CertificateRevocationList = proto.Field( + proto.MESSAGE, + number=1, + message=resources.CertificateRevocationList, + ) + update_mask: field_mask_pb2.FieldMask = proto.Field( + proto.MESSAGE, + number=2, + message=field_mask_pb2.FieldMask, + ) + request_id: str = proto.Field( + proto.STRING, + number=3, + ) + + +class CreateCertificateTemplateRequest(proto.Message): + r"""Request message for + [CertificateAuthorityService.CreateCertificateTemplate][google.cloud.security.privateca.v1.CertificateAuthorityService.CreateCertificateTemplate]. + + Attributes: + parent (str): + Required. The resource name of the location associated with + the + [CertificateTemplate][google.cloud.security.privateca.v1.CertificateTemplate], + in the format ``projects/*/locations/*``. + certificate_template_id (str): + Required. It must be unique within a location and match the + regular expression ``[a-zA-Z0-9_-]{1,63}`` + certificate_template (google.cloud.security.privateca_v1.types.CertificateTemplate): + Required. A + [CertificateTemplate][google.cloud.security.privateca.v1.CertificateTemplate] + with initial field values. + request_id (str): + Optional. An ID to identify requests. Specify + a unique request ID so that if you must retry + your request, the server will know to ignore the + request if it has already been completed. The + server will guarantee that for at least 60 + minutes since the first request. + + For example, consider a situation where you make + an initial request and t he request times out. + If you make the request again with the same + request ID, the server can check if original + operation with the same request ID was received, + and if so, will ignore the second request. This + prevents clients from accidentally creating + duplicate commitments. + The request ID must be a valid UUID with the + exception that zero UUID is not supported + (00000000-0000-0000-0000-000000000000). + """ + + parent: str = proto.Field( + proto.STRING, + number=1, + ) + certificate_template_id: str = proto.Field( + proto.STRING, + number=2, + ) + certificate_template: resources.CertificateTemplate = proto.Field( + proto.MESSAGE, + number=3, + message=resources.CertificateTemplate, + ) + request_id: str = proto.Field( + proto.STRING, + number=4, + ) + + +class DeleteCertificateTemplateRequest(proto.Message): + r"""Request message for + [CertificateAuthorityService.DeleteCertificateTemplate][google.cloud.security.privateca.v1.CertificateAuthorityService.DeleteCertificateTemplate]. + + Attributes: + name (str): + Required. The resource name for this + [CertificateTemplate][google.cloud.security.privateca.v1.CertificateTemplate] + in the format + ``projects/*/locations/*/certificateTemplates/*``. + request_id (str): + Optional. An ID to identify requests. Specify + a unique request ID so that if you must retry + your request, the server will know to ignore the + request if it has already been completed. The + server will guarantee that for at least 60 + minutes since the first request. + + For example, consider a situation where you make + an initial request and t he request times out. + If you make the request again with the same + request ID, the server can check if original + operation with the same request ID was received, + and if so, will ignore the second request. This + prevents clients from accidentally creating + duplicate commitments. + The request ID must be a valid UUID with the + exception that zero UUID is not supported + (00000000-0000-0000-0000-000000000000). + """ + + name: str = proto.Field( + proto.STRING, + number=1, + ) + request_id: str = proto.Field( + proto.STRING, + number=2, + ) + + +class GetCertificateTemplateRequest(proto.Message): + r"""Request message for + [CertificateAuthorityService.GetCertificateTemplate][google.cloud.security.privateca.v1.CertificateAuthorityService.GetCertificateTemplate]. + + Attributes: + name (str): + Required. The + [name][google.cloud.security.privateca.v1.CertificateTemplate.name] + of the + [CertificateTemplate][google.cloud.security.privateca.v1.CertificateTemplate] + to get. + """ + + name: str = proto.Field( + proto.STRING, + number=1, + ) + + +class ListCertificateTemplatesRequest(proto.Message): + r"""Request message for + [CertificateAuthorityService.ListCertificateTemplates][google.cloud.security.privateca.v1.CertificateAuthorityService.ListCertificateTemplates]. + + Attributes: + parent (str): + Required. The resource name of the location associated with + the + [CertificateTemplates][google.cloud.security.privateca.v1.CertificateTemplate], + in the format ``projects/*/locations/*``. + page_size (int): + Optional. Limit on the number of + [CertificateTemplates][google.cloud.security.privateca.v1.CertificateTemplate] + to include in the response. Further + [CertificateTemplates][google.cloud.security.privateca.v1.CertificateTemplate] + can subsequently be obtained by including the + [ListCertificateTemplatesResponse.next_page_token][google.cloud.security.privateca.v1.ListCertificateTemplatesResponse.next_page_token] + in a subsequent request. If unspecified, the server will + pick an appropriate default. + page_token (str): + Optional. Pagination token, returned earlier via + [ListCertificateTemplatesResponse.next_page_token][google.cloud.security.privateca.v1.ListCertificateTemplatesResponse.next_page_token]. + filter (str): + Optional. Only include resources that match + the filter in the response. + order_by (str): + Optional. Specify how the results should be + sorted. + """ + + parent: str = proto.Field( + proto.STRING, + number=1, + ) + page_size: int = proto.Field( + proto.INT32, + number=2, + ) + page_token: str = proto.Field( + proto.STRING, + number=3, + ) + filter: str = proto.Field( + proto.STRING, + number=4, + ) + order_by: str = proto.Field( + proto.STRING, + number=5, + ) + + +class ListCertificateTemplatesResponse(proto.Message): + r"""Response message for + [CertificateAuthorityService.ListCertificateTemplates][google.cloud.security.privateca.v1.CertificateAuthorityService.ListCertificateTemplates]. + + Attributes: + certificate_templates (MutableSequence[google.cloud.security.privateca_v1.types.CertificateTemplate]): + The list of + [CertificateTemplates][google.cloud.security.privateca.v1.CertificateTemplate]. + next_page_token (str): + A token to retrieve next page of results. Pass this value in + [ListCertificateTemplatesRequest.next_page_token][] to + retrieve the next page of results. + unreachable (MutableSequence[str]): + A list of locations (e.g. "us-west1") that + could not be reached. + """ + + @property + def raw_page(self): + return self + + certificate_templates: MutableSequence[resources.CertificateTemplate] = proto.RepeatedField( + proto.MESSAGE, + number=1, + message=resources.CertificateTemplate, + ) + next_page_token: str = proto.Field( + proto.STRING, + number=2, + ) + unreachable: MutableSequence[str] = proto.RepeatedField( + proto.STRING, + number=3, + ) + + +class UpdateCertificateTemplateRequest(proto.Message): + r"""Request message for + [CertificateAuthorityService.UpdateCertificateTemplate][google.cloud.security.privateca.v1.CertificateAuthorityService.UpdateCertificateTemplate]. + + Attributes: + certificate_template (google.cloud.security.privateca_v1.types.CertificateTemplate): + Required. + [CertificateTemplate][google.cloud.security.privateca.v1.CertificateTemplate] + with updated values. + update_mask (google.protobuf.field_mask_pb2.FieldMask): + Required. A list of fields to be updated in + this request. + request_id (str): + Optional. An ID to identify requests. Specify + a unique request ID so that if you must retry + your request, the server will know to ignore the + request if it has already been completed. The + server will guarantee that for at least 60 + minutes since the first request. + + For example, consider a situation where you make + an initial request and t he request times out. + If you make the request again with the same + request ID, the server can check if original + operation with the same request ID was received, + and if so, will ignore the second request. This + prevents clients from accidentally creating + duplicate commitments. + The request ID must be a valid UUID with the + exception that zero UUID is not supported + (00000000-0000-0000-0000-000000000000). + """ + + certificate_template: resources.CertificateTemplate = proto.Field( + proto.MESSAGE, + number=1, + message=resources.CertificateTemplate, + ) + update_mask: field_mask_pb2.FieldMask = proto.Field( + proto.MESSAGE, + number=2, + message=field_mask_pb2.FieldMask, + ) + request_id: str = 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 + created. + end_time (google.protobuf.timestamp_pb2.Timestamp): + Output only. The time the operation finished + running. + target (str): + Output only. Server-defined resource path for + the target of the operation. + verb (str): + Output only. Name of the verb executed by the + operation. + status_message (str): + Output only. Human-readable status of the + operation, if any. + requested_cancellation (bool): + Output only. Identifies whether the user has requested + cancellation of the operation. Operations that have + successfully been cancelled have [Operation.error][] value + with a [google.rpc.Status.code][google.rpc.Status.code] of + 1, corresponding to ``Code.CANCELLED``. + api_version (str): + Output only. API version used to start the + operation. + """ + + create_time: timestamp_pb2.Timestamp = proto.Field( + proto.MESSAGE, + number=1, + message=timestamp_pb2.Timestamp, + ) + end_time: timestamp_pb2.Timestamp = proto.Field( + proto.MESSAGE, + number=2, + message=timestamp_pb2.Timestamp, + ) + target: str = proto.Field( + proto.STRING, + number=3, + ) + verb: str = proto.Field( + proto.STRING, + number=4, + ) + status_message: str = proto.Field( + proto.STRING, + number=5, + ) + requested_cancellation: bool = proto.Field( + proto.BOOL, + number=6, + ) + api_version: str = proto.Field( + proto.STRING, + number=7, + ) + + +__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/owl-bot-staging/v1/mypy.ini b/owl-bot-staging/v1/mypy.ini new file mode 100644 index 0000000..574c5ae --- /dev/null +++ b/owl-bot-staging/v1/mypy.ini @@ -0,0 +1,3 @@ +[mypy] +python_version = 3.7 +namespace_packages = True diff --git a/owl-bot-staging/v1/noxfile.py b/owl-bot-staging/v1/noxfile.py new file mode 100644 index 0000000..ffd32a7 --- /dev/null +++ b/owl-bot-staging/v1/noxfile.py @@ -0,0 +1,184 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +import os +import pathlib +import shutil +import subprocess +import sys + + +import nox # type: ignore + +ALL_PYTHON = [ + "3.7", + "3.8", + "3.9", + "3.10", + "3.11", +] + +CURRENT_DIRECTORY = pathlib.Path(__file__).parent.absolute() + +LOWER_BOUND_CONSTRAINTS_FILE = CURRENT_DIRECTORY / "constraints.txt" +PACKAGE_NAME = subprocess.check_output([sys.executable, "setup.py", "--name"], encoding="utf-8") + +BLACK_VERSION = "black==22.3.0" +BLACK_PATHS = ["docs", "google", "tests", "samples", "noxfile.py", "setup.py"] +DEFAULT_PYTHON_VERSION = "3.11" + +nox.sessions = [ + "unit", + "cover", + "mypy", + "check_lower_bounds" + # exclude update_lower_bounds from default + "docs", + "blacken", + "lint", + "lint_setup_py", +] + +@nox.session(python=ALL_PYTHON) +def unit(session): + """Run the unit test suite.""" + + session.install('coverage', 'pytest', 'pytest-cov', 'pytest-asyncio', 'asyncmock; python_version < "3.8"') + session.install('-e', '.') + + session.run( + 'py.test', + '--quiet', + '--cov=google/cloud/security/privateca_v1/', + '--cov=tests/', + '--cov-config=.coveragerc', + '--cov-report=term', + '--cov-report=html', + os.path.join('tests', 'unit', ''.join(session.posargs)) + ) + + +@nox.session(python=DEFAULT_PYTHON_VERSION) +def cover(session): + """Run the final coverage report. + This outputs the coverage report aggregating coverage from the unit + test runs (not system test runs), and then erases coverage data. + """ + session.install("coverage", "pytest-cov") + session.run("coverage", "report", "--show-missing", "--fail-under=100") + + session.run("coverage", "erase") + + +@nox.session(python=ALL_PYTHON) +def mypy(session): + """Run the type checker.""" + session.install( + 'mypy', + 'types-requests', + 'types-protobuf' + ) + session.install('.') + session.run( + 'mypy', + '--explicit-package-bases', + 'google', + ) + + +@nox.session +def update_lower_bounds(session): + """Update lower bounds in constraints.txt to match setup.py""" + session.install('google-cloud-testutils') + session.install('.') + + session.run( + 'lower-bound-checker', + 'update', + '--package-name', + PACKAGE_NAME, + '--constraints-file', + str(LOWER_BOUND_CONSTRAINTS_FILE), + ) + + +@nox.session +def check_lower_bounds(session): + """Check lower bounds in setup.py are reflected in constraints file""" + session.install('google-cloud-testutils') + session.install('.') + + session.run( + 'lower-bound-checker', + 'check', + '--package-name', + PACKAGE_NAME, + '--constraints-file', + str(LOWER_BOUND_CONSTRAINTS_FILE), + ) + +@nox.session(python=DEFAULT_PYTHON_VERSION) +def docs(session): + """Build the docs for this library.""" + + session.install("-e", ".") + session.install("sphinx==4.0.1", "alabaster", "recommonmark") + + shutil.rmtree(os.path.join("docs", "_build"), ignore_errors=True) + session.run( + "sphinx-build", + "-W", # warnings as errors + "-T", # show full traceback on exception + "-N", # no colors + "-b", + "html", + "-d", + os.path.join("docs", "_build", "doctrees", ""), + os.path.join("docs", ""), + os.path.join("docs", "_build", "html", ""), + ) + + +@nox.session(python=DEFAULT_PYTHON_VERSION) +def lint(session): + """Run linters. + + Returns a failure if the linters find linting errors or sufficiently + serious code quality issues. + """ + session.install("flake8", BLACK_VERSION) + session.run( + "black", + "--check", + *BLACK_PATHS, + ) + session.run("flake8", "google", "tests", "samples") + + +@nox.session(python=DEFAULT_PYTHON_VERSION) +def blacken(session): + """Run black. Format code to uniform standard.""" + session.install(BLACK_VERSION) + session.run( + "black", + *BLACK_PATHS, + ) + + +@nox.session(python=DEFAULT_PYTHON_VERSION) +def lint_setup_py(session): + """Verify that setup.py is valid (including RST check).""" + session.install("docutils", "pygments") + session.run("python", "setup.py", "check", "--restructuredtext", "--strict") diff --git a/owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_activate_certificate_authority_async.py b/owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_activate_certificate_authority_async.py new file mode 100644 index 0000000..2d9a827 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_activate_certificate_authority_async.py @@ -0,0 +1,61 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for ActivateCertificateAuthority +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-private-ca + + +# [START privateca_v1_generated_CertificateAuthorityService_ActivateCertificateAuthority_async] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud.security import privateca_v1 + + +async def sample_activate_certificate_authority(): + # Create a client + client = privateca_v1.CertificateAuthorityServiceAsyncClient() + + # Initialize request argument(s) + subordinate_config = privateca_v1.SubordinateConfig() + subordinate_config.certificate_authority = "certificate_authority_value" + + request = privateca_v1.ActivateCertificateAuthorityRequest( + name="name_value", + pem_ca_certificate="pem_ca_certificate_value", + subordinate_config=subordinate_config, + ) + + # Make the request + operation = client.activate_certificate_authority(request=request) + + print("Waiting for operation to complete...") + + response = (await operation).result() + + # Handle the response + print(response) + +# [END privateca_v1_generated_CertificateAuthorityService_ActivateCertificateAuthority_async] diff --git a/owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_activate_certificate_authority_sync.py b/owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_activate_certificate_authority_sync.py new file mode 100644 index 0000000..481e240 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_activate_certificate_authority_sync.py @@ -0,0 +1,61 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for ActivateCertificateAuthority +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-private-ca + + +# [START privateca_v1_generated_CertificateAuthorityService_ActivateCertificateAuthority_sync] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud.security import privateca_v1 + + +def sample_activate_certificate_authority(): + # Create a client + client = privateca_v1.CertificateAuthorityServiceClient() + + # Initialize request argument(s) + subordinate_config = privateca_v1.SubordinateConfig() + subordinate_config.certificate_authority = "certificate_authority_value" + + request = privateca_v1.ActivateCertificateAuthorityRequest( + name="name_value", + pem_ca_certificate="pem_ca_certificate_value", + subordinate_config=subordinate_config, + ) + + # Make the request + operation = client.activate_certificate_authority(request=request) + + print("Waiting for operation to complete...") + + response = operation.result() + + # Handle the response + print(response) + +# [END privateca_v1_generated_CertificateAuthorityService_ActivateCertificateAuthority_sync] diff --git a/owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_create_ca_pool_async.py b/owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_create_ca_pool_async.py new file mode 100644 index 0000000..47d8176 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_create_ca_pool_async.py @@ -0,0 +1,61 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for CreateCaPool +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-private-ca + + +# [START privateca_v1_generated_CertificateAuthorityService_CreateCaPool_async] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud.security import privateca_v1 + + +async def sample_create_ca_pool(): + # Create a client + client = privateca_v1.CertificateAuthorityServiceAsyncClient() + + # Initialize request argument(s) + ca_pool = privateca_v1.CaPool() + ca_pool.tier = "DEVOPS" + + request = privateca_v1.CreateCaPoolRequest( + parent="parent_value", + ca_pool_id="ca_pool_id_value", + ca_pool=ca_pool, + ) + + # Make the request + operation = client.create_ca_pool(request=request) + + print("Waiting for operation to complete...") + + response = (await operation).result() + + # Handle the response + print(response) + +# [END privateca_v1_generated_CertificateAuthorityService_CreateCaPool_async] diff --git a/owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_create_ca_pool_sync.py b/owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_create_ca_pool_sync.py new file mode 100644 index 0000000..c9d01e2 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_create_ca_pool_sync.py @@ -0,0 +1,61 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for CreateCaPool +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-private-ca + + +# [START privateca_v1_generated_CertificateAuthorityService_CreateCaPool_sync] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud.security import privateca_v1 + + +def sample_create_ca_pool(): + # Create a client + client = privateca_v1.CertificateAuthorityServiceClient() + + # Initialize request argument(s) + ca_pool = privateca_v1.CaPool() + ca_pool.tier = "DEVOPS" + + request = privateca_v1.CreateCaPoolRequest( + parent="parent_value", + ca_pool_id="ca_pool_id_value", + ca_pool=ca_pool, + ) + + # Make the request + operation = client.create_ca_pool(request=request) + + print("Waiting for operation to complete...") + + response = operation.result() + + # Handle the response + print(response) + +# [END privateca_v1_generated_CertificateAuthorityService_CreateCaPool_sync] diff --git a/owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_create_certificate_async.py b/owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_create_certificate_async.py new file mode 100644 index 0000000..fbdd1d5 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_create_certificate_async.py @@ -0,0 +1,56 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for CreateCertificate +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-private-ca + + +# [START privateca_v1_generated_CertificateAuthorityService_CreateCertificate_async] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud.security import privateca_v1 + + +async def sample_create_certificate(): + # Create a client + client = privateca_v1.CertificateAuthorityServiceAsyncClient() + + # Initialize request argument(s) + certificate = privateca_v1.Certificate() + certificate.pem_csr = "pem_csr_value" + + request = privateca_v1.CreateCertificateRequest( + parent="parent_value", + certificate=certificate, + ) + + # Make the request + response = await client.create_certificate(request=request) + + # Handle the response + print(response) + +# [END privateca_v1_generated_CertificateAuthorityService_CreateCertificate_async] diff --git a/owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_create_certificate_authority_async.py b/owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_create_certificate_authority_async.py new file mode 100644 index 0000000..3364910 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_create_certificate_authority_async.py @@ -0,0 +1,62 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for CreateCertificateAuthority +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-private-ca + + +# [START privateca_v1_generated_CertificateAuthorityService_CreateCertificateAuthority_async] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud.security import privateca_v1 + + +async def sample_create_certificate_authority(): + # Create a client + client = privateca_v1.CertificateAuthorityServiceAsyncClient() + + # Initialize request argument(s) + certificate_authority = privateca_v1.CertificateAuthority() + certificate_authority.type_ = "SUBORDINATE" + certificate_authority.key_spec.cloud_kms_key_version = "cloud_kms_key_version_value" + + request = privateca_v1.CreateCertificateAuthorityRequest( + parent="parent_value", + certificate_authority_id="certificate_authority_id_value", + certificate_authority=certificate_authority, + ) + + # Make the request + operation = client.create_certificate_authority(request=request) + + print("Waiting for operation to complete...") + + response = (await operation).result() + + # Handle the response + print(response) + +# [END privateca_v1_generated_CertificateAuthorityService_CreateCertificateAuthority_async] diff --git a/owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_create_certificate_authority_sync.py b/owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_create_certificate_authority_sync.py new file mode 100644 index 0000000..5da1b58 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_create_certificate_authority_sync.py @@ -0,0 +1,62 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for CreateCertificateAuthority +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-private-ca + + +# [START privateca_v1_generated_CertificateAuthorityService_CreateCertificateAuthority_sync] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud.security import privateca_v1 + + +def sample_create_certificate_authority(): + # Create a client + client = privateca_v1.CertificateAuthorityServiceClient() + + # Initialize request argument(s) + certificate_authority = privateca_v1.CertificateAuthority() + certificate_authority.type_ = "SUBORDINATE" + certificate_authority.key_spec.cloud_kms_key_version = "cloud_kms_key_version_value" + + request = privateca_v1.CreateCertificateAuthorityRequest( + parent="parent_value", + certificate_authority_id="certificate_authority_id_value", + certificate_authority=certificate_authority, + ) + + # Make the request + operation = client.create_certificate_authority(request=request) + + print("Waiting for operation to complete...") + + response = operation.result() + + # Handle the response + print(response) + +# [END privateca_v1_generated_CertificateAuthorityService_CreateCertificateAuthority_sync] diff --git a/owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_create_certificate_sync.py b/owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_create_certificate_sync.py new file mode 100644 index 0000000..c9a50c8 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_create_certificate_sync.py @@ -0,0 +1,56 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for CreateCertificate +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-private-ca + + +# [START privateca_v1_generated_CertificateAuthorityService_CreateCertificate_sync] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud.security import privateca_v1 + + +def sample_create_certificate(): + # Create a client + client = privateca_v1.CertificateAuthorityServiceClient() + + # Initialize request argument(s) + certificate = privateca_v1.Certificate() + certificate.pem_csr = "pem_csr_value" + + request = privateca_v1.CreateCertificateRequest( + parent="parent_value", + certificate=certificate, + ) + + # Make the request + response = client.create_certificate(request=request) + + # Handle the response + print(response) + +# [END privateca_v1_generated_CertificateAuthorityService_CreateCertificate_sync] diff --git a/owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_create_certificate_template_async.py b/owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_create_certificate_template_async.py new file mode 100644 index 0000000..077af94 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_create_certificate_template_async.py @@ -0,0 +1,57 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for CreateCertificateTemplate +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-private-ca + + +# [START privateca_v1_generated_CertificateAuthorityService_CreateCertificateTemplate_async] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud.security import privateca_v1 + + +async def sample_create_certificate_template(): + # Create a client + client = privateca_v1.CertificateAuthorityServiceAsyncClient() + + # Initialize request argument(s) + request = privateca_v1.CreateCertificateTemplateRequest( + parent="parent_value", + certificate_template_id="certificate_template_id_value", + ) + + # Make the request + operation = client.create_certificate_template(request=request) + + print("Waiting for operation to complete...") + + response = (await operation).result() + + # Handle the response + print(response) + +# [END privateca_v1_generated_CertificateAuthorityService_CreateCertificateTemplate_async] diff --git a/owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_create_certificate_template_sync.py b/owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_create_certificate_template_sync.py new file mode 100644 index 0000000..3a50d32 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_create_certificate_template_sync.py @@ -0,0 +1,57 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for CreateCertificateTemplate +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-private-ca + + +# [START privateca_v1_generated_CertificateAuthorityService_CreateCertificateTemplate_sync] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud.security import privateca_v1 + + +def sample_create_certificate_template(): + # Create a client + client = privateca_v1.CertificateAuthorityServiceClient() + + # Initialize request argument(s) + request = privateca_v1.CreateCertificateTemplateRequest( + parent="parent_value", + certificate_template_id="certificate_template_id_value", + ) + + # Make the request + operation = client.create_certificate_template(request=request) + + print("Waiting for operation to complete...") + + response = operation.result() + + # Handle the response + print(response) + +# [END privateca_v1_generated_CertificateAuthorityService_CreateCertificateTemplate_sync] diff --git a/owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_delete_ca_pool_async.py b/owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_delete_ca_pool_async.py new file mode 100644 index 0000000..73f21f9 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_delete_ca_pool_async.py @@ -0,0 +1,56 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for DeleteCaPool +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-private-ca + + +# [START privateca_v1_generated_CertificateAuthorityService_DeleteCaPool_async] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud.security import privateca_v1 + + +async def sample_delete_ca_pool(): + # Create a client + client = privateca_v1.CertificateAuthorityServiceAsyncClient() + + # Initialize request argument(s) + request = privateca_v1.DeleteCaPoolRequest( + name="name_value", + ) + + # Make the request + operation = client.delete_ca_pool(request=request) + + print("Waiting for operation to complete...") + + response = (await operation).result() + + # Handle the response + print(response) + +# [END privateca_v1_generated_CertificateAuthorityService_DeleteCaPool_async] diff --git a/owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_delete_ca_pool_sync.py b/owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_delete_ca_pool_sync.py new file mode 100644 index 0000000..eda61b0 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_delete_ca_pool_sync.py @@ -0,0 +1,56 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for DeleteCaPool +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-private-ca + + +# [START privateca_v1_generated_CertificateAuthorityService_DeleteCaPool_sync] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud.security import privateca_v1 + + +def sample_delete_ca_pool(): + # Create a client + client = privateca_v1.CertificateAuthorityServiceClient() + + # Initialize request argument(s) + request = privateca_v1.DeleteCaPoolRequest( + name="name_value", + ) + + # Make the request + operation = client.delete_ca_pool(request=request) + + print("Waiting for operation to complete...") + + response = operation.result() + + # Handle the response + print(response) + +# [END privateca_v1_generated_CertificateAuthorityService_DeleteCaPool_sync] diff --git a/owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_delete_certificate_authority_async.py b/owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_delete_certificate_authority_async.py new file mode 100644 index 0000000..12ad27b --- /dev/null +++ b/owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_delete_certificate_authority_async.py @@ -0,0 +1,56 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for DeleteCertificateAuthority +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-private-ca + + +# [START privateca_v1_generated_CertificateAuthorityService_DeleteCertificateAuthority_async] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud.security import privateca_v1 + + +async def sample_delete_certificate_authority(): + # Create a client + client = privateca_v1.CertificateAuthorityServiceAsyncClient() + + # Initialize request argument(s) + request = privateca_v1.DeleteCertificateAuthorityRequest( + name="name_value", + ) + + # Make the request + operation = client.delete_certificate_authority(request=request) + + print("Waiting for operation to complete...") + + response = (await operation).result() + + # Handle the response + print(response) + +# [END privateca_v1_generated_CertificateAuthorityService_DeleteCertificateAuthority_async] diff --git a/owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_delete_certificate_authority_sync.py b/owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_delete_certificate_authority_sync.py new file mode 100644 index 0000000..7ae0813 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_delete_certificate_authority_sync.py @@ -0,0 +1,56 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for DeleteCertificateAuthority +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-private-ca + + +# [START privateca_v1_generated_CertificateAuthorityService_DeleteCertificateAuthority_sync] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud.security import privateca_v1 + + +def sample_delete_certificate_authority(): + # Create a client + client = privateca_v1.CertificateAuthorityServiceClient() + + # Initialize request argument(s) + request = privateca_v1.DeleteCertificateAuthorityRequest( + name="name_value", + ) + + # Make the request + operation = client.delete_certificate_authority(request=request) + + print("Waiting for operation to complete...") + + response = operation.result() + + # Handle the response + print(response) + +# [END privateca_v1_generated_CertificateAuthorityService_DeleteCertificateAuthority_sync] diff --git a/owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_delete_certificate_template_async.py b/owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_delete_certificate_template_async.py new file mode 100644 index 0000000..8f38739 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_delete_certificate_template_async.py @@ -0,0 +1,56 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for DeleteCertificateTemplate +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-private-ca + + +# [START privateca_v1_generated_CertificateAuthorityService_DeleteCertificateTemplate_async] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud.security import privateca_v1 + + +async def sample_delete_certificate_template(): + # Create a client + client = privateca_v1.CertificateAuthorityServiceAsyncClient() + + # Initialize request argument(s) + request = privateca_v1.DeleteCertificateTemplateRequest( + name="name_value", + ) + + # Make the request + operation = client.delete_certificate_template(request=request) + + print("Waiting for operation to complete...") + + response = (await operation).result() + + # Handle the response + print(response) + +# [END privateca_v1_generated_CertificateAuthorityService_DeleteCertificateTemplate_async] diff --git a/owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_delete_certificate_template_sync.py b/owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_delete_certificate_template_sync.py new file mode 100644 index 0000000..f7d352b --- /dev/null +++ b/owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_delete_certificate_template_sync.py @@ -0,0 +1,56 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for DeleteCertificateTemplate +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-private-ca + + +# [START privateca_v1_generated_CertificateAuthorityService_DeleteCertificateTemplate_sync] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud.security import privateca_v1 + + +def sample_delete_certificate_template(): + # Create a client + client = privateca_v1.CertificateAuthorityServiceClient() + + # Initialize request argument(s) + request = privateca_v1.DeleteCertificateTemplateRequest( + name="name_value", + ) + + # Make the request + operation = client.delete_certificate_template(request=request) + + print("Waiting for operation to complete...") + + response = operation.result() + + # Handle the response + print(response) + +# [END privateca_v1_generated_CertificateAuthorityService_DeleteCertificateTemplate_sync] diff --git a/owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_disable_certificate_authority_async.py b/owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_disable_certificate_authority_async.py new file mode 100644 index 0000000..a60c3c6 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_disable_certificate_authority_async.py @@ -0,0 +1,56 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for DisableCertificateAuthority +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-private-ca + + +# [START privateca_v1_generated_CertificateAuthorityService_DisableCertificateAuthority_async] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud.security import privateca_v1 + + +async def sample_disable_certificate_authority(): + # Create a client + client = privateca_v1.CertificateAuthorityServiceAsyncClient() + + # Initialize request argument(s) + request = privateca_v1.DisableCertificateAuthorityRequest( + name="name_value", + ) + + # Make the request + operation = client.disable_certificate_authority(request=request) + + print("Waiting for operation to complete...") + + response = (await operation).result() + + # Handle the response + print(response) + +# [END privateca_v1_generated_CertificateAuthorityService_DisableCertificateAuthority_async] diff --git a/owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_disable_certificate_authority_sync.py b/owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_disable_certificate_authority_sync.py new file mode 100644 index 0000000..90e7039 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_disable_certificate_authority_sync.py @@ -0,0 +1,56 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for DisableCertificateAuthority +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-private-ca + + +# [START privateca_v1_generated_CertificateAuthorityService_DisableCertificateAuthority_sync] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud.security import privateca_v1 + + +def sample_disable_certificate_authority(): + # Create a client + client = privateca_v1.CertificateAuthorityServiceClient() + + # Initialize request argument(s) + request = privateca_v1.DisableCertificateAuthorityRequest( + name="name_value", + ) + + # Make the request + operation = client.disable_certificate_authority(request=request) + + print("Waiting for operation to complete...") + + response = operation.result() + + # Handle the response + print(response) + +# [END privateca_v1_generated_CertificateAuthorityService_DisableCertificateAuthority_sync] diff --git a/owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_enable_certificate_authority_async.py b/owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_enable_certificate_authority_async.py new file mode 100644 index 0000000..0ab6aa1 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_enable_certificate_authority_async.py @@ -0,0 +1,56 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for EnableCertificateAuthority +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-private-ca + + +# [START privateca_v1_generated_CertificateAuthorityService_EnableCertificateAuthority_async] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud.security import privateca_v1 + + +async def sample_enable_certificate_authority(): + # Create a client + client = privateca_v1.CertificateAuthorityServiceAsyncClient() + + # Initialize request argument(s) + request = privateca_v1.EnableCertificateAuthorityRequest( + name="name_value", + ) + + # Make the request + operation = client.enable_certificate_authority(request=request) + + print("Waiting for operation to complete...") + + response = (await operation).result() + + # Handle the response + print(response) + +# [END privateca_v1_generated_CertificateAuthorityService_EnableCertificateAuthority_async] diff --git a/owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_enable_certificate_authority_sync.py b/owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_enable_certificate_authority_sync.py new file mode 100644 index 0000000..3f030c7 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_enable_certificate_authority_sync.py @@ -0,0 +1,56 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for EnableCertificateAuthority +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-private-ca + + +# [START privateca_v1_generated_CertificateAuthorityService_EnableCertificateAuthority_sync] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud.security import privateca_v1 + + +def sample_enable_certificate_authority(): + # Create a client + client = privateca_v1.CertificateAuthorityServiceClient() + + # Initialize request argument(s) + request = privateca_v1.EnableCertificateAuthorityRequest( + name="name_value", + ) + + # Make the request + operation = client.enable_certificate_authority(request=request) + + print("Waiting for operation to complete...") + + response = operation.result() + + # Handle the response + print(response) + +# [END privateca_v1_generated_CertificateAuthorityService_EnableCertificateAuthority_sync] diff --git a/owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_fetch_ca_certs_async.py b/owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_fetch_ca_certs_async.py new file mode 100644 index 0000000..0811813 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_fetch_ca_certs_async.py @@ -0,0 +1,52 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for FetchCaCerts +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-private-ca + + +# [START privateca_v1_generated_CertificateAuthorityService_FetchCaCerts_async] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud.security import privateca_v1 + + +async def sample_fetch_ca_certs(): + # Create a client + client = privateca_v1.CertificateAuthorityServiceAsyncClient() + + # Initialize request argument(s) + request = privateca_v1.FetchCaCertsRequest( + ca_pool="ca_pool_value", + ) + + # Make the request + response = await client.fetch_ca_certs(request=request) + + # Handle the response + print(response) + +# [END privateca_v1_generated_CertificateAuthorityService_FetchCaCerts_async] diff --git a/owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_fetch_ca_certs_sync.py b/owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_fetch_ca_certs_sync.py new file mode 100644 index 0000000..4cb78a7 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_fetch_ca_certs_sync.py @@ -0,0 +1,52 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for FetchCaCerts +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-private-ca + + +# [START privateca_v1_generated_CertificateAuthorityService_FetchCaCerts_sync] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud.security import privateca_v1 + + +def sample_fetch_ca_certs(): + # Create a client + client = privateca_v1.CertificateAuthorityServiceClient() + + # Initialize request argument(s) + request = privateca_v1.FetchCaCertsRequest( + ca_pool="ca_pool_value", + ) + + # Make the request + response = client.fetch_ca_certs(request=request) + + # Handle the response + print(response) + +# [END privateca_v1_generated_CertificateAuthorityService_FetchCaCerts_sync] diff --git a/owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_fetch_certificate_authority_csr_async.py b/owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_fetch_certificate_authority_csr_async.py new file mode 100644 index 0000000..6462118 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_fetch_certificate_authority_csr_async.py @@ -0,0 +1,52 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for FetchCertificateAuthorityCsr +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-private-ca + + +# [START privateca_v1_generated_CertificateAuthorityService_FetchCertificateAuthorityCsr_async] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud.security import privateca_v1 + + +async def sample_fetch_certificate_authority_csr(): + # Create a client + client = privateca_v1.CertificateAuthorityServiceAsyncClient() + + # Initialize request argument(s) + request = privateca_v1.FetchCertificateAuthorityCsrRequest( + name="name_value", + ) + + # Make the request + response = await client.fetch_certificate_authority_csr(request=request) + + # Handle the response + print(response) + +# [END privateca_v1_generated_CertificateAuthorityService_FetchCertificateAuthorityCsr_async] diff --git a/owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_fetch_certificate_authority_csr_sync.py b/owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_fetch_certificate_authority_csr_sync.py new file mode 100644 index 0000000..3983c7c --- /dev/null +++ b/owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_fetch_certificate_authority_csr_sync.py @@ -0,0 +1,52 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for FetchCertificateAuthorityCsr +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-private-ca + + +# [START privateca_v1_generated_CertificateAuthorityService_FetchCertificateAuthorityCsr_sync] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud.security import privateca_v1 + + +def sample_fetch_certificate_authority_csr(): + # Create a client + client = privateca_v1.CertificateAuthorityServiceClient() + + # Initialize request argument(s) + request = privateca_v1.FetchCertificateAuthorityCsrRequest( + name="name_value", + ) + + # Make the request + response = client.fetch_certificate_authority_csr(request=request) + + # Handle the response + print(response) + +# [END privateca_v1_generated_CertificateAuthorityService_FetchCertificateAuthorityCsr_sync] diff --git a/owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_get_ca_pool_async.py b/owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_get_ca_pool_async.py new file mode 100644 index 0000000..78e3911 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_get_ca_pool_async.py @@ -0,0 +1,52 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for GetCaPool +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-private-ca + + +# [START privateca_v1_generated_CertificateAuthorityService_GetCaPool_async] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud.security import privateca_v1 + + +async def sample_get_ca_pool(): + # Create a client + client = privateca_v1.CertificateAuthorityServiceAsyncClient() + + # Initialize request argument(s) + request = privateca_v1.GetCaPoolRequest( + name="name_value", + ) + + # Make the request + response = await client.get_ca_pool(request=request) + + # Handle the response + print(response) + +# [END privateca_v1_generated_CertificateAuthorityService_GetCaPool_async] diff --git a/owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_get_ca_pool_sync.py b/owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_get_ca_pool_sync.py new file mode 100644 index 0000000..125d3d6 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_get_ca_pool_sync.py @@ -0,0 +1,52 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for GetCaPool +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-private-ca + + +# [START privateca_v1_generated_CertificateAuthorityService_GetCaPool_sync] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud.security import privateca_v1 + + +def sample_get_ca_pool(): + # Create a client + client = privateca_v1.CertificateAuthorityServiceClient() + + # Initialize request argument(s) + request = privateca_v1.GetCaPoolRequest( + name="name_value", + ) + + # Make the request + response = client.get_ca_pool(request=request) + + # Handle the response + print(response) + +# [END privateca_v1_generated_CertificateAuthorityService_GetCaPool_sync] diff --git a/owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_get_certificate_async.py b/owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_get_certificate_async.py new file mode 100644 index 0000000..abda7fe --- /dev/null +++ b/owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_get_certificate_async.py @@ -0,0 +1,52 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for GetCertificate +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-private-ca + + +# [START privateca_v1_generated_CertificateAuthorityService_GetCertificate_async] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud.security import privateca_v1 + + +async def sample_get_certificate(): + # Create a client + client = privateca_v1.CertificateAuthorityServiceAsyncClient() + + # Initialize request argument(s) + request = privateca_v1.GetCertificateRequest( + name="name_value", + ) + + # Make the request + response = await client.get_certificate(request=request) + + # Handle the response + print(response) + +# [END privateca_v1_generated_CertificateAuthorityService_GetCertificate_async] diff --git a/owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_get_certificate_authority_async.py b/owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_get_certificate_authority_async.py new file mode 100644 index 0000000..b0b0622 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_get_certificate_authority_async.py @@ -0,0 +1,52 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for GetCertificateAuthority +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-private-ca + + +# [START privateca_v1_generated_CertificateAuthorityService_GetCertificateAuthority_async] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud.security import privateca_v1 + + +async def sample_get_certificate_authority(): + # Create a client + client = privateca_v1.CertificateAuthorityServiceAsyncClient() + + # Initialize request argument(s) + request = privateca_v1.GetCertificateAuthorityRequest( + name="name_value", + ) + + # Make the request + response = await client.get_certificate_authority(request=request) + + # Handle the response + print(response) + +# [END privateca_v1_generated_CertificateAuthorityService_GetCertificateAuthority_async] diff --git a/owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_get_certificate_authority_sync.py b/owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_get_certificate_authority_sync.py new file mode 100644 index 0000000..f1a9a94 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_get_certificate_authority_sync.py @@ -0,0 +1,52 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for GetCertificateAuthority +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-private-ca + + +# [START privateca_v1_generated_CertificateAuthorityService_GetCertificateAuthority_sync] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud.security import privateca_v1 + + +def sample_get_certificate_authority(): + # Create a client + client = privateca_v1.CertificateAuthorityServiceClient() + + # Initialize request argument(s) + request = privateca_v1.GetCertificateAuthorityRequest( + name="name_value", + ) + + # Make the request + response = client.get_certificate_authority(request=request) + + # Handle the response + print(response) + +# [END privateca_v1_generated_CertificateAuthorityService_GetCertificateAuthority_sync] diff --git a/owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_get_certificate_revocation_list_async.py b/owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_get_certificate_revocation_list_async.py new file mode 100644 index 0000000..b332b11 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_get_certificate_revocation_list_async.py @@ -0,0 +1,52 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for GetCertificateRevocationList +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-private-ca + + +# [START privateca_v1_generated_CertificateAuthorityService_GetCertificateRevocationList_async] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud.security import privateca_v1 + + +async def sample_get_certificate_revocation_list(): + # Create a client + client = privateca_v1.CertificateAuthorityServiceAsyncClient() + + # Initialize request argument(s) + request = privateca_v1.GetCertificateRevocationListRequest( + name="name_value", + ) + + # Make the request + response = await client.get_certificate_revocation_list(request=request) + + # Handle the response + print(response) + +# [END privateca_v1_generated_CertificateAuthorityService_GetCertificateRevocationList_async] diff --git a/owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_get_certificate_revocation_list_sync.py b/owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_get_certificate_revocation_list_sync.py new file mode 100644 index 0000000..22ece54 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_get_certificate_revocation_list_sync.py @@ -0,0 +1,52 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for GetCertificateRevocationList +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-private-ca + + +# [START privateca_v1_generated_CertificateAuthorityService_GetCertificateRevocationList_sync] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud.security import privateca_v1 + + +def sample_get_certificate_revocation_list(): + # Create a client + client = privateca_v1.CertificateAuthorityServiceClient() + + # Initialize request argument(s) + request = privateca_v1.GetCertificateRevocationListRequest( + name="name_value", + ) + + # Make the request + response = client.get_certificate_revocation_list(request=request) + + # Handle the response + print(response) + +# [END privateca_v1_generated_CertificateAuthorityService_GetCertificateRevocationList_sync] diff --git a/owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_get_certificate_sync.py b/owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_get_certificate_sync.py new file mode 100644 index 0000000..1ea19a8 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_get_certificate_sync.py @@ -0,0 +1,52 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for GetCertificate +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-private-ca + + +# [START privateca_v1_generated_CertificateAuthorityService_GetCertificate_sync] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud.security import privateca_v1 + + +def sample_get_certificate(): + # Create a client + client = privateca_v1.CertificateAuthorityServiceClient() + + # Initialize request argument(s) + request = privateca_v1.GetCertificateRequest( + name="name_value", + ) + + # Make the request + response = client.get_certificate(request=request) + + # Handle the response + print(response) + +# [END privateca_v1_generated_CertificateAuthorityService_GetCertificate_sync] diff --git a/owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_get_certificate_template_async.py b/owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_get_certificate_template_async.py new file mode 100644 index 0000000..17e5024 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_get_certificate_template_async.py @@ -0,0 +1,52 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for GetCertificateTemplate +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-private-ca + + +# [START privateca_v1_generated_CertificateAuthorityService_GetCertificateTemplate_async] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud.security import privateca_v1 + + +async def sample_get_certificate_template(): + # Create a client + client = privateca_v1.CertificateAuthorityServiceAsyncClient() + + # Initialize request argument(s) + request = privateca_v1.GetCertificateTemplateRequest( + name="name_value", + ) + + # Make the request + response = await client.get_certificate_template(request=request) + + # Handle the response + print(response) + +# [END privateca_v1_generated_CertificateAuthorityService_GetCertificateTemplate_async] diff --git a/owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_get_certificate_template_sync.py b/owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_get_certificate_template_sync.py new file mode 100644 index 0000000..7fa2c4e --- /dev/null +++ b/owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_get_certificate_template_sync.py @@ -0,0 +1,52 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for GetCertificateTemplate +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-private-ca + + +# [START privateca_v1_generated_CertificateAuthorityService_GetCertificateTemplate_sync] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud.security import privateca_v1 + + +def sample_get_certificate_template(): + # Create a client + client = privateca_v1.CertificateAuthorityServiceClient() + + # Initialize request argument(s) + request = privateca_v1.GetCertificateTemplateRequest( + name="name_value", + ) + + # Make the request + response = client.get_certificate_template(request=request) + + # Handle the response + print(response) + +# [END privateca_v1_generated_CertificateAuthorityService_GetCertificateTemplate_sync] diff --git a/owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_list_ca_pools_async.py b/owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_list_ca_pools_async.py new file mode 100644 index 0000000..f202c29 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_list_ca_pools_async.py @@ -0,0 +1,53 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for ListCaPools +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-private-ca + + +# [START privateca_v1_generated_CertificateAuthorityService_ListCaPools_async] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud.security import privateca_v1 + + +async def sample_list_ca_pools(): + # Create a client + client = privateca_v1.CertificateAuthorityServiceAsyncClient() + + # Initialize request argument(s) + request = privateca_v1.ListCaPoolsRequest( + parent="parent_value", + ) + + # Make the request + page_result = client.list_ca_pools(request=request) + + # Handle the response + async for response in page_result: + print(response) + +# [END privateca_v1_generated_CertificateAuthorityService_ListCaPools_async] diff --git a/owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_list_ca_pools_sync.py b/owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_list_ca_pools_sync.py new file mode 100644 index 0000000..d875eb9 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_list_ca_pools_sync.py @@ -0,0 +1,53 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for ListCaPools +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-private-ca + + +# [START privateca_v1_generated_CertificateAuthorityService_ListCaPools_sync] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud.security import privateca_v1 + + +def sample_list_ca_pools(): + # Create a client + client = privateca_v1.CertificateAuthorityServiceClient() + + # Initialize request argument(s) + request = privateca_v1.ListCaPoolsRequest( + parent="parent_value", + ) + + # Make the request + page_result = client.list_ca_pools(request=request) + + # Handle the response + for response in page_result: + print(response) + +# [END privateca_v1_generated_CertificateAuthorityService_ListCaPools_sync] diff --git a/owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_list_certificate_authorities_async.py b/owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_list_certificate_authorities_async.py new file mode 100644 index 0000000..3ebacd5 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_list_certificate_authorities_async.py @@ -0,0 +1,53 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for ListCertificateAuthorities +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-private-ca + + +# [START privateca_v1_generated_CertificateAuthorityService_ListCertificateAuthorities_async] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud.security import privateca_v1 + + +async def sample_list_certificate_authorities(): + # Create a client + client = privateca_v1.CertificateAuthorityServiceAsyncClient() + + # Initialize request argument(s) + request = privateca_v1.ListCertificateAuthoritiesRequest( + parent="parent_value", + ) + + # Make the request + page_result = client.list_certificate_authorities(request=request) + + # Handle the response + async for response in page_result: + print(response) + +# [END privateca_v1_generated_CertificateAuthorityService_ListCertificateAuthorities_async] diff --git a/owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_list_certificate_authorities_sync.py b/owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_list_certificate_authorities_sync.py new file mode 100644 index 0000000..ce41c0e --- /dev/null +++ b/owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_list_certificate_authorities_sync.py @@ -0,0 +1,53 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for ListCertificateAuthorities +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-private-ca + + +# [START privateca_v1_generated_CertificateAuthorityService_ListCertificateAuthorities_sync] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud.security import privateca_v1 + + +def sample_list_certificate_authorities(): + # Create a client + client = privateca_v1.CertificateAuthorityServiceClient() + + # Initialize request argument(s) + request = privateca_v1.ListCertificateAuthoritiesRequest( + parent="parent_value", + ) + + # Make the request + page_result = client.list_certificate_authorities(request=request) + + # Handle the response + for response in page_result: + print(response) + +# [END privateca_v1_generated_CertificateAuthorityService_ListCertificateAuthorities_sync] diff --git a/owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_list_certificate_revocation_lists_async.py b/owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_list_certificate_revocation_lists_async.py new file mode 100644 index 0000000..c74051b --- /dev/null +++ b/owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_list_certificate_revocation_lists_async.py @@ -0,0 +1,53 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for ListCertificateRevocationLists +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-private-ca + + +# [START privateca_v1_generated_CertificateAuthorityService_ListCertificateRevocationLists_async] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud.security import privateca_v1 + + +async def sample_list_certificate_revocation_lists(): + # Create a client + client = privateca_v1.CertificateAuthorityServiceAsyncClient() + + # Initialize request argument(s) + request = privateca_v1.ListCertificateRevocationListsRequest( + parent="parent_value", + ) + + # Make the request + page_result = client.list_certificate_revocation_lists(request=request) + + # Handle the response + async for response in page_result: + print(response) + +# [END privateca_v1_generated_CertificateAuthorityService_ListCertificateRevocationLists_async] diff --git a/owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_list_certificate_revocation_lists_sync.py b/owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_list_certificate_revocation_lists_sync.py new file mode 100644 index 0000000..0a6efa7 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_list_certificate_revocation_lists_sync.py @@ -0,0 +1,53 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for ListCertificateRevocationLists +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-private-ca + + +# [START privateca_v1_generated_CertificateAuthorityService_ListCertificateRevocationLists_sync] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud.security import privateca_v1 + + +def sample_list_certificate_revocation_lists(): + # Create a client + client = privateca_v1.CertificateAuthorityServiceClient() + + # Initialize request argument(s) + request = privateca_v1.ListCertificateRevocationListsRequest( + parent="parent_value", + ) + + # Make the request + page_result = client.list_certificate_revocation_lists(request=request) + + # Handle the response + for response in page_result: + print(response) + +# [END privateca_v1_generated_CertificateAuthorityService_ListCertificateRevocationLists_sync] diff --git a/owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_list_certificate_templates_async.py b/owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_list_certificate_templates_async.py new file mode 100644 index 0000000..831eb0a --- /dev/null +++ b/owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_list_certificate_templates_async.py @@ -0,0 +1,53 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for ListCertificateTemplates +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-private-ca + + +# [START privateca_v1_generated_CertificateAuthorityService_ListCertificateTemplates_async] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud.security import privateca_v1 + + +async def sample_list_certificate_templates(): + # Create a client + client = privateca_v1.CertificateAuthorityServiceAsyncClient() + + # Initialize request argument(s) + request = privateca_v1.ListCertificateTemplatesRequest( + parent="parent_value", + ) + + # Make the request + page_result = client.list_certificate_templates(request=request) + + # Handle the response + async for response in page_result: + print(response) + +# [END privateca_v1_generated_CertificateAuthorityService_ListCertificateTemplates_async] diff --git a/owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_list_certificate_templates_sync.py b/owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_list_certificate_templates_sync.py new file mode 100644 index 0000000..50a9277 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_list_certificate_templates_sync.py @@ -0,0 +1,53 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for ListCertificateTemplates +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-private-ca + + +# [START privateca_v1_generated_CertificateAuthorityService_ListCertificateTemplates_sync] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud.security import privateca_v1 + + +def sample_list_certificate_templates(): + # Create a client + client = privateca_v1.CertificateAuthorityServiceClient() + + # Initialize request argument(s) + request = privateca_v1.ListCertificateTemplatesRequest( + parent="parent_value", + ) + + # Make the request + page_result = client.list_certificate_templates(request=request) + + # Handle the response + for response in page_result: + print(response) + +# [END privateca_v1_generated_CertificateAuthorityService_ListCertificateTemplates_sync] diff --git a/owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_list_certificates_async.py b/owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_list_certificates_async.py new file mode 100644 index 0000000..3f5ce09 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_list_certificates_async.py @@ -0,0 +1,53 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for ListCertificates +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-private-ca + + +# [START privateca_v1_generated_CertificateAuthorityService_ListCertificates_async] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud.security import privateca_v1 + + +async def sample_list_certificates(): + # Create a client + client = privateca_v1.CertificateAuthorityServiceAsyncClient() + + # Initialize request argument(s) + request = privateca_v1.ListCertificatesRequest( + parent="parent_value", + ) + + # Make the request + page_result = client.list_certificates(request=request) + + # Handle the response + async for response in page_result: + print(response) + +# [END privateca_v1_generated_CertificateAuthorityService_ListCertificates_async] diff --git a/owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_list_certificates_sync.py b/owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_list_certificates_sync.py new file mode 100644 index 0000000..9048d80 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_list_certificates_sync.py @@ -0,0 +1,53 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for ListCertificates +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-private-ca + + +# [START privateca_v1_generated_CertificateAuthorityService_ListCertificates_sync] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud.security import privateca_v1 + + +def sample_list_certificates(): + # Create a client + client = privateca_v1.CertificateAuthorityServiceClient() + + # Initialize request argument(s) + request = privateca_v1.ListCertificatesRequest( + parent="parent_value", + ) + + # Make the request + page_result = client.list_certificates(request=request) + + # Handle the response + for response in page_result: + print(response) + +# [END privateca_v1_generated_CertificateAuthorityService_ListCertificates_sync] diff --git a/owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_revoke_certificate_async.py b/owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_revoke_certificate_async.py new file mode 100644 index 0000000..a75a4e0 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_revoke_certificate_async.py @@ -0,0 +1,53 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for RevokeCertificate +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-private-ca + + +# [START privateca_v1_generated_CertificateAuthorityService_RevokeCertificate_async] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud.security import privateca_v1 + + +async def sample_revoke_certificate(): + # Create a client + client = privateca_v1.CertificateAuthorityServiceAsyncClient() + + # Initialize request argument(s) + request = privateca_v1.RevokeCertificateRequest( + name="name_value", + reason="ATTRIBUTE_AUTHORITY_COMPROMISE", + ) + + # Make the request + response = await client.revoke_certificate(request=request) + + # Handle the response + print(response) + +# [END privateca_v1_generated_CertificateAuthorityService_RevokeCertificate_async] diff --git a/owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_revoke_certificate_sync.py b/owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_revoke_certificate_sync.py new file mode 100644 index 0000000..b65e819 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_revoke_certificate_sync.py @@ -0,0 +1,53 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for RevokeCertificate +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-private-ca + + +# [START privateca_v1_generated_CertificateAuthorityService_RevokeCertificate_sync] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud.security import privateca_v1 + + +def sample_revoke_certificate(): + # Create a client + client = privateca_v1.CertificateAuthorityServiceClient() + + # Initialize request argument(s) + request = privateca_v1.RevokeCertificateRequest( + name="name_value", + reason="ATTRIBUTE_AUTHORITY_COMPROMISE", + ) + + # Make the request + response = client.revoke_certificate(request=request) + + # Handle the response + print(response) + +# [END privateca_v1_generated_CertificateAuthorityService_RevokeCertificate_sync] diff --git a/owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_undelete_certificate_authority_async.py b/owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_undelete_certificate_authority_async.py new file mode 100644 index 0000000..2152997 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_undelete_certificate_authority_async.py @@ -0,0 +1,56 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for UndeleteCertificateAuthority +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-private-ca + + +# [START privateca_v1_generated_CertificateAuthorityService_UndeleteCertificateAuthority_async] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud.security import privateca_v1 + + +async def sample_undelete_certificate_authority(): + # Create a client + client = privateca_v1.CertificateAuthorityServiceAsyncClient() + + # Initialize request argument(s) + request = privateca_v1.UndeleteCertificateAuthorityRequest( + name="name_value", + ) + + # Make the request + operation = client.undelete_certificate_authority(request=request) + + print("Waiting for operation to complete...") + + response = (await operation).result() + + # Handle the response + print(response) + +# [END privateca_v1_generated_CertificateAuthorityService_UndeleteCertificateAuthority_async] diff --git a/owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_undelete_certificate_authority_sync.py b/owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_undelete_certificate_authority_sync.py new file mode 100644 index 0000000..640c77b --- /dev/null +++ b/owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_undelete_certificate_authority_sync.py @@ -0,0 +1,56 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for UndeleteCertificateAuthority +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-private-ca + + +# [START privateca_v1_generated_CertificateAuthorityService_UndeleteCertificateAuthority_sync] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud.security import privateca_v1 + + +def sample_undelete_certificate_authority(): + # Create a client + client = privateca_v1.CertificateAuthorityServiceClient() + + # Initialize request argument(s) + request = privateca_v1.UndeleteCertificateAuthorityRequest( + name="name_value", + ) + + # Make the request + operation = client.undelete_certificate_authority(request=request) + + print("Waiting for operation to complete...") + + response = operation.result() + + # Handle the response + print(response) + +# [END privateca_v1_generated_CertificateAuthorityService_UndeleteCertificateAuthority_sync] diff --git a/owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_update_ca_pool_async.py b/owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_update_ca_pool_async.py new file mode 100644 index 0000000..e8995ba --- /dev/null +++ b/owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_update_ca_pool_async.py @@ -0,0 +1,59 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for UpdateCaPool +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-private-ca + + +# [START privateca_v1_generated_CertificateAuthorityService_UpdateCaPool_async] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud.security import privateca_v1 + + +async def sample_update_ca_pool(): + # Create a client + client = privateca_v1.CertificateAuthorityServiceAsyncClient() + + # Initialize request argument(s) + ca_pool = privateca_v1.CaPool() + ca_pool.tier = "DEVOPS" + + request = privateca_v1.UpdateCaPoolRequest( + ca_pool=ca_pool, + ) + + # Make the request + operation = client.update_ca_pool(request=request) + + print("Waiting for operation to complete...") + + response = (await operation).result() + + # Handle the response + print(response) + +# [END privateca_v1_generated_CertificateAuthorityService_UpdateCaPool_async] diff --git a/owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_update_ca_pool_sync.py b/owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_update_ca_pool_sync.py new file mode 100644 index 0000000..278831e --- /dev/null +++ b/owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_update_ca_pool_sync.py @@ -0,0 +1,59 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for UpdateCaPool +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-private-ca + + +# [START privateca_v1_generated_CertificateAuthorityService_UpdateCaPool_sync] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud.security import privateca_v1 + + +def sample_update_ca_pool(): + # Create a client + client = privateca_v1.CertificateAuthorityServiceClient() + + # Initialize request argument(s) + ca_pool = privateca_v1.CaPool() + ca_pool.tier = "DEVOPS" + + request = privateca_v1.UpdateCaPoolRequest( + ca_pool=ca_pool, + ) + + # Make the request + operation = client.update_ca_pool(request=request) + + print("Waiting for operation to complete...") + + response = operation.result() + + # Handle the response + print(response) + +# [END privateca_v1_generated_CertificateAuthorityService_UpdateCaPool_sync] diff --git a/owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_update_certificate_async.py b/owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_update_certificate_async.py new file mode 100644 index 0000000..251865f --- /dev/null +++ b/owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_update_certificate_async.py @@ -0,0 +1,55 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for UpdateCertificate +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-private-ca + + +# [START privateca_v1_generated_CertificateAuthorityService_UpdateCertificate_async] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud.security import privateca_v1 + + +async def sample_update_certificate(): + # Create a client + client = privateca_v1.CertificateAuthorityServiceAsyncClient() + + # Initialize request argument(s) + certificate = privateca_v1.Certificate() + certificate.pem_csr = "pem_csr_value" + + request = privateca_v1.UpdateCertificateRequest( + certificate=certificate, + ) + + # Make the request + response = await client.update_certificate(request=request) + + # Handle the response + print(response) + +# [END privateca_v1_generated_CertificateAuthorityService_UpdateCertificate_async] diff --git a/owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_update_certificate_authority_async.py b/owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_update_certificate_authority_async.py new file mode 100644 index 0000000..c5fc602 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_update_certificate_authority_async.py @@ -0,0 +1,60 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for UpdateCertificateAuthority +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-private-ca + + +# [START privateca_v1_generated_CertificateAuthorityService_UpdateCertificateAuthority_async] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud.security import privateca_v1 + + +async def sample_update_certificate_authority(): + # Create a client + client = privateca_v1.CertificateAuthorityServiceAsyncClient() + + # Initialize request argument(s) + certificate_authority = privateca_v1.CertificateAuthority() + certificate_authority.type_ = "SUBORDINATE" + certificate_authority.key_spec.cloud_kms_key_version = "cloud_kms_key_version_value" + + request = privateca_v1.UpdateCertificateAuthorityRequest( + certificate_authority=certificate_authority, + ) + + # Make the request + operation = client.update_certificate_authority(request=request) + + print("Waiting for operation to complete...") + + response = (await operation).result() + + # Handle the response + print(response) + +# [END privateca_v1_generated_CertificateAuthorityService_UpdateCertificateAuthority_async] diff --git a/owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_update_certificate_authority_sync.py b/owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_update_certificate_authority_sync.py new file mode 100644 index 0000000..cbd3b8d --- /dev/null +++ b/owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_update_certificate_authority_sync.py @@ -0,0 +1,60 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for UpdateCertificateAuthority +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-private-ca + + +# [START privateca_v1_generated_CertificateAuthorityService_UpdateCertificateAuthority_sync] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud.security import privateca_v1 + + +def sample_update_certificate_authority(): + # Create a client + client = privateca_v1.CertificateAuthorityServiceClient() + + # Initialize request argument(s) + certificate_authority = privateca_v1.CertificateAuthority() + certificate_authority.type_ = "SUBORDINATE" + certificate_authority.key_spec.cloud_kms_key_version = "cloud_kms_key_version_value" + + request = privateca_v1.UpdateCertificateAuthorityRequest( + certificate_authority=certificate_authority, + ) + + # Make the request + operation = client.update_certificate_authority(request=request) + + print("Waiting for operation to complete...") + + response = operation.result() + + # Handle the response + print(response) + +# [END privateca_v1_generated_CertificateAuthorityService_UpdateCertificateAuthority_sync] diff --git a/owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_update_certificate_revocation_list_async.py b/owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_update_certificate_revocation_list_async.py new file mode 100644 index 0000000..a422713 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_update_certificate_revocation_list_async.py @@ -0,0 +1,55 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for UpdateCertificateRevocationList +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-private-ca + + +# [START privateca_v1_generated_CertificateAuthorityService_UpdateCertificateRevocationList_async] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud.security import privateca_v1 + + +async def sample_update_certificate_revocation_list(): + # Create a client + client = privateca_v1.CertificateAuthorityServiceAsyncClient() + + # Initialize request argument(s) + request = privateca_v1.UpdateCertificateRevocationListRequest( + ) + + # Make the request + operation = client.update_certificate_revocation_list(request=request) + + print("Waiting for operation to complete...") + + response = (await operation).result() + + # Handle the response + print(response) + +# [END privateca_v1_generated_CertificateAuthorityService_UpdateCertificateRevocationList_async] diff --git a/owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_update_certificate_revocation_list_sync.py b/owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_update_certificate_revocation_list_sync.py new file mode 100644 index 0000000..e29909e --- /dev/null +++ b/owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_update_certificate_revocation_list_sync.py @@ -0,0 +1,55 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for UpdateCertificateRevocationList +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-private-ca + + +# [START privateca_v1_generated_CertificateAuthorityService_UpdateCertificateRevocationList_sync] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud.security import privateca_v1 + + +def sample_update_certificate_revocation_list(): + # Create a client + client = privateca_v1.CertificateAuthorityServiceClient() + + # Initialize request argument(s) + request = privateca_v1.UpdateCertificateRevocationListRequest( + ) + + # Make the request + operation = client.update_certificate_revocation_list(request=request) + + print("Waiting for operation to complete...") + + response = operation.result() + + # Handle the response + print(response) + +# [END privateca_v1_generated_CertificateAuthorityService_UpdateCertificateRevocationList_sync] diff --git a/owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_update_certificate_sync.py b/owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_update_certificate_sync.py new file mode 100644 index 0000000..2f4ad51 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_update_certificate_sync.py @@ -0,0 +1,55 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for UpdateCertificate +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-private-ca + + +# [START privateca_v1_generated_CertificateAuthorityService_UpdateCertificate_sync] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud.security import privateca_v1 + + +def sample_update_certificate(): + # Create a client + client = privateca_v1.CertificateAuthorityServiceClient() + + # Initialize request argument(s) + certificate = privateca_v1.Certificate() + certificate.pem_csr = "pem_csr_value" + + request = privateca_v1.UpdateCertificateRequest( + certificate=certificate, + ) + + # Make the request + response = client.update_certificate(request=request) + + # Handle the response + print(response) + +# [END privateca_v1_generated_CertificateAuthorityService_UpdateCertificate_sync] diff --git a/owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_update_certificate_template_async.py b/owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_update_certificate_template_async.py new file mode 100644 index 0000000..adb35a9 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_update_certificate_template_async.py @@ -0,0 +1,55 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for UpdateCertificateTemplate +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-private-ca + + +# [START privateca_v1_generated_CertificateAuthorityService_UpdateCertificateTemplate_async] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud.security import privateca_v1 + + +async def sample_update_certificate_template(): + # Create a client + client = privateca_v1.CertificateAuthorityServiceAsyncClient() + + # Initialize request argument(s) + request = privateca_v1.UpdateCertificateTemplateRequest( + ) + + # Make the request + operation = client.update_certificate_template(request=request) + + print("Waiting for operation to complete...") + + response = (await operation).result() + + # Handle the response + print(response) + +# [END privateca_v1_generated_CertificateAuthorityService_UpdateCertificateTemplate_async] diff --git a/owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_update_certificate_template_sync.py b/owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_update_certificate_template_sync.py new file mode 100644 index 0000000..3a6fd82 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_update_certificate_template_sync.py @@ -0,0 +1,55 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for UpdateCertificateTemplate +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-private-ca + + +# [START privateca_v1_generated_CertificateAuthorityService_UpdateCertificateTemplate_sync] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud.security import privateca_v1 + + +def sample_update_certificate_template(): + # Create a client + client = privateca_v1.CertificateAuthorityServiceClient() + + # Initialize request argument(s) + request = privateca_v1.UpdateCertificateTemplateRequest( + ) + + # Make the request + operation = client.update_certificate_template(request=request) + + print("Waiting for operation to complete...") + + response = operation.result() + + # Handle the response + print(response) + +# [END privateca_v1_generated_CertificateAuthorityService_UpdateCertificateTemplate_sync] diff --git a/owl-bot-staging/v1/samples/generated_samples/snippet_metadata_google.cloud.security.privateca.v1.json b/owl-bot-staging/v1/samples/generated_samples/snippet_metadata_google.cloud.security.privateca.v1.json new file mode 100644 index 0000000..2ae53b3 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated_samples/snippet_metadata_google.cloud.security.privateca.v1.json @@ -0,0 +1,4788 @@ +{ + "clientLibrary": { + "apis": [ + { + "id": "google.cloud.security.privateca.v1", + "version": "v1" + } + ], + "language": "PYTHON", + "name": "google-cloud-private-ca", + "version": "0.1.0" + }, + "snippets": [ + { + "canonical": true, + "clientMethod": { + "async": true, + "client": { + "fullName": "google.cloud.security.privateca_v1.CertificateAuthorityServiceAsyncClient", + "shortName": "CertificateAuthorityServiceAsyncClient" + }, + "fullName": "google.cloud.security.privateca_v1.CertificateAuthorityServiceAsyncClient.activate_certificate_authority", + "method": { + "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService.ActivateCertificateAuthority", + "service": { + "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService", + "shortName": "CertificateAuthorityService" + }, + "shortName": "ActivateCertificateAuthority" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.security.privateca_v1.types.ActivateCertificateAuthorityRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.api_core.operation_async.AsyncOperation", + "shortName": "activate_certificate_authority" + }, + "description": "Sample for ActivateCertificateAuthority", + "file": "privateca_v1_generated_certificate_authority_service_activate_certificate_authority_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "privateca_v1_generated_CertificateAuthorityService_ActivateCertificateAuthority_async", + "segments": [ + { + "end": 60, + "start": 27, + "type": "FULL" + }, + { + "end": 60, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 50, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 57, + "start": 51, + "type": "REQUEST_EXECUTION" + }, + { + "end": 61, + "start": 58, + "type": "RESPONSE_HANDLING" + } + ], + "title": "privateca_v1_generated_certificate_authority_service_activate_certificate_authority_async.py" + }, + { + "canonical": true, + "clientMethod": { + "client": { + "fullName": "google.cloud.security.privateca_v1.CertificateAuthorityServiceClient", + "shortName": "CertificateAuthorityServiceClient" + }, + "fullName": "google.cloud.security.privateca_v1.CertificateAuthorityServiceClient.activate_certificate_authority", + "method": { + "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService.ActivateCertificateAuthority", + "service": { + "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService", + "shortName": "CertificateAuthorityService" + }, + "shortName": "ActivateCertificateAuthority" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.security.privateca_v1.types.ActivateCertificateAuthorityRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.api_core.operation.Operation", + "shortName": "activate_certificate_authority" + }, + "description": "Sample for ActivateCertificateAuthority", + "file": "privateca_v1_generated_certificate_authority_service_activate_certificate_authority_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "privateca_v1_generated_CertificateAuthorityService_ActivateCertificateAuthority_sync", + "segments": [ + { + "end": 60, + "start": 27, + "type": "FULL" + }, + { + "end": 60, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 50, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 57, + "start": 51, + "type": "REQUEST_EXECUTION" + }, + { + "end": 61, + "start": 58, + "type": "RESPONSE_HANDLING" + } + ], + "title": "privateca_v1_generated_certificate_authority_service_activate_certificate_authority_sync.py" + }, + { + "canonical": true, + "clientMethod": { + "async": true, + "client": { + "fullName": "google.cloud.security.privateca_v1.CertificateAuthorityServiceAsyncClient", + "shortName": "CertificateAuthorityServiceAsyncClient" + }, + "fullName": "google.cloud.security.privateca_v1.CertificateAuthorityServiceAsyncClient.create_ca_pool", + "method": { + "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService.CreateCaPool", + "service": { + "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService", + "shortName": "CertificateAuthorityService" + }, + "shortName": "CreateCaPool" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.security.privateca_v1.types.CreateCaPoolRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "ca_pool", + "type": "google.cloud.security.privateca_v1.types.CaPool" + }, + { + "name": "ca_pool_id", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.api_core.operation_async.AsyncOperation", + "shortName": "create_ca_pool" + }, + "description": "Sample for CreateCaPool", + "file": "privateca_v1_generated_certificate_authority_service_create_ca_pool_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "privateca_v1_generated_CertificateAuthorityService_CreateCaPool_async", + "segments": [ + { + "end": 60, + "start": 27, + "type": "FULL" + }, + { + "end": 60, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 50, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 57, + "start": 51, + "type": "REQUEST_EXECUTION" + }, + { + "end": 61, + "start": 58, + "type": "RESPONSE_HANDLING" + } + ], + "title": "privateca_v1_generated_certificate_authority_service_create_ca_pool_async.py" + }, + { + "canonical": true, + "clientMethod": { + "client": { + "fullName": "google.cloud.security.privateca_v1.CertificateAuthorityServiceClient", + "shortName": "CertificateAuthorityServiceClient" + }, + "fullName": "google.cloud.security.privateca_v1.CertificateAuthorityServiceClient.create_ca_pool", + "method": { + "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService.CreateCaPool", + "service": { + "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService", + "shortName": "CertificateAuthorityService" + }, + "shortName": "CreateCaPool" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.security.privateca_v1.types.CreateCaPoolRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "ca_pool", + "type": "google.cloud.security.privateca_v1.types.CaPool" + }, + { + "name": "ca_pool_id", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.api_core.operation.Operation", + "shortName": "create_ca_pool" + }, + "description": "Sample for CreateCaPool", + "file": "privateca_v1_generated_certificate_authority_service_create_ca_pool_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "privateca_v1_generated_CertificateAuthorityService_CreateCaPool_sync", + "segments": [ + { + "end": 60, + "start": 27, + "type": "FULL" + }, + { + "end": 60, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 50, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 57, + "start": 51, + "type": "REQUEST_EXECUTION" + }, + { + "end": 61, + "start": 58, + "type": "RESPONSE_HANDLING" + } + ], + "title": "privateca_v1_generated_certificate_authority_service_create_ca_pool_sync.py" + }, + { + "canonical": true, + "clientMethod": { + "async": true, + "client": { + "fullName": "google.cloud.security.privateca_v1.CertificateAuthorityServiceAsyncClient", + "shortName": "CertificateAuthorityServiceAsyncClient" + }, + "fullName": "google.cloud.security.privateca_v1.CertificateAuthorityServiceAsyncClient.create_certificate_authority", + "method": { + "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService.CreateCertificateAuthority", + "service": { + "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService", + "shortName": "CertificateAuthorityService" + }, + "shortName": "CreateCertificateAuthority" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.security.privateca_v1.types.CreateCertificateAuthorityRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "certificate_authority", + "type": "google.cloud.security.privateca_v1.types.CertificateAuthority" + }, + { + "name": "certificate_authority_id", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.api_core.operation_async.AsyncOperation", + "shortName": "create_certificate_authority" + }, + "description": "Sample for CreateCertificateAuthority", + "file": "privateca_v1_generated_certificate_authority_service_create_certificate_authority_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "privateca_v1_generated_CertificateAuthorityService_CreateCertificateAuthority_async", + "segments": [ + { + "end": 61, + "start": 27, + "type": "FULL" + }, + { + "end": 61, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 51, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 58, + "start": 52, + "type": "REQUEST_EXECUTION" + }, + { + "end": 62, + "start": 59, + "type": "RESPONSE_HANDLING" + } + ], + "title": "privateca_v1_generated_certificate_authority_service_create_certificate_authority_async.py" + }, + { + "canonical": true, + "clientMethod": { + "client": { + "fullName": "google.cloud.security.privateca_v1.CertificateAuthorityServiceClient", + "shortName": "CertificateAuthorityServiceClient" + }, + "fullName": "google.cloud.security.privateca_v1.CertificateAuthorityServiceClient.create_certificate_authority", + "method": { + "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService.CreateCertificateAuthority", + "service": { + "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService", + "shortName": "CertificateAuthorityService" + }, + "shortName": "CreateCertificateAuthority" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.security.privateca_v1.types.CreateCertificateAuthorityRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "certificate_authority", + "type": "google.cloud.security.privateca_v1.types.CertificateAuthority" + }, + { + "name": "certificate_authority_id", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.api_core.operation.Operation", + "shortName": "create_certificate_authority" + }, + "description": "Sample for CreateCertificateAuthority", + "file": "privateca_v1_generated_certificate_authority_service_create_certificate_authority_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "privateca_v1_generated_CertificateAuthorityService_CreateCertificateAuthority_sync", + "segments": [ + { + "end": 61, + "start": 27, + "type": "FULL" + }, + { + "end": 61, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 51, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 58, + "start": 52, + "type": "REQUEST_EXECUTION" + }, + { + "end": 62, + "start": 59, + "type": "RESPONSE_HANDLING" + } + ], + "title": "privateca_v1_generated_certificate_authority_service_create_certificate_authority_sync.py" + }, + { + "canonical": true, + "clientMethod": { + "async": true, + "client": { + "fullName": "google.cloud.security.privateca_v1.CertificateAuthorityServiceAsyncClient", + "shortName": "CertificateAuthorityServiceAsyncClient" + }, + "fullName": "google.cloud.security.privateca_v1.CertificateAuthorityServiceAsyncClient.create_certificate_template", + "method": { + "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService.CreateCertificateTemplate", + "service": { + "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService", + "shortName": "CertificateAuthorityService" + }, + "shortName": "CreateCertificateTemplate" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.security.privateca_v1.types.CreateCertificateTemplateRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "certificate_template", + "type": "google.cloud.security.privateca_v1.types.CertificateTemplate" + }, + { + "name": "certificate_template_id", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.api_core.operation_async.AsyncOperation", + "shortName": "create_certificate_template" + }, + "description": "Sample for CreateCertificateTemplate", + "file": "privateca_v1_generated_certificate_authority_service_create_certificate_template_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "privateca_v1_generated_CertificateAuthorityService_CreateCertificateTemplate_async", + "segments": [ + { + "end": 56, + "start": 27, + "type": "FULL" + }, + { + "end": 56, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 46, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 53, + "start": 47, + "type": "REQUEST_EXECUTION" + }, + { + "end": 57, + "start": 54, + "type": "RESPONSE_HANDLING" + } + ], + "title": "privateca_v1_generated_certificate_authority_service_create_certificate_template_async.py" + }, + { + "canonical": true, + "clientMethod": { + "client": { + "fullName": "google.cloud.security.privateca_v1.CertificateAuthorityServiceClient", + "shortName": "CertificateAuthorityServiceClient" + }, + "fullName": "google.cloud.security.privateca_v1.CertificateAuthorityServiceClient.create_certificate_template", + "method": { + "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService.CreateCertificateTemplate", + "service": { + "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService", + "shortName": "CertificateAuthorityService" + }, + "shortName": "CreateCertificateTemplate" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.security.privateca_v1.types.CreateCertificateTemplateRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "certificate_template", + "type": "google.cloud.security.privateca_v1.types.CertificateTemplate" + }, + { + "name": "certificate_template_id", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.api_core.operation.Operation", + "shortName": "create_certificate_template" + }, + "description": "Sample for CreateCertificateTemplate", + "file": "privateca_v1_generated_certificate_authority_service_create_certificate_template_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "privateca_v1_generated_CertificateAuthorityService_CreateCertificateTemplate_sync", + "segments": [ + { + "end": 56, + "start": 27, + "type": "FULL" + }, + { + "end": 56, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 46, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 53, + "start": 47, + "type": "REQUEST_EXECUTION" + }, + { + "end": 57, + "start": 54, + "type": "RESPONSE_HANDLING" + } + ], + "title": "privateca_v1_generated_certificate_authority_service_create_certificate_template_sync.py" + }, + { + "canonical": true, + "clientMethod": { + "async": true, + "client": { + "fullName": "google.cloud.security.privateca_v1.CertificateAuthorityServiceAsyncClient", + "shortName": "CertificateAuthorityServiceAsyncClient" + }, + "fullName": "google.cloud.security.privateca_v1.CertificateAuthorityServiceAsyncClient.create_certificate", + "method": { + "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService.CreateCertificate", + "service": { + "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService", + "shortName": "CertificateAuthorityService" + }, + "shortName": "CreateCertificate" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.security.privateca_v1.types.CreateCertificateRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "certificate", + "type": "google.cloud.security.privateca_v1.types.Certificate" + }, + { + "name": "certificate_id", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.security.privateca_v1.types.Certificate", + "shortName": "create_certificate" + }, + "description": "Sample for CreateCertificate", + "file": "privateca_v1_generated_certificate_authority_service_create_certificate_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "privateca_v1_generated_CertificateAuthorityService_CreateCertificate_async", + "segments": [ + { + "end": 55, + "start": 27, + "type": "FULL" + }, + { + "end": 55, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 49, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 52, + "start": 50, + "type": "REQUEST_EXECUTION" + }, + { + "end": 56, + "start": 53, + "type": "RESPONSE_HANDLING" + } + ], + "title": "privateca_v1_generated_certificate_authority_service_create_certificate_async.py" + }, + { + "canonical": true, + "clientMethod": { + "client": { + "fullName": "google.cloud.security.privateca_v1.CertificateAuthorityServiceClient", + "shortName": "CertificateAuthorityServiceClient" + }, + "fullName": "google.cloud.security.privateca_v1.CertificateAuthorityServiceClient.create_certificate", + "method": { + "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService.CreateCertificate", + "service": { + "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService", + "shortName": "CertificateAuthorityService" + }, + "shortName": "CreateCertificate" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.security.privateca_v1.types.CreateCertificateRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "certificate", + "type": "google.cloud.security.privateca_v1.types.Certificate" + }, + { + "name": "certificate_id", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.security.privateca_v1.types.Certificate", + "shortName": "create_certificate" + }, + "description": "Sample for CreateCertificate", + "file": "privateca_v1_generated_certificate_authority_service_create_certificate_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "privateca_v1_generated_CertificateAuthorityService_CreateCertificate_sync", + "segments": [ + { + "end": 55, + "start": 27, + "type": "FULL" + }, + { + "end": 55, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 49, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 52, + "start": 50, + "type": "REQUEST_EXECUTION" + }, + { + "end": 56, + "start": 53, + "type": "RESPONSE_HANDLING" + } + ], + "title": "privateca_v1_generated_certificate_authority_service_create_certificate_sync.py" + }, + { + "canonical": true, + "clientMethod": { + "async": true, + "client": { + "fullName": "google.cloud.security.privateca_v1.CertificateAuthorityServiceAsyncClient", + "shortName": "CertificateAuthorityServiceAsyncClient" + }, + "fullName": "google.cloud.security.privateca_v1.CertificateAuthorityServiceAsyncClient.delete_ca_pool", + "method": { + "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService.DeleteCaPool", + "service": { + "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService", + "shortName": "CertificateAuthorityService" + }, + "shortName": "DeleteCaPool" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.security.privateca_v1.types.DeleteCaPoolRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.api_core.operation_async.AsyncOperation", + "shortName": "delete_ca_pool" + }, + "description": "Sample for DeleteCaPool", + "file": "privateca_v1_generated_certificate_authority_service_delete_ca_pool_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "privateca_v1_generated_CertificateAuthorityService_DeleteCaPool_async", + "segments": [ + { + "end": 55, + "start": 27, + "type": "FULL" + }, + { + "end": 55, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 45, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 52, + "start": 46, + "type": "REQUEST_EXECUTION" + }, + { + "end": 56, + "start": 53, + "type": "RESPONSE_HANDLING" + } + ], + "title": "privateca_v1_generated_certificate_authority_service_delete_ca_pool_async.py" + }, + { + "canonical": true, + "clientMethod": { + "client": { + "fullName": "google.cloud.security.privateca_v1.CertificateAuthorityServiceClient", + "shortName": "CertificateAuthorityServiceClient" + }, + "fullName": "google.cloud.security.privateca_v1.CertificateAuthorityServiceClient.delete_ca_pool", + "method": { + "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService.DeleteCaPool", + "service": { + "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService", + "shortName": "CertificateAuthorityService" + }, + "shortName": "DeleteCaPool" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.security.privateca_v1.types.DeleteCaPoolRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.api_core.operation.Operation", + "shortName": "delete_ca_pool" + }, + "description": "Sample for DeleteCaPool", + "file": "privateca_v1_generated_certificate_authority_service_delete_ca_pool_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "privateca_v1_generated_CertificateAuthorityService_DeleteCaPool_sync", + "segments": [ + { + "end": 55, + "start": 27, + "type": "FULL" + }, + { + "end": 55, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 45, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 52, + "start": 46, + "type": "REQUEST_EXECUTION" + }, + { + "end": 56, + "start": 53, + "type": "RESPONSE_HANDLING" + } + ], + "title": "privateca_v1_generated_certificate_authority_service_delete_ca_pool_sync.py" + }, + { + "canonical": true, + "clientMethod": { + "async": true, + "client": { + "fullName": "google.cloud.security.privateca_v1.CertificateAuthorityServiceAsyncClient", + "shortName": "CertificateAuthorityServiceAsyncClient" + }, + "fullName": "google.cloud.security.privateca_v1.CertificateAuthorityServiceAsyncClient.delete_certificate_authority", + "method": { + "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService.DeleteCertificateAuthority", + "service": { + "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService", + "shortName": "CertificateAuthorityService" + }, + "shortName": "DeleteCertificateAuthority" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.security.privateca_v1.types.DeleteCertificateAuthorityRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.api_core.operation_async.AsyncOperation", + "shortName": "delete_certificate_authority" + }, + "description": "Sample for DeleteCertificateAuthority", + "file": "privateca_v1_generated_certificate_authority_service_delete_certificate_authority_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "privateca_v1_generated_CertificateAuthorityService_DeleteCertificateAuthority_async", + "segments": [ + { + "end": 55, + "start": 27, + "type": "FULL" + }, + { + "end": 55, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 45, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 52, + "start": 46, + "type": "REQUEST_EXECUTION" + }, + { + "end": 56, + "start": 53, + "type": "RESPONSE_HANDLING" + } + ], + "title": "privateca_v1_generated_certificate_authority_service_delete_certificate_authority_async.py" + }, + { + "canonical": true, + "clientMethod": { + "client": { + "fullName": "google.cloud.security.privateca_v1.CertificateAuthorityServiceClient", + "shortName": "CertificateAuthorityServiceClient" + }, + "fullName": "google.cloud.security.privateca_v1.CertificateAuthorityServiceClient.delete_certificate_authority", + "method": { + "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService.DeleteCertificateAuthority", + "service": { + "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService", + "shortName": "CertificateAuthorityService" + }, + "shortName": "DeleteCertificateAuthority" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.security.privateca_v1.types.DeleteCertificateAuthorityRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.api_core.operation.Operation", + "shortName": "delete_certificate_authority" + }, + "description": "Sample for DeleteCertificateAuthority", + "file": "privateca_v1_generated_certificate_authority_service_delete_certificate_authority_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "privateca_v1_generated_CertificateAuthorityService_DeleteCertificateAuthority_sync", + "segments": [ + { + "end": 55, + "start": 27, + "type": "FULL" + }, + { + "end": 55, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 45, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 52, + "start": 46, + "type": "REQUEST_EXECUTION" + }, + { + "end": 56, + "start": 53, + "type": "RESPONSE_HANDLING" + } + ], + "title": "privateca_v1_generated_certificate_authority_service_delete_certificate_authority_sync.py" + }, + { + "canonical": true, + "clientMethod": { + "async": true, + "client": { + "fullName": "google.cloud.security.privateca_v1.CertificateAuthorityServiceAsyncClient", + "shortName": "CertificateAuthorityServiceAsyncClient" + }, + "fullName": "google.cloud.security.privateca_v1.CertificateAuthorityServiceAsyncClient.delete_certificate_template", + "method": { + "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService.DeleteCertificateTemplate", + "service": { + "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService", + "shortName": "CertificateAuthorityService" + }, + "shortName": "DeleteCertificateTemplate" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.security.privateca_v1.types.DeleteCertificateTemplateRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.api_core.operation_async.AsyncOperation", + "shortName": "delete_certificate_template" + }, + "description": "Sample for DeleteCertificateTemplate", + "file": "privateca_v1_generated_certificate_authority_service_delete_certificate_template_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "privateca_v1_generated_CertificateAuthorityService_DeleteCertificateTemplate_async", + "segments": [ + { + "end": 55, + "start": 27, + "type": "FULL" + }, + { + "end": 55, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 45, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 52, + "start": 46, + "type": "REQUEST_EXECUTION" + }, + { + "end": 56, + "start": 53, + "type": "RESPONSE_HANDLING" + } + ], + "title": "privateca_v1_generated_certificate_authority_service_delete_certificate_template_async.py" + }, + { + "canonical": true, + "clientMethod": { + "client": { + "fullName": "google.cloud.security.privateca_v1.CertificateAuthorityServiceClient", + "shortName": "CertificateAuthorityServiceClient" + }, + "fullName": "google.cloud.security.privateca_v1.CertificateAuthorityServiceClient.delete_certificate_template", + "method": { + "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService.DeleteCertificateTemplate", + "service": { + "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService", + "shortName": "CertificateAuthorityService" + }, + "shortName": "DeleteCertificateTemplate" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.security.privateca_v1.types.DeleteCertificateTemplateRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.api_core.operation.Operation", + "shortName": "delete_certificate_template" + }, + "description": "Sample for DeleteCertificateTemplate", + "file": "privateca_v1_generated_certificate_authority_service_delete_certificate_template_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "privateca_v1_generated_CertificateAuthorityService_DeleteCertificateTemplate_sync", + "segments": [ + { + "end": 55, + "start": 27, + "type": "FULL" + }, + { + "end": 55, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 45, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 52, + "start": 46, + "type": "REQUEST_EXECUTION" + }, + { + "end": 56, + "start": 53, + "type": "RESPONSE_HANDLING" + } + ], + "title": "privateca_v1_generated_certificate_authority_service_delete_certificate_template_sync.py" + }, + { + "canonical": true, + "clientMethod": { + "async": true, + "client": { + "fullName": "google.cloud.security.privateca_v1.CertificateAuthorityServiceAsyncClient", + "shortName": "CertificateAuthorityServiceAsyncClient" + }, + "fullName": "google.cloud.security.privateca_v1.CertificateAuthorityServiceAsyncClient.disable_certificate_authority", + "method": { + "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService.DisableCertificateAuthority", + "service": { + "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService", + "shortName": "CertificateAuthorityService" + }, + "shortName": "DisableCertificateAuthority" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.security.privateca_v1.types.DisableCertificateAuthorityRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.api_core.operation_async.AsyncOperation", + "shortName": "disable_certificate_authority" + }, + "description": "Sample for DisableCertificateAuthority", + "file": "privateca_v1_generated_certificate_authority_service_disable_certificate_authority_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "privateca_v1_generated_CertificateAuthorityService_DisableCertificateAuthority_async", + "segments": [ + { + "end": 55, + "start": 27, + "type": "FULL" + }, + { + "end": 55, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 45, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 52, + "start": 46, + "type": "REQUEST_EXECUTION" + }, + { + "end": 56, + "start": 53, + "type": "RESPONSE_HANDLING" + } + ], + "title": "privateca_v1_generated_certificate_authority_service_disable_certificate_authority_async.py" + }, + { + "canonical": true, + "clientMethod": { + "client": { + "fullName": "google.cloud.security.privateca_v1.CertificateAuthorityServiceClient", + "shortName": "CertificateAuthorityServiceClient" + }, + "fullName": "google.cloud.security.privateca_v1.CertificateAuthorityServiceClient.disable_certificate_authority", + "method": { + "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService.DisableCertificateAuthority", + "service": { + "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService", + "shortName": "CertificateAuthorityService" + }, + "shortName": "DisableCertificateAuthority" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.security.privateca_v1.types.DisableCertificateAuthorityRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.api_core.operation.Operation", + "shortName": "disable_certificate_authority" + }, + "description": "Sample for DisableCertificateAuthority", + "file": "privateca_v1_generated_certificate_authority_service_disable_certificate_authority_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "privateca_v1_generated_CertificateAuthorityService_DisableCertificateAuthority_sync", + "segments": [ + { + "end": 55, + "start": 27, + "type": "FULL" + }, + { + "end": 55, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 45, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 52, + "start": 46, + "type": "REQUEST_EXECUTION" + }, + { + "end": 56, + "start": 53, + "type": "RESPONSE_HANDLING" + } + ], + "title": "privateca_v1_generated_certificate_authority_service_disable_certificate_authority_sync.py" + }, + { + "canonical": true, + "clientMethod": { + "async": true, + "client": { + "fullName": "google.cloud.security.privateca_v1.CertificateAuthorityServiceAsyncClient", + "shortName": "CertificateAuthorityServiceAsyncClient" + }, + "fullName": "google.cloud.security.privateca_v1.CertificateAuthorityServiceAsyncClient.enable_certificate_authority", + "method": { + "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService.EnableCertificateAuthority", + "service": { + "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService", + "shortName": "CertificateAuthorityService" + }, + "shortName": "EnableCertificateAuthority" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.security.privateca_v1.types.EnableCertificateAuthorityRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.api_core.operation_async.AsyncOperation", + "shortName": "enable_certificate_authority" + }, + "description": "Sample for EnableCertificateAuthority", + "file": "privateca_v1_generated_certificate_authority_service_enable_certificate_authority_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "privateca_v1_generated_CertificateAuthorityService_EnableCertificateAuthority_async", + "segments": [ + { + "end": 55, + "start": 27, + "type": "FULL" + }, + { + "end": 55, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 45, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 52, + "start": 46, + "type": "REQUEST_EXECUTION" + }, + { + "end": 56, + "start": 53, + "type": "RESPONSE_HANDLING" + } + ], + "title": "privateca_v1_generated_certificate_authority_service_enable_certificate_authority_async.py" + }, + { + "canonical": true, + "clientMethod": { + "client": { + "fullName": "google.cloud.security.privateca_v1.CertificateAuthorityServiceClient", + "shortName": "CertificateAuthorityServiceClient" + }, + "fullName": "google.cloud.security.privateca_v1.CertificateAuthorityServiceClient.enable_certificate_authority", + "method": { + "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService.EnableCertificateAuthority", + "service": { + "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService", + "shortName": "CertificateAuthorityService" + }, + "shortName": "EnableCertificateAuthority" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.security.privateca_v1.types.EnableCertificateAuthorityRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.api_core.operation.Operation", + "shortName": "enable_certificate_authority" + }, + "description": "Sample for EnableCertificateAuthority", + "file": "privateca_v1_generated_certificate_authority_service_enable_certificate_authority_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "privateca_v1_generated_CertificateAuthorityService_EnableCertificateAuthority_sync", + "segments": [ + { + "end": 55, + "start": 27, + "type": "FULL" + }, + { + "end": 55, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 45, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 52, + "start": 46, + "type": "REQUEST_EXECUTION" + }, + { + "end": 56, + "start": 53, + "type": "RESPONSE_HANDLING" + } + ], + "title": "privateca_v1_generated_certificate_authority_service_enable_certificate_authority_sync.py" + }, + { + "canonical": true, + "clientMethod": { + "async": true, + "client": { + "fullName": "google.cloud.security.privateca_v1.CertificateAuthorityServiceAsyncClient", + "shortName": "CertificateAuthorityServiceAsyncClient" + }, + "fullName": "google.cloud.security.privateca_v1.CertificateAuthorityServiceAsyncClient.fetch_ca_certs", + "method": { + "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService.FetchCaCerts", + "service": { + "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService", + "shortName": "CertificateAuthorityService" + }, + "shortName": "FetchCaCerts" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.security.privateca_v1.types.FetchCaCertsRequest" + }, + { + "name": "ca_pool", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.security.privateca_v1.types.FetchCaCertsResponse", + "shortName": "fetch_ca_certs" + }, + "description": "Sample for FetchCaCerts", + "file": "privateca_v1_generated_certificate_authority_service_fetch_ca_certs_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "privateca_v1_generated_CertificateAuthorityService_FetchCaCerts_async", + "segments": [ + { + "end": 51, + "start": 27, + "type": "FULL" + }, + { + "end": 51, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 45, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 48, + "start": 46, + "type": "REQUEST_EXECUTION" + }, + { + "end": 52, + "start": 49, + "type": "RESPONSE_HANDLING" + } + ], + "title": "privateca_v1_generated_certificate_authority_service_fetch_ca_certs_async.py" + }, + { + "canonical": true, + "clientMethod": { + "client": { + "fullName": "google.cloud.security.privateca_v1.CertificateAuthorityServiceClient", + "shortName": "CertificateAuthorityServiceClient" + }, + "fullName": "google.cloud.security.privateca_v1.CertificateAuthorityServiceClient.fetch_ca_certs", + "method": { + "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService.FetchCaCerts", + "service": { + "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService", + "shortName": "CertificateAuthorityService" + }, + "shortName": "FetchCaCerts" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.security.privateca_v1.types.FetchCaCertsRequest" + }, + { + "name": "ca_pool", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.security.privateca_v1.types.FetchCaCertsResponse", + "shortName": "fetch_ca_certs" + }, + "description": "Sample for FetchCaCerts", + "file": "privateca_v1_generated_certificate_authority_service_fetch_ca_certs_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "privateca_v1_generated_CertificateAuthorityService_FetchCaCerts_sync", + "segments": [ + { + "end": 51, + "start": 27, + "type": "FULL" + }, + { + "end": 51, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 45, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 48, + "start": 46, + "type": "REQUEST_EXECUTION" + }, + { + "end": 52, + "start": 49, + "type": "RESPONSE_HANDLING" + } + ], + "title": "privateca_v1_generated_certificate_authority_service_fetch_ca_certs_sync.py" + }, + { + "canonical": true, + "clientMethod": { + "async": true, + "client": { + "fullName": "google.cloud.security.privateca_v1.CertificateAuthorityServiceAsyncClient", + "shortName": "CertificateAuthorityServiceAsyncClient" + }, + "fullName": "google.cloud.security.privateca_v1.CertificateAuthorityServiceAsyncClient.fetch_certificate_authority_csr", + "method": { + "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService.FetchCertificateAuthorityCsr", + "service": { + "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService", + "shortName": "CertificateAuthorityService" + }, + "shortName": "FetchCertificateAuthorityCsr" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.security.privateca_v1.types.FetchCertificateAuthorityCsrRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.security.privateca_v1.types.FetchCertificateAuthorityCsrResponse", + "shortName": "fetch_certificate_authority_csr" + }, + "description": "Sample for FetchCertificateAuthorityCsr", + "file": "privateca_v1_generated_certificate_authority_service_fetch_certificate_authority_csr_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "privateca_v1_generated_CertificateAuthorityService_FetchCertificateAuthorityCsr_async", + "segments": [ + { + "end": 51, + "start": 27, + "type": "FULL" + }, + { + "end": 51, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 45, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 48, + "start": 46, + "type": "REQUEST_EXECUTION" + }, + { + "end": 52, + "start": 49, + "type": "RESPONSE_HANDLING" + } + ], + "title": "privateca_v1_generated_certificate_authority_service_fetch_certificate_authority_csr_async.py" + }, + { + "canonical": true, + "clientMethod": { + "client": { + "fullName": "google.cloud.security.privateca_v1.CertificateAuthorityServiceClient", + "shortName": "CertificateAuthorityServiceClient" + }, + "fullName": "google.cloud.security.privateca_v1.CertificateAuthorityServiceClient.fetch_certificate_authority_csr", + "method": { + "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService.FetchCertificateAuthorityCsr", + "service": { + "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService", + "shortName": "CertificateAuthorityService" + }, + "shortName": "FetchCertificateAuthorityCsr" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.security.privateca_v1.types.FetchCertificateAuthorityCsrRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.security.privateca_v1.types.FetchCertificateAuthorityCsrResponse", + "shortName": "fetch_certificate_authority_csr" + }, + "description": "Sample for FetchCertificateAuthorityCsr", + "file": "privateca_v1_generated_certificate_authority_service_fetch_certificate_authority_csr_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "privateca_v1_generated_CertificateAuthorityService_FetchCertificateAuthorityCsr_sync", + "segments": [ + { + "end": 51, + "start": 27, + "type": "FULL" + }, + { + "end": 51, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 45, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 48, + "start": 46, + "type": "REQUEST_EXECUTION" + }, + { + "end": 52, + "start": 49, + "type": "RESPONSE_HANDLING" + } + ], + "title": "privateca_v1_generated_certificate_authority_service_fetch_certificate_authority_csr_sync.py" + }, + { + "canonical": true, + "clientMethod": { + "async": true, + "client": { + "fullName": "google.cloud.security.privateca_v1.CertificateAuthorityServiceAsyncClient", + "shortName": "CertificateAuthorityServiceAsyncClient" + }, + "fullName": "google.cloud.security.privateca_v1.CertificateAuthorityServiceAsyncClient.get_ca_pool", + "method": { + "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService.GetCaPool", + "service": { + "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService", + "shortName": "CertificateAuthorityService" + }, + "shortName": "GetCaPool" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.security.privateca_v1.types.GetCaPoolRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.security.privateca_v1.types.CaPool", + "shortName": "get_ca_pool" + }, + "description": "Sample for GetCaPool", + "file": "privateca_v1_generated_certificate_authority_service_get_ca_pool_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "privateca_v1_generated_CertificateAuthorityService_GetCaPool_async", + "segments": [ + { + "end": 51, + "start": 27, + "type": "FULL" + }, + { + "end": 51, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 45, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 48, + "start": 46, + "type": "REQUEST_EXECUTION" + }, + { + "end": 52, + "start": 49, + "type": "RESPONSE_HANDLING" + } + ], + "title": "privateca_v1_generated_certificate_authority_service_get_ca_pool_async.py" + }, + { + "canonical": true, + "clientMethod": { + "client": { + "fullName": "google.cloud.security.privateca_v1.CertificateAuthorityServiceClient", + "shortName": "CertificateAuthorityServiceClient" + }, + "fullName": "google.cloud.security.privateca_v1.CertificateAuthorityServiceClient.get_ca_pool", + "method": { + "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService.GetCaPool", + "service": { + "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService", + "shortName": "CertificateAuthorityService" + }, + "shortName": "GetCaPool" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.security.privateca_v1.types.GetCaPoolRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.security.privateca_v1.types.CaPool", + "shortName": "get_ca_pool" + }, + "description": "Sample for GetCaPool", + "file": "privateca_v1_generated_certificate_authority_service_get_ca_pool_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "privateca_v1_generated_CertificateAuthorityService_GetCaPool_sync", + "segments": [ + { + "end": 51, + "start": 27, + "type": "FULL" + }, + { + "end": 51, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 45, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 48, + "start": 46, + "type": "REQUEST_EXECUTION" + }, + { + "end": 52, + "start": 49, + "type": "RESPONSE_HANDLING" + } + ], + "title": "privateca_v1_generated_certificate_authority_service_get_ca_pool_sync.py" + }, + { + "canonical": true, + "clientMethod": { + "async": true, + "client": { + "fullName": "google.cloud.security.privateca_v1.CertificateAuthorityServiceAsyncClient", + "shortName": "CertificateAuthorityServiceAsyncClient" + }, + "fullName": "google.cloud.security.privateca_v1.CertificateAuthorityServiceAsyncClient.get_certificate_authority", + "method": { + "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService.GetCertificateAuthority", + "service": { + "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService", + "shortName": "CertificateAuthorityService" + }, + "shortName": "GetCertificateAuthority" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.security.privateca_v1.types.GetCertificateAuthorityRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.security.privateca_v1.types.CertificateAuthority", + "shortName": "get_certificate_authority" + }, + "description": "Sample for GetCertificateAuthority", + "file": "privateca_v1_generated_certificate_authority_service_get_certificate_authority_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "privateca_v1_generated_CertificateAuthorityService_GetCertificateAuthority_async", + "segments": [ + { + "end": 51, + "start": 27, + "type": "FULL" + }, + { + "end": 51, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 45, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 48, + "start": 46, + "type": "REQUEST_EXECUTION" + }, + { + "end": 52, + "start": 49, + "type": "RESPONSE_HANDLING" + } + ], + "title": "privateca_v1_generated_certificate_authority_service_get_certificate_authority_async.py" + }, + { + "canonical": true, + "clientMethod": { + "client": { + "fullName": "google.cloud.security.privateca_v1.CertificateAuthorityServiceClient", + "shortName": "CertificateAuthorityServiceClient" + }, + "fullName": "google.cloud.security.privateca_v1.CertificateAuthorityServiceClient.get_certificate_authority", + "method": { + "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService.GetCertificateAuthority", + "service": { + "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService", + "shortName": "CertificateAuthorityService" + }, + "shortName": "GetCertificateAuthority" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.security.privateca_v1.types.GetCertificateAuthorityRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.security.privateca_v1.types.CertificateAuthority", + "shortName": "get_certificate_authority" + }, + "description": "Sample for GetCertificateAuthority", + "file": "privateca_v1_generated_certificate_authority_service_get_certificate_authority_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "privateca_v1_generated_CertificateAuthorityService_GetCertificateAuthority_sync", + "segments": [ + { + "end": 51, + "start": 27, + "type": "FULL" + }, + { + "end": 51, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 45, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 48, + "start": 46, + "type": "REQUEST_EXECUTION" + }, + { + "end": 52, + "start": 49, + "type": "RESPONSE_HANDLING" + } + ], + "title": "privateca_v1_generated_certificate_authority_service_get_certificate_authority_sync.py" + }, + { + "canonical": true, + "clientMethod": { + "async": true, + "client": { + "fullName": "google.cloud.security.privateca_v1.CertificateAuthorityServiceAsyncClient", + "shortName": "CertificateAuthorityServiceAsyncClient" + }, + "fullName": "google.cloud.security.privateca_v1.CertificateAuthorityServiceAsyncClient.get_certificate_revocation_list", + "method": { + "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService.GetCertificateRevocationList", + "service": { + "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService", + "shortName": "CertificateAuthorityService" + }, + "shortName": "GetCertificateRevocationList" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.security.privateca_v1.types.GetCertificateRevocationListRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.security.privateca_v1.types.CertificateRevocationList", + "shortName": "get_certificate_revocation_list" + }, + "description": "Sample for GetCertificateRevocationList", + "file": "privateca_v1_generated_certificate_authority_service_get_certificate_revocation_list_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "privateca_v1_generated_CertificateAuthorityService_GetCertificateRevocationList_async", + "segments": [ + { + "end": 51, + "start": 27, + "type": "FULL" + }, + { + "end": 51, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 45, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 48, + "start": 46, + "type": "REQUEST_EXECUTION" + }, + { + "end": 52, + "start": 49, + "type": "RESPONSE_HANDLING" + } + ], + "title": "privateca_v1_generated_certificate_authority_service_get_certificate_revocation_list_async.py" + }, + { + "canonical": true, + "clientMethod": { + "client": { + "fullName": "google.cloud.security.privateca_v1.CertificateAuthorityServiceClient", + "shortName": "CertificateAuthorityServiceClient" + }, + "fullName": "google.cloud.security.privateca_v1.CertificateAuthorityServiceClient.get_certificate_revocation_list", + "method": { + "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService.GetCertificateRevocationList", + "service": { + "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService", + "shortName": "CertificateAuthorityService" + }, + "shortName": "GetCertificateRevocationList" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.security.privateca_v1.types.GetCertificateRevocationListRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.security.privateca_v1.types.CertificateRevocationList", + "shortName": "get_certificate_revocation_list" + }, + "description": "Sample for GetCertificateRevocationList", + "file": "privateca_v1_generated_certificate_authority_service_get_certificate_revocation_list_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "privateca_v1_generated_CertificateAuthorityService_GetCertificateRevocationList_sync", + "segments": [ + { + "end": 51, + "start": 27, + "type": "FULL" + }, + { + "end": 51, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 45, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 48, + "start": 46, + "type": "REQUEST_EXECUTION" + }, + { + "end": 52, + "start": 49, + "type": "RESPONSE_HANDLING" + } + ], + "title": "privateca_v1_generated_certificate_authority_service_get_certificate_revocation_list_sync.py" + }, + { + "canonical": true, + "clientMethod": { + "async": true, + "client": { + "fullName": "google.cloud.security.privateca_v1.CertificateAuthorityServiceAsyncClient", + "shortName": "CertificateAuthorityServiceAsyncClient" + }, + "fullName": "google.cloud.security.privateca_v1.CertificateAuthorityServiceAsyncClient.get_certificate_template", + "method": { + "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService.GetCertificateTemplate", + "service": { + "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService", + "shortName": "CertificateAuthorityService" + }, + "shortName": "GetCertificateTemplate" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.security.privateca_v1.types.GetCertificateTemplateRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.security.privateca_v1.types.CertificateTemplate", + "shortName": "get_certificate_template" + }, + "description": "Sample for GetCertificateTemplate", + "file": "privateca_v1_generated_certificate_authority_service_get_certificate_template_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "privateca_v1_generated_CertificateAuthorityService_GetCertificateTemplate_async", + "segments": [ + { + "end": 51, + "start": 27, + "type": "FULL" + }, + { + "end": 51, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 45, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 48, + "start": 46, + "type": "REQUEST_EXECUTION" + }, + { + "end": 52, + "start": 49, + "type": "RESPONSE_HANDLING" + } + ], + "title": "privateca_v1_generated_certificate_authority_service_get_certificate_template_async.py" + }, + { + "canonical": true, + "clientMethod": { + "client": { + "fullName": "google.cloud.security.privateca_v1.CertificateAuthorityServiceClient", + "shortName": "CertificateAuthorityServiceClient" + }, + "fullName": "google.cloud.security.privateca_v1.CertificateAuthorityServiceClient.get_certificate_template", + "method": { + "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService.GetCertificateTemplate", + "service": { + "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService", + "shortName": "CertificateAuthorityService" + }, + "shortName": "GetCertificateTemplate" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.security.privateca_v1.types.GetCertificateTemplateRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.security.privateca_v1.types.CertificateTemplate", + "shortName": "get_certificate_template" + }, + "description": "Sample for GetCertificateTemplate", + "file": "privateca_v1_generated_certificate_authority_service_get_certificate_template_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "privateca_v1_generated_CertificateAuthorityService_GetCertificateTemplate_sync", + "segments": [ + { + "end": 51, + "start": 27, + "type": "FULL" + }, + { + "end": 51, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 45, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 48, + "start": 46, + "type": "REQUEST_EXECUTION" + }, + { + "end": 52, + "start": 49, + "type": "RESPONSE_HANDLING" + } + ], + "title": "privateca_v1_generated_certificate_authority_service_get_certificate_template_sync.py" + }, + { + "canonical": true, + "clientMethod": { + "async": true, + "client": { + "fullName": "google.cloud.security.privateca_v1.CertificateAuthorityServiceAsyncClient", + "shortName": "CertificateAuthorityServiceAsyncClient" + }, + "fullName": "google.cloud.security.privateca_v1.CertificateAuthorityServiceAsyncClient.get_certificate", + "method": { + "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService.GetCertificate", + "service": { + "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService", + "shortName": "CertificateAuthorityService" + }, + "shortName": "GetCertificate" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.security.privateca_v1.types.GetCertificateRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.security.privateca_v1.types.Certificate", + "shortName": "get_certificate" + }, + "description": "Sample for GetCertificate", + "file": "privateca_v1_generated_certificate_authority_service_get_certificate_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "privateca_v1_generated_CertificateAuthorityService_GetCertificate_async", + "segments": [ + { + "end": 51, + "start": 27, + "type": "FULL" + }, + { + "end": 51, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 45, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 48, + "start": 46, + "type": "REQUEST_EXECUTION" + }, + { + "end": 52, + "start": 49, + "type": "RESPONSE_HANDLING" + } + ], + "title": "privateca_v1_generated_certificate_authority_service_get_certificate_async.py" + }, + { + "canonical": true, + "clientMethod": { + "client": { + "fullName": "google.cloud.security.privateca_v1.CertificateAuthorityServiceClient", + "shortName": "CertificateAuthorityServiceClient" + }, + "fullName": "google.cloud.security.privateca_v1.CertificateAuthorityServiceClient.get_certificate", + "method": { + "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService.GetCertificate", + "service": { + "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService", + "shortName": "CertificateAuthorityService" + }, + "shortName": "GetCertificate" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.security.privateca_v1.types.GetCertificateRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.security.privateca_v1.types.Certificate", + "shortName": "get_certificate" + }, + "description": "Sample for GetCertificate", + "file": "privateca_v1_generated_certificate_authority_service_get_certificate_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "privateca_v1_generated_CertificateAuthorityService_GetCertificate_sync", + "segments": [ + { + "end": 51, + "start": 27, + "type": "FULL" + }, + { + "end": 51, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 45, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 48, + "start": 46, + "type": "REQUEST_EXECUTION" + }, + { + "end": 52, + "start": 49, + "type": "RESPONSE_HANDLING" + } + ], + "title": "privateca_v1_generated_certificate_authority_service_get_certificate_sync.py" + }, + { + "canonical": true, + "clientMethod": { + "async": true, + "client": { + "fullName": "google.cloud.security.privateca_v1.CertificateAuthorityServiceAsyncClient", + "shortName": "CertificateAuthorityServiceAsyncClient" + }, + "fullName": "google.cloud.security.privateca_v1.CertificateAuthorityServiceAsyncClient.list_ca_pools", + "method": { + "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService.ListCaPools", + "service": { + "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService", + "shortName": "CertificateAuthorityService" + }, + "shortName": "ListCaPools" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.security.privateca_v1.types.ListCaPoolsRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.security.privateca_v1.services.certificate_authority_service.pagers.ListCaPoolsAsyncPager", + "shortName": "list_ca_pools" + }, + "description": "Sample for ListCaPools", + "file": "privateca_v1_generated_certificate_authority_service_list_ca_pools_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "privateca_v1_generated_CertificateAuthorityService_ListCaPools_async", + "segments": [ + { + "end": 52, + "start": 27, + "type": "FULL" + }, + { + "end": 52, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 45, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 48, + "start": 46, + "type": "REQUEST_EXECUTION" + }, + { + "end": 53, + "start": 49, + "type": "RESPONSE_HANDLING" + } + ], + "title": "privateca_v1_generated_certificate_authority_service_list_ca_pools_async.py" + }, + { + "canonical": true, + "clientMethod": { + "client": { + "fullName": "google.cloud.security.privateca_v1.CertificateAuthorityServiceClient", + "shortName": "CertificateAuthorityServiceClient" + }, + "fullName": "google.cloud.security.privateca_v1.CertificateAuthorityServiceClient.list_ca_pools", + "method": { + "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService.ListCaPools", + "service": { + "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService", + "shortName": "CertificateAuthorityService" + }, + "shortName": "ListCaPools" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.security.privateca_v1.types.ListCaPoolsRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.security.privateca_v1.services.certificate_authority_service.pagers.ListCaPoolsPager", + "shortName": "list_ca_pools" + }, + "description": "Sample for ListCaPools", + "file": "privateca_v1_generated_certificate_authority_service_list_ca_pools_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "privateca_v1_generated_CertificateAuthorityService_ListCaPools_sync", + "segments": [ + { + "end": 52, + "start": 27, + "type": "FULL" + }, + { + "end": 52, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 45, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 48, + "start": 46, + "type": "REQUEST_EXECUTION" + }, + { + "end": 53, + "start": 49, + "type": "RESPONSE_HANDLING" + } + ], + "title": "privateca_v1_generated_certificate_authority_service_list_ca_pools_sync.py" + }, + { + "canonical": true, + "clientMethod": { + "async": true, + "client": { + "fullName": "google.cloud.security.privateca_v1.CertificateAuthorityServiceAsyncClient", + "shortName": "CertificateAuthorityServiceAsyncClient" + }, + "fullName": "google.cloud.security.privateca_v1.CertificateAuthorityServiceAsyncClient.list_certificate_authorities", + "method": { + "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService.ListCertificateAuthorities", + "service": { + "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService", + "shortName": "CertificateAuthorityService" + }, + "shortName": "ListCertificateAuthorities" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.security.privateca_v1.types.ListCertificateAuthoritiesRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.security.privateca_v1.services.certificate_authority_service.pagers.ListCertificateAuthoritiesAsyncPager", + "shortName": "list_certificate_authorities" + }, + "description": "Sample for ListCertificateAuthorities", + "file": "privateca_v1_generated_certificate_authority_service_list_certificate_authorities_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "privateca_v1_generated_CertificateAuthorityService_ListCertificateAuthorities_async", + "segments": [ + { + "end": 52, + "start": 27, + "type": "FULL" + }, + { + "end": 52, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 45, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 48, + "start": 46, + "type": "REQUEST_EXECUTION" + }, + { + "end": 53, + "start": 49, + "type": "RESPONSE_HANDLING" + } + ], + "title": "privateca_v1_generated_certificate_authority_service_list_certificate_authorities_async.py" + }, + { + "canonical": true, + "clientMethod": { + "client": { + "fullName": "google.cloud.security.privateca_v1.CertificateAuthorityServiceClient", + "shortName": "CertificateAuthorityServiceClient" + }, + "fullName": "google.cloud.security.privateca_v1.CertificateAuthorityServiceClient.list_certificate_authorities", + "method": { + "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService.ListCertificateAuthorities", + "service": { + "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService", + "shortName": "CertificateAuthorityService" + }, + "shortName": "ListCertificateAuthorities" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.security.privateca_v1.types.ListCertificateAuthoritiesRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.security.privateca_v1.services.certificate_authority_service.pagers.ListCertificateAuthoritiesPager", + "shortName": "list_certificate_authorities" + }, + "description": "Sample for ListCertificateAuthorities", + "file": "privateca_v1_generated_certificate_authority_service_list_certificate_authorities_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "privateca_v1_generated_CertificateAuthorityService_ListCertificateAuthorities_sync", + "segments": [ + { + "end": 52, + "start": 27, + "type": "FULL" + }, + { + "end": 52, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 45, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 48, + "start": 46, + "type": "REQUEST_EXECUTION" + }, + { + "end": 53, + "start": 49, + "type": "RESPONSE_HANDLING" + } + ], + "title": "privateca_v1_generated_certificate_authority_service_list_certificate_authorities_sync.py" + }, + { + "canonical": true, + "clientMethod": { + "async": true, + "client": { + "fullName": "google.cloud.security.privateca_v1.CertificateAuthorityServiceAsyncClient", + "shortName": "CertificateAuthorityServiceAsyncClient" + }, + "fullName": "google.cloud.security.privateca_v1.CertificateAuthorityServiceAsyncClient.list_certificate_revocation_lists", + "method": { + "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService.ListCertificateRevocationLists", + "service": { + "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService", + "shortName": "CertificateAuthorityService" + }, + "shortName": "ListCertificateRevocationLists" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.security.privateca_v1.types.ListCertificateRevocationListsRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.security.privateca_v1.services.certificate_authority_service.pagers.ListCertificateRevocationListsAsyncPager", + "shortName": "list_certificate_revocation_lists" + }, + "description": "Sample for ListCertificateRevocationLists", + "file": "privateca_v1_generated_certificate_authority_service_list_certificate_revocation_lists_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "privateca_v1_generated_CertificateAuthorityService_ListCertificateRevocationLists_async", + "segments": [ + { + "end": 52, + "start": 27, + "type": "FULL" + }, + { + "end": 52, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 45, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 48, + "start": 46, + "type": "REQUEST_EXECUTION" + }, + { + "end": 53, + "start": 49, + "type": "RESPONSE_HANDLING" + } + ], + "title": "privateca_v1_generated_certificate_authority_service_list_certificate_revocation_lists_async.py" + }, + { + "canonical": true, + "clientMethod": { + "client": { + "fullName": "google.cloud.security.privateca_v1.CertificateAuthorityServiceClient", + "shortName": "CertificateAuthorityServiceClient" + }, + "fullName": "google.cloud.security.privateca_v1.CertificateAuthorityServiceClient.list_certificate_revocation_lists", + "method": { + "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService.ListCertificateRevocationLists", + "service": { + "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService", + "shortName": "CertificateAuthorityService" + }, + "shortName": "ListCertificateRevocationLists" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.security.privateca_v1.types.ListCertificateRevocationListsRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.security.privateca_v1.services.certificate_authority_service.pagers.ListCertificateRevocationListsPager", + "shortName": "list_certificate_revocation_lists" + }, + "description": "Sample for ListCertificateRevocationLists", + "file": "privateca_v1_generated_certificate_authority_service_list_certificate_revocation_lists_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "privateca_v1_generated_CertificateAuthorityService_ListCertificateRevocationLists_sync", + "segments": [ + { + "end": 52, + "start": 27, + "type": "FULL" + }, + { + "end": 52, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 45, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 48, + "start": 46, + "type": "REQUEST_EXECUTION" + }, + { + "end": 53, + "start": 49, + "type": "RESPONSE_HANDLING" + } + ], + "title": "privateca_v1_generated_certificate_authority_service_list_certificate_revocation_lists_sync.py" + }, + { + "canonical": true, + "clientMethod": { + "async": true, + "client": { + "fullName": "google.cloud.security.privateca_v1.CertificateAuthorityServiceAsyncClient", + "shortName": "CertificateAuthorityServiceAsyncClient" + }, + "fullName": "google.cloud.security.privateca_v1.CertificateAuthorityServiceAsyncClient.list_certificate_templates", + "method": { + "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService.ListCertificateTemplates", + "service": { + "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService", + "shortName": "CertificateAuthorityService" + }, + "shortName": "ListCertificateTemplates" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.security.privateca_v1.types.ListCertificateTemplatesRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.security.privateca_v1.services.certificate_authority_service.pagers.ListCertificateTemplatesAsyncPager", + "shortName": "list_certificate_templates" + }, + "description": "Sample for ListCertificateTemplates", + "file": "privateca_v1_generated_certificate_authority_service_list_certificate_templates_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "privateca_v1_generated_CertificateAuthorityService_ListCertificateTemplates_async", + "segments": [ + { + "end": 52, + "start": 27, + "type": "FULL" + }, + { + "end": 52, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 45, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 48, + "start": 46, + "type": "REQUEST_EXECUTION" + }, + { + "end": 53, + "start": 49, + "type": "RESPONSE_HANDLING" + } + ], + "title": "privateca_v1_generated_certificate_authority_service_list_certificate_templates_async.py" + }, + { + "canonical": true, + "clientMethod": { + "client": { + "fullName": "google.cloud.security.privateca_v1.CertificateAuthorityServiceClient", + "shortName": "CertificateAuthorityServiceClient" + }, + "fullName": "google.cloud.security.privateca_v1.CertificateAuthorityServiceClient.list_certificate_templates", + "method": { + "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService.ListCertificateTemplates", + "service": { + "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService", + "shortName": "CertificateAuthorityService" + }, + "shortName": "ListCertificateTemplates" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.security.privateca_v1.types.ListCertificateTemplatesRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.security.privateca_v1.services.certificate_authority_service.pagers.ListCertificateTemplatesPager", + "shortName": "list_certificate_templates" + }, + "description": "Sample for ListCertificateTemplates", + "file": "privateca_v1_generated_certificate_authority_service_list_certificate_templates_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "privateca_v1_generated_CertificateAuthorityService_ListCertificateTemplates_sync", + "segments": [ + { + "end": 52, + "start": 27, + "type": "FULL" + }, + { + "end": 52, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 45, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 48, + "start": 46, + "type": "REQUEST_EXECUTION" + }, + { + "end": 53, + "start": 49, + "type": "RESPONSE_HANDLING" + } + ], + "title": "privateca_v1_generated_certificate_authority_service_list_certificate_templates_sync.py" + }, + { + "canonical": true, + "clientMethod": { + "async": true, + "client": { + "fullName": "google.cloud.security.privateca_v1.CertificateAuthorityServiceAsyncClient", + "shortName": "CertificateAuthorityServiceAsyncClient" + }, + "fullName": "google.cloud.security.privateca_v1.CertificateAuthorityServiceAsyncClient.list_certificates", + "method": { + "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService.ListCertificates", + "service": { + "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService", + "shortName": "CertificateAuthorityService" + }, + "shortName": "ListCertificates" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.security.privateca_v1.types.ListCertificatesRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.security.privateca_v1.services.certificate_authority_service.pagers.ListCertificatesAsyncPager", + "shortName": "list_certificates" + }, + "description": "Sample for ListCertificates", + "file": "privateca_v1_generated_certificate_authority_service_list_certificates_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "privateca_v1_generated_CertificateAuthorityService_ListCertificates_async", + "segments": [ + { + "end": 52, + "start": 27, + "type": "FULL" + }, + { + "end": 52, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 45, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 48, + "start": 46, + "type": "REQUEST_EXECUTION" + }, + { + "end": 53, + "start": 49, + "type": "RESPONSE_HANDLING" + } + ], + "title": "privateca_v1_generated_certificate_authority_service_list_certificates_async.py" + }, + { + "canonical": true, + "clientMethod": { + "client": { + "fullName": "google.cloud.security.privateca_v1.CertificateAuthorityServiceClient", + "shortName": "CertificateAuthorityServiceClient" + }, + "fullName": "google.cloud.security.privateca_v1.CertificateAuthorityServiceClient.list_certificates", + "method": { + "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService.ListCertificates", + "service": { + "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService", + "shortName": "CertificateAuthorityService" + }, + "shortName": "ListCertificates" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.security.privateca_v1.types.ListCertificatesRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.security.privateca_v1.services.certificate_authority_service.pagers.ListCertificatesPager", + "shortName": "list_certificates" + }, + "description": "Sample for ListCertificates", + "file": "privateca_v1_generated_certificate_authority_service_list_certificates_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "privateca_v1_generated_CertificateAuthorityService_ListCertificates_sync", + "segments": [ + { + "end": 52, + "start": 27, + "type": "FULL" + }, + { + "end": 52, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 45, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 48, + "start": 46, + "type": "REQUEST_EXECUTION" + }, + { + "end": 53, + "start": 49, + "type": "RESPONSE_HANDLING" + } + ], + "title": "privateca_v1_generated_certificate_authority_service_list_certificates_sync.py" + }, + { + "canonical": true, + "clientMethod": { + "async": true, + "client": { + "fullName": "google.cloud.security.privateca_v1.CertificateAuthorityServiceAsyncClient", + "shortName": "CertificateAuthorityServiceAsyncClient" + }, + "fullName": "google.cloud.security.privateca_v1.CertificateAuthorityServiceAsyncClient.revoke_certificate", + "method": { + "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService.RevokeCertificate", + "service": { + "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService", + "shortName": "CertificateAuthorityService" + }, + "shortName": "RevokeCertificate" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.security.privateca_v1.types.RevokeCertificateRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.security.privateca_v1.types.Certificate", + "shortName": "revoke_certificate" + }, + "description": "Sample for RevokeCertificate", + "file": "privateca_v1_generated_certificate_authority_service_revoke_certificate_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "privateca_v1_generated_CertificateAuthorityService_RevokeCertificate_async", + "segments": [ + { + "end": 52, + "start": 27, + "type": "FULL" + }, + { + "end": 52, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 46, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 49, + "start": 47, + "type": "REQUEST_EXECUTION" + }, + { + "end": 53, + "start": 50, + "type": "RESPONSE_HANDLING" + } + ], + "title": "privateca_v1_generated_certificate_authority_service_revoke_certificate_async.py" + }, + { + "canonical": true, + "clientMethod": { + "client": { + "fullName": "google.cloud.security.privateca_v1.CertificateAuthorityServiceClient", + "shortName": "CertificateAuthorityServiceClient" + }, + "fullName": "google.cloud.security.privateca_v1.CertificateAuthorityServiceClient.revoke_certificate", + "method": { + "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService.RevokeCertificate", + "service": { + "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService", + "shortName": "CertificateAuthorityService" + }, + "shortName": "RevokeCertificate" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.security.privateca_v1.types.RevokeCertificateRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.security.privateca_v1.types.Certificate", + "shortName": "revoke_certificate" + }, + "description": "Sample for RevokeCertificate", + "file": "privateca_v1_generated_certificate_authority_service_revoke_certificate_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "privateca_v1_generated_CertificateAuthorityService_RevokeCertificate_sync", + "segments": [ + { + "end": 52, + "start": 27, + "type": "FULL" + }, + { + "end": 52, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 46, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 49, + "start": 47, + "type": "REQUEST_EXECUTION" + }, + { + "end": 53, + "start": 50, + "type": "RESPONSE_HANDLING" + } + ], + "title": "privateca_v1_generated_certificate_authority_service_revoke_certificate_sync.py" + }, + { + "canonical": true, + "clientMethod": { + "async": true, + "client": { + "fullName": "google.cloud.security.privateca_v1.CertificateAuthorityServiceAsyncClient", + "shortName": "CertificateAuthorityServiceAsyncClient" + }, + "fullName": "google.cloud.security.privateca_v1.CertificateAuthorityServiceAsyncClient.undelete_certificate_authority", + "method": { + "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService.UndeleteCertificateAuthority", + "service": { + "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService", + "shortName": "CertificateAuthorityService" + }, + "shortName": "UndeleteCertificateAuthority" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.security.privateca_v1.types.UndeleteCertificateAuthorityRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.api_core.operation_async.AsyncOperation", + "shortName": "undelete_certificate_authority" + }, + "description": "Sample for UndeleteCertificateAuthority", + "file": "privateca_v1_generated_certificate_authority_service_undelete_certificate_authority_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "privateca_v1_generated_CertificateAuthorityService_UndeleteCertificateAuthority_async", + "segments": [ + { + "end": 55, + "start": 27, + "type": "FULL" + }, + { + "end": 55, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 45, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 52, + "start": 46, + "type": "REQUEST_EXECUTION" + }, + { + "end": 56, + "start": 53, + "type": "RESPONSE_HANDLING" + } + ], + "title": "privateca_v1_generated_certificate_authority_service_undelete_certificate_authority_async.py" + }, + { + "canonical": true, + "clientMethod": { + "client": { + "fullName": "google.cloud.security.privateca_v1.CertificateAuthorityServiceClient", + "shortName": "CertificateAuthorityServiceClient" + }, + "fullName": "google.cloud.security.privateca_v1.CertificateAuthorityServiceClient.undelete_certificate_authority", + "method": { + "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService.UndeleteCertificateAuthority", + "service": { + "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService", + "shortName": "CertificateAuthorityService" + }, + "shortName": "UndeleteCertificateAuthority" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.security.privateca_v1.types.UndeleteCertificateAuthorityRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.api_core.operation.Operation", + "shortName": "undelete_certificate_authority" + }, + "description": "Sample for UndeleteCertificateAuthority", + "file": "privateca_v1_generated_certificate_authority_service_undelete_certificate_authority_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "privateca_v1_generated_CertificateAuthorityService_UndeleteCertificateAuthority_sync", + "segments": [ + { + "end": 55, + "start": 27, + "type": "FULL" + }, + { + "end": 55, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 45, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 52, + "start": 46, + "type": "REQUEST_EXECUTION" + }, + { + "end": 56, + "start": 53, + "type": "RESPONSE_HANDLING" + } + ], + "title": "privateca_v1_generated_certificate_authority_service_undelete_certificate_authority_sync.py" + }, + { + "canonical": true, + "clientMethod": { + "async": true, + "client": { + "fullName": "google.cloud.security.privateca_v1.CertificateAuthorityServiceAsyncClient", + "shortName": "CertificateAuthorityServiceAsyncClient" + }, + "fullName": "google.cloud.security.privateca_v1.CertificateAuthorityServiceAsyncClient.update_ca_pool", + "method": { + "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService.UpdateCaPool", + "service": { + "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService", + "shortName": "CertificateAuthorityService" + }, + "shortName": "UpdateCaPool" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.security.privateca_v1.types.UpdateCaPoolRequest" + }, + { + "name": "ca_pool", + "type": "google.cloud.security.privateca_v1.types.CaPool" + }, + { + "name": "update_mask", + "type": "google.protobuf.field_mask_pb2.FieldMask" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.api_core.operation_async.AsyncOperation", + "shortName": "update_ca_pool" + }, + "description": "Sample for UpdateCaPool", + "file": "privateca_v1_generated_certificate_authority_service_update_ca_pool_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "privateca_v1_generated_CertificateAuthorityService_UpdateCaPool_async", + "segments": [ + { + "end": 58, + "start": 27, + "type": "FULL" + }, + { + "end": 58, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 48, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 55, + "start": 49, + "type": "REQUEST_EXECUTION" + }, + { + "end": 59, + "start": 56, + "type": "RESPONSE_HANDLING" + } + ], + "title": "privateca_v1_generated_certificate_authority_service_update_ca_pool_async.py" + }, + { + "canonical": true, + "clientMethod": { + "client": { + "fullName": "google.cloud.security.privateca_v1.CertificateAuthorityServiceClient", + "shortName": "CertificateAuthorityServiceClient" + }, + "fullName": "google.cloud.security.privateca_v1.CertificateAuthorityServiceClient.update_ca_pool", + "method": { + "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService.UpdateCaPool", + "service": { + "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService", + "shortName": "CertificateAuthorityService" + }, + "shortName": "UpdateCaPool" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.security.privateca_v1.types.UpdateCaPoolRequest" + }, + { + "name": "ca_pool", + "type": "google.cloud.security.privateca_v1.types.CaPool" + }, + { + "name": "update_mask", + "type": "google.protobuf.field_mask_pb2.FieldMask" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.api_core.operation.Operation", + "shortName": "update_ca_pool" + }, + "description": "Sample for UpdateCaPool", + "file": "privateca_v1_generated_certificate_authority_service_update_ca_pool_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "privateca_v1_generated_CertificateAuthorityService_UpdateCaPool_sync", + "segments": [ + { + "end": 58, + "start": 27, + "type": "FULL" + }, + { + "end": 58, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 48, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 55, + "start": 49, + "type": "REQUEST_EXECUTION" + }, + { + "end": 59, + "start": 56, + "type": "RESPONSE_HANDLING" + } + ], + "title": "privateca_v1_generated_certificate_authority_service_update_ca_pool_sync.py" + }, + { + "canonical": true, + "clientMethod": { + "async": true, + "client": { + "fullName": "google.cloud.security.privateca_v1.CertificateAuthorityServiceAsyncClient", + "shortName": "CertificateAuthorityServiceAsyncClient" + }, + "fullName": "google.cloud.security.privateca_v1.CertificateAuthorityServiceAsyncClient.update_certificate_authority", + "method": { + "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService.UpdateCertificateAuthority", + "service": { + "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService", + "shortName": "CertificateAuthorityService" + }, + "shortName": "UpdateCertificateAuthority" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.security.privateca_v1.types.UpdateCertificateAuthorityRequest" + }, + { + "name": "certificate_authority", + "type": "google.cloud.security.privateca_v1.types.CertificateAuthority" + }, + { + "name": "update_mask", + "type": "google.protobuf.field_mask_pb2.FieldMask" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.api_core.operation_async.AsyncOperation", + "shortName": "update_certificate_authority" + }, + "description": "Sample for UpdateCertificateAuthority", + "file": "privateca_v1_generated_certificate_authority_service_update_certificate_authority_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "privateca_v1_generated_CertificateAuthorityService_UpdateCertificateAuthority_async", + "segments": [ + { + "end": 59, + "start": 27, + "type": "FULL" + }, + { + "end": 59, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 49, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 56, + "start": 50, + "type": "REQUEST_EXECUTION" + }, + { + "end": 60, + "start": 57, + "type": "RESPONSE_HANDLING" + } + ], + "title": "privateca_v1_generated_certificate_authority_service_update_certificate_authority_async.py" + }, + { + "canonical": true, + "clientMethod": { + "client": { + "fullName": "google.cloud.security.privateca_v1.CertificateAuthorityServiceClient", + "shortName": "CertificateAuthorityServiceClient" + }, + "fullName": "google.cloud.security.privateca_v1.CertificateAuthorityServiceClient.update_certificate_authority", + "method": { + "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService.UpdateCertificateAuthority", + "service": { + "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService", + "shortName": "CertificateAuthorityService" + }, + "shortName": "UpdateCertificateAuthority" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.security.privateca_v1.types.UpdateCertificateAuthorityRequest" + }, + { + "name": "certificate_authority", + "type": "google.cloud.security.privateca_v1.types.CertificateAuthority" + }, + { + "name": "update_mask", + "type": "google.protobuf.field_mask_pb2.FieldMask" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.api_core.operation.Operation", + "shortName": "update_certificate_authority" + }, + "description": "Sample for UpdateCertificateAuthority", + "file": "privateca_v1_generated_certificate_authority_service_update_certificate_authority_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "privateca_v1_generated_CertificateAuthorityService_UpdateCertificateAuthority_sync", + "segments": [ + { + "end": 59, + "start": 27, + "type": "FULL" + }, + { + "end": 59, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 49, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 56, + "start": 50, + "type": "REQUEST_EXECUTION" + }, + { + "end": 60, + "start": 57, + "type": "RESPONSE_HANDLING" + } + ], + "title": "privateca_v1_generated_certificate_authority_service_update_certificate_authority_sync.py" + }, + { + "canonical": true, + "clientMethod": { + "async": true, + "client": { + "fullName": "google.cloud.security.privateca_v1.CertificateAuthorityServiceAsyncClient", + "shortName": "CertificateAuthorityServiceAsyncClient" + }, + "fullName": "google.cloud.security.privateca_v1.CertificateAuthorityServiceAsyncClient.update_certificate_revocation_list", + "method": { + "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService.UpdateCertificateRevocationList", + "service": { + "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService", + "shortName": "CertificateAuthorityService" + }, + "shortName": "UpdateCertificateRevocationList" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.security.privateca_v1.types.UpdateCertificateRevocationListRequest" + }, + { + "name": "certificate_revocation_list", + "type": "google.cloud.security.privateca_v1.types.CertificateRevocationList" + }, + { + "name": "update_mask", + "type": "google.protobuf.field_mask_pb2.FieldMask" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.api_core.operation_async.AsyncOperation", + "shortName": "update_certificate_revocation_list" + }, + "description": "Sample for UpdateCertificateRevocationList", + "file": "privateca_v1_generated_certificate_authority_service_update_certificate_revocation_list_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "privateca_v1_generated_CertificateAuthorityService_UpdateCertificateRevocationList_async", + "segments": [ + { + "end": 54, + "start": 27, + "type": "FULL" + }, + { + "end": 54, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 44, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 51, + "start": 45, + "type": "REQUEST_EXECUTION" + }, + { + "end": 55, + "start": 52, + "type": "RESPONSE_HANDLING" + } + ], + "title": "privateca_v1_generated_certificate_authority_service_update_certificate_revocation_list_async.py" + }, + { + "canonical": true, + "clientMethod": { + "client": { + "fullName": "google.cloud.security.privateca_v1.CertificateAuthorityServiceClient", + "shortName": "CertificateAuthorityServiceClient" + }, + "fullName": "google.cloud.security.privateca_v1.CertificateAuthorityServiceClient.update_certificate_revocation_list", + "method": { + "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService.UpdateCertificateRevocationList", + "service": { + "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService", + "shortName": "CertificateAuthorityService" + }, + "shortName": "UpdateCertificateRevocationList" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.security.privateca_v1.types.UpdateCertificateRevocationListRequest" + }, + { + "name": "certificate_revocation_list", + "type": "google.cloud.security.privateca_v1.types.CertificateRevocationList" + }, + { + "name": "update_mask", + "type": "google.protobuf.field_mask_pb2.FieldMask" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.api_core.operation.Operation", + "shortName": "update_certificate_revocation_list" + }, + "description": "Sample for UpdateCertificateRevocationList", + "file": "privateca_v1_generated_certificate_authority_service_update_certificate_revocation_list_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "privateca_v1_generated_CertificateAuthorityService_UpdateCertificateRevocationList_sync", + "segments": [ + { + "end": 54, + "start": 27, + "type": "FULL" + }, + { + "end": 54, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 44, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 51, + "start": 45, + "type": "REQUEST_EXECUTION" + }, + { + "end": 55, + "start": 52, + "type": "RESPONSE_HANDLING" + } + ], + "title": "privateca_v1_generated_certificate_authority_service_update_certificate_revocation_list_sync.py" + }, + { + "canonical": true, + "clientMethod": { + "async": true, + "client": { + "fullName": "google.cloud.security.privateca_v1.CertificateAuthorityServiceAsyncClient", + "shortName": "CertificateAuthorityServiceAsyncClient" + }, + "fullName": "google.cloud.security.privateca_v1.CertificateAuthorityServiceAsyncClient.update_certificate_template", + "method": { + "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService.UpdateCertificateTemplate", + "service": { + "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService", + "shortName": "CertificateAuthorityService" + }, + "shortName": "UpdateCertificateTemplate" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.security.privateca_v1.types.UpdateCertificateTemplateRequest" + }, + { + "name": "certificate_template", + "type": "google.cloud.security.privateca_v1.types.CertificateTemplate" + }, + { + "name": "update_mask", + "type": "google.protobuf.field_mask_pb2.FieldMask" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.api_core.operation_async.AsyncOperation", + "shortName": "update_certificate_template" + }, + "description": "Sample for UpdateCertificateTemplate", + "file": "privateca_v1_generated_certificate_authority_service_update_certificate_template_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "privateca_v1_generated_CertificateAuthorityService_UpdateCertificateTemplate_async", + "segments": [ + { + "end": 54, + "start": 27, + "type": "FULL" + }, + { + "end": 54, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 44, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 51, + "start": 45, + "type": "REQUEST_EXECUTION" + }, + { + "end": 55, + "start": 52, + "type": "RESPONSE_HANDLING" + } + ], + "title": "privateca_v1_generated_certificate_authority_service_update_certificate_template_async.py" + }, + { + "canonical": true, + "clientMethod": { + "client": { + "fullName": "google.cloud.security.privateca_v1.CertificateAuthorityServiceClient", + "shortName": "CertificateAuthorityServiceClient" + }, + "fullName": "google.cloud.security.privateca_v1.CertificateAuthorityServiceClient.update_certificate_template", + "method": { + "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService.UpdateCertificateTemplate", + "service": { + "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService", + "shortName": "CertificateAuthorityService" + }, + "shortName": "UpdateCertificateTemplate" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.security.privateca_v1.types.UpdateCertificateTemplateRequest" + }, + { + "name": "certificate_template", + "type": "google.cloud.security.privateca_v1.types.CertificateTemplate" + }, + { + "name": "update_mask", + "type": "google.protobuf.field_mask_pb2.FieldMask" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.api_core.operation.Operation", + "shortName": "update_certificate_template" + }, + "description": "Sample for UpdateCertificateTemplate", + "file": "privateca_v1_generated_certificate_authority_service_update_certificate_template_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "privateca_v1_generated_CertificateAuthorityService_UpdateCertificateTemplate_sync", + "segments": [ + { + "end": 54, + "start": 27, + "type": "FULL" + }, + { + "end": 54, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 44, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 51, + "start": 45, + "type": "REQUEST_EXECUTION" + }, + { + "end": 55, + "start": 52, + "type": "RESPONSE_HANDLING" + } + ], + "title": "privateca_v1_generated_certificate_authority_service_update_certificate_template_sync.py" + }, + { + "canonical": true, + "clientMethod": { + "async": true, + "client": { + "fullName": "google.cloud.security.privateca_v1.CertificateAuthorityServiceAsyncClient", + "shortName": "CertificateAuthorityServiceAsyncClient" + }, + "fullName": "google.cloud.security.privateca_v1.CertificateAuthorityServiceAsyncClient.update_certificate", + "method": { + "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService.UpdateCertificate", + "service": { + "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService", + "shortName": "CertificateAuthorityService" + }, + "shortName": "UpdateCertificate" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.security.privateca_v1.types.UpdateCertificateRequest" + }, + { + "name": "certificate", + "type": "google.cloud.security.privateca_v1.types.Certificate" + }, + { + "name": "update_mask", + "type": "google.protobuf.field_mask_pb2.FieldMask" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.security.privateca_v1.types.Certificate", + "shortName": "update_certificate" + }, + "description": "Sample for UpdateCertificate", + "file": "privateca_v1_generated_certificate_authority_service_update_certificate_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "privateca_v1_generated_CertificateAuthorityService_UpdateCertificate_async", + "segments": [ + { + "end": 54, + "start": 27, + "type": "FULL" + }, + { + "end": 54, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 48, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 51, + "start": 49, + "type": "REQUEST_EXECUTION" + }, + { + "end": 55, + "start": 52, + "type": "RESPONSE_HANDLING" + } + ], + "title": "privateca_v1_generated_certificate_authority_service_update_certificate_async.py" + }, + { + "canonical": true, + "clientMethod": { + "client": { + "fullName": "google.cloud.security.privateca_v1.CertificateAuthorityServiceClient", + "shortName": "CertificateAuthorityServiceClient" + }, + "fullName": "google.cloud.security.privateca_v1.CertificateAuthorityServiceClient.update_certificate", + "method": { + "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService.UpdateCertificate", + "service": { + "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService", + "shortName": "CertificateAuthorityService" + }, + "shortName": "UpdateCertificate" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.security.privateca_v1.types.UpdateCertificateRequest" + }, + { + "name": "certificate", + "type": "google.cloud.security.privateca_v1.types.Certificate" + }, + { + "name": "update_mask", + "type": "google.protobuf.field_mask_pb2.FieldMask" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.security.privateca_v1.types.Certificate", + "shortName": "update_certificate" + }, + "description": "Sample for UpdateCertificate", + "file": "privateca_v1_generated_certificate_authority_service_update_certificate_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "privateca_v1_generated_CertificateAuthorityService_UpdateCertificate_sync", + "segments": [ + { + "end": 54, + "start": 27, + "type": "FULL" + }, + { + "end": 54, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 48, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 51, + "start": 49, + "type": "REQUEST_EXECUTION" + }, + { + "end": 55, + "start": 52, + "type": "RESPONSE_HANDLING" + } + ], + "title": "privateca_v1_generated_certificate_authority_service_update_certificate_sync.py" + } + ] +} diff --git a/owl-bot-staging/v1/scripts/fixup_privateca_v1_keywords.py b/owl-bot-staging/v1/scripts/fixup_privateca_v1_keywords.py new file mode 100644 index 0000000..54d518c --- /dev/null +++ b/owl-bot-staging/v1/scripts/fixup_privateca_v1_keywords.py @@ -0,0 +1,204 @@ +#! /usr/bin/env python3 +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +import argparse +import os +import libcst as cst +import pathlib +import sys +from typing import (Any, Callable, Dict, List, Sequence, Tuple) + + +def partition( + predicate: Callable[[Any], bool], + iterator: Sequence[Any] +) -> Tuple[List[Any], List[Any]]: + """A stable, out-of-place partition.""" + results = ([], []) + + for i in iterator: + results[int(predicate(i))].append(i) + + # Returns trueList, falseList + return results[1], results[0] + + +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', 'skip_grace_period', ), + '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: + try: + key = original.func.attr.value + kword_params = self.METHOD_TO_PARAMS[key] + except (AttributeError, KeyError): + # Either not a method from the API or too convoluted to be sure. + return updated + + # If the existing code is valid, keyword args come after positional args. + # Therefore, all positional args must map to the first parameters. + args, kwargs = partition(lambda a: not bool(a.keyword), updated.args) + if any(k.keyword.value == "request" for k in kwargs): + # We've already fixed this file, don't fix it again. + return updated + + kwargs, ctrl_kwargs = partition( + lambda a: a.keyword.value not in self.CTRL_PARAMS, + kwargs + ) + + args, ctrl_args = args[:len(kword_params)], args[len(kword_params):] + ctrl_kwargs.extend(cst.Arg(value=a.value, keyword=cst.Name(value=ctrl)) + for a, ctrl in zip(ctrl_args, self.CTRL_PARAMS)) + + request_arg = cst.Arg( + value=cst.Dict([ + cst.DictElement( + cst.SimpleString("'{}'".format(name)), +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 + # those could have been passed positionally or by keyword. + for name, arg in zip(kword_params, args + kwargs)]), + keyword=cst.Name("request") + ) + + return updated.with_changes( + args=[request_arg] + ctrl_kwargs + ) + + +def fix_files( + in_dir: pathlib.Path, + out_dir: pathlib.Path, + *, + transformer=privatecaCallTransformer(), +): + """Duplicate the input dir to the output dir, fixing file method calls. + + Preconditions: + * in_dir is a real directory + * out_dir is a real, empty directory + """ + pyfile_gen = ( + pathlib.Path(os.path.join(root, f)) + for root, _, files in os.walk(in_dir) + for f in files if os.path.splitext(f)[1] == ".py" + ) + + for fpath in pyfile_gen: + with open(fpath, 'r') as f: + src = f.read() + + # Parse the code and insert method call fixes. + tree = cst.parse_module(src) + updated = tree.visit(transformer) + + # Create the path and directory structure for the new file. + updated_path = out_dir.joinpath(fpath.relative_to(in_dir)) + updated_path.parent.mkdir(parents=True, exist_ok=True) + + # Generate the updated source file at the corresponding path. + with open(updated_path, 'w') as f: + f.write(updated.code) + + +if __name__ == '__main__': + parser = argparse.ArgumentParser( + description="""Fix up source that uses the privateca client library. + +The existing sources are NOT overwritten but are copied to output_dir with changes made. + +Note: This tool operates at a best-effort level at converting positional + parameters in client method calls to keyword based parameters. + Cases where it WILL FAIL include + A) * or ** expansion in a method call. + B) Calls via function or method alias (includes free function calls) + C) Indirect or dispatched calls (e.g. the method is looked up dynamically) + + These all constitute false negatives. The tool will also detect false + positives when an API method shares a name with another method. +""") + parser.add_argument( + '-d', + '--input-directory', + required=True, + dest='input_dir', + help='the input directory to walk for python files to fix up', + ) + parser.add_argument( + '-o', + '--output-directory', + required=True, + dest='output_dir', + help='the directory to output files fixed via un-flattening', + ) + args = parser.parse_args() + input_dir = pathlib.Path(args.input_dir) + output_dir = pathlib.Path(args.output_dir) + if not input_dir.is_dir(): + print( + f"input directory '{input_dir}' does not exist or is not a directory", + file=sys.stderr, + ) + sys.exit(-1) + + if not output_dir.is_dir(): + print( + f"output directory '{output_dir}' does not exist or is not a directory", + file=sys.stderr, + ) + sys.exit(-1) + + if os.listdir(output_dir): + print( + f"output directory '{output_dir}' is not empty", + file=sys.stderr, + ) + sys.exit(-1) + + fix_files(input_dir, output_dir) diff --git a/owl-bot-staging/v1/setup.py b/owl-bot-staging/v1/setup.py new file mode 100644 index 0000000..0c1a9f7 --- /dev/null +++ b/owl-bot-staging/v1/setup.py @@ -0,0 +1,92 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +import io +import os + +import setuptools # type: ignore + +package_root = os.path.abspath(os.path.dirname(__file__)) + +name = 'google-cloud-private-ca' + + +description = "Google Cloud Private Ca API client library" + +version = {} +with open(os.path.join(package_root, 'google/cloud/security/privateca/gapic_version.py')) as fp: + exec(fp.read(), version) +version = version["__version__"] + +if version[0] == "0": + release_status = "Development Status :: 4 - Beta" +else: + release_status = "Development Status :: 5 - Production/Stable" + +dependencies = [ + "google-api-core[grpc] >= 1.34.0, <3.0.0dev,!=2.0.*,!=2.1.*,!=2.2.*,!=2.3.*,!=2.4.*,!=2.5.*,!=2.6.*,!=2.7.*,!=2.8.*,!=2.9.*,!=2.10.*", + "proto-plus >= 1.22.0, <2.0.0dev", + "proto-plus >= 1.22.2, <2.0.0dev; python_version>='3.11'", + "protobuf>=3.19.5,<5.0.0dev,!=3.20.0,!=3.20.1,!=4.21.0,!=4.21.1,!=4.21.2,!=4.21.3,!=4.21.4,!=4.21.5", +] +url = "https://github.com/googleapis/python-private-ca" + +package_root = os.path.abspath(os.path.dirname(__file__)) + +readme_filename = os.path.join(package_root, "README.rst") +with io.open(readme_filename, encoding="utf-8") as readme_file: + readme = readme_file.read() + +packages = [ + package + for package in setuptools.PEP420PackageFinder.find() + if package.startswith("google") +] + +namespaces = ["google"] +if "google.cloud" in packages: + namespaces.append("google.cloud") + +setuptools.setup( + name=name, + version=version, + description=description, + long_description=readme, + author="Google LLC", + author_email="googleapis-packages@google.com", + license="Apache 2.0", + url=url, + classifiers=[ + release_status, + "Intended Audience :: Developers", + "License :: OSI Approved :: Apache Software License", + "Programming Language :: Python", + "Programming Language :: Python :: 3", + "Programming Language :: Python :: 3.7", + "Programming Language :: Python :: 3.8", + "Programming Language :: Python :: 3.9", + "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11", + "Operating System :: OS Independent", + "Topic :: Internet", + ], + platforms="Posix; MacOS X; Windows", + packages=packages, + python_requires=">=3.7", + namespace_packages=namespaces, + install_requires=dependencies, + include_package_data=True, + zip_safe=False, +) diff --git a/owl-bot-staging/v1/testing/constraints-3.10.txt b/owl-bot-staging/v1/testing/constraints-3.10.txt new file mode 100644 index 0000000..ed7f9ae --- /dev/null +++ b/owl-bot-staging/v1/testing/constraints-3.10.txt @@ -0,0 +1,6 @@ +# -*- coding: utf-8 -*- +# This constraints file is required for unit tests. +# List all library dependencies and extras in this file. +google-api-core +proto-plus +protobuf diff --git a/owl-bot-staging/v1/testing/constraints-3.11.txt b/owl-bot-staging/v1/testing/constraints-3.11.txt new file mode 100644 index 0000000..ed7f9ae --- /dev/null +++ b/owl-bot-staging/v1/testing/constraints-3.11.txt @@ -0,0 +1,6 @@ +# -*- coding: utf-8 -*- +# This constraints file is required for unit tests. +# List all library dependencies and extras in this file. +google-api-core +proto-plus +protobuf diff --git a/owl-bot-staging/v1/testing/constraints-3.12.txt b/owl-bot-staging/v1/testing/constraints-3.12.txt new file mode 100644 index 0000000..ed7f9ae --- /dev/null +++ b/owl-bot-staging/v1/testing/constraints-3.12.txt @@ -0,0 +1,6 @@ +# -*- coding: utf-8 -*- +# This constraints file is required for unit tests. +# List all library dependencies and extras in this file. +google-api-core +proto-plus +protobuf diff --git a/owl-bot-staging/v1/testing/constraints-3.7.txt b/owl-bot-staging/v1/testing/constraints-3.7.txt new file mode 100644 index 0000000..6c44adf --- /dev/null +++ b/owl-bot-staging/v1/testing/constraints-3.7.txt @@ -0,0 +1,9 @@ +# This constraints file is used to check that lower bounds +# are correct in setup.py +# List all library dependencies and extras in this file. +# Pin the version to the lower bound. +# e.g., if setup.py has "google-cloud-foo >= 1.14.0, < 2.0.0dev", +# Then this file should have google-cloud-foo==1.14.0 +google-api-core==1.34.0 +proto-plus==1.22.0 +protobuf==3.19.5 diff --git a/owl-bot-staging/v1/testing/constraints-3.8.txt b/owl-bot-staging/v1/testing/constraints-3.8.txt new file mode 100644 index 0000000..ed7f9ae --- /dev/null +++ b/owl-bot-staging/v1/testing/constraints-3.8.txt @@ -0,0 +1,6 @@ +# -*- coding: utf-8 -*- +# This constraints file is required for unit tests. +# List all library dependencies and extras in this file. +google-api-core +proto-plus +protobuf diff --git a/owl-bot-staging/v1/testing/constraints-3.9.txt b/owl-bot-staging/v1/testing/constraints-3.9.txt new file mode 100644 index 0000000..ed7f9ae --- /dev/null +++ b/owl-bot-staging/v1/testing/constraints-3.9.txt @@ -0,0 +1,6 @@ +# -*- coding: utf-8 -*- +# This constraints file is required for unit tests. +# List all library dependencies and extras in this file. +google-api-core +proto-plus +protobuf diff --git a/owl-bot-staging/v1/tests/__init__.py b/owl-bot-staging/v1/tests/__init__.py new file mode 100644 index 0000000..231bc12 --- /dev/null +++ b/owl-bot-staging/v1/tests/__init__.py @@ -0,0 +1,16 @@ + +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# diff --git a/owl-bot-staging/v1/tests/unit/__init__.py b/owl-bot-staging/v1/tests/unit/__init__.py new file mode 100644 index 0000000..231bc12 --- /dev/null +++ b/owl-bot-staging/v1/tests/unit/__init__.py @@ -0,0 +1,16 @@ + +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# diff --git a/owl-bot-staging/v1/tests/unit/gapic/__init__.py b/owl-bot-staging/v1/tests/unit/gapic/__init__.py new file mode 100644 index 0000000..231bc12 --- /dev/null +++ b/owl-bot-staging/v1/tests/unit/gapic/__init__.py @@ -0,0 +1,16 @@ + +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# diff --git a/owl-bot-staging/v1/tests/unit/gapic/privateca_v1/__init__.py b/owl-bot-staging/v1/tests/unit/gapic/privateca_v1/__init__.py new file mode 100644 index 0000000..231bc12 --- /dev/null +++ b/owl-bot-staging/v1/tests/unit/gapic/privateca_v1/__init__.py @@ -0,0 +1,16 @@ + +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# diff --git a/owl-bot-staging/v1/tests/unit/gapic/privateca_v1/test_certificate_authority_service.py b/owl-bot-staging/v1/tests/unit/gapic/privateca_v1/test_certificate_authority_service.py new file mode 100644 index 0000000..9ba4949 --- /dev/null +++ b/owl-bot-staging/v1/tests/unit/gapic/privateca_v1/test_certificate_authority_service.py @@ -0,0 +1,9247 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +import os +# try/except added for compatibility with python < 3.8 +try: + from unittest import mock + from unittest.mock import AsyncMock # pragma: NO COVER +except ImportError: # pragma: NO COVER + import mock + +import grpc +from grpc.experimental import aio +import math +import pytest +from proto.marshal.rules.dates import DurationRule, TimestampRule +from proto.marshal.rules import wrappers + +from google.api_core import client_options +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 +from google.api_core import operation_async # type: ignore +from google.api_core import operations_v1 +from google.api_core import path_template +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 +from google.cloud.security.privateca_v1.services.certificate_authority_service import CertificateAuthorityServiceClient +from google.cloud.security.privateca_v1.services.certificate_authority_service import pagers +from google.cloud.security.privateca_v1.services.certificate_authority_service import transports +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 # 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 google.type import expr_pb2 # type: ignore +import google.auth + + +def client_cert_source_callback(): + return b"cert bytes", b"key bytes" + + +# If default endpoint is localhost, then default mtls endpoint will be the same. +# This method modifies the default endpoint so the client can produce a different +# mtls endpoint for endpoint testing purposes. +def modify_default_endpoint(client): + return "foo.googleapis.com" if ("localhost" in client.DEFAULT_ENDPOINT) else client.DEFAULT_ENDPOINT + + +def test__get_default_mtls_endpoint(): + api_endpoint = "example.googleapis.com" + api_mtls_endpoint = "example.mtls.googleapis.com" + sandbox_endpoint = "example.sandbox.googleapis.com" + sandbox_mtls_endpoint = "example.mtls.sandbox.googleapis.com" + non_googleapi = "api.example.com" + + assert CertificateAuthorityServiceClient._get_default_mtls_endpoint(None) is None + assert CertificateAuthorityServiceClient._get_default_mtls_endpoint(api_endpoint) == api_mtls_endpoint + assert CertificateAuthorityServiceClient._get_default_mtls_endpoint(api_mtls_endpoint) == api_mtls_endpoint + assert CertificateAuthorityServiceClient._get_default_mtls_endpoint(sandbox_endpoint) == sandbox_mtls_endpoint + assert CertificateAuthorityServiceClient._get_default_mtls_endpoint(sandbox_mtls_endpoint) == sandbox_mtls_endpoint + assert CertificateAuthorityServiceClient._get_default_mtls_endpoint(non_googleapi) == non_googleapi + + +@pytest.mark.parametrize("client_class,transport_name", [ + (CertificateAuthorityServiceClient, "grpc"), + (CertificateAuthorityServiceAsyncClient, "grpc_asyncio"), +]) +def test_certificate_authority_service_client_from_service_account_info(client_class, transport_name): + creds = ga_credentials.AnonymousCredentials() + with mock.patch.object(service_account.Credentials, 'from_service_account_info') as factory: + factory.return_value = creds + info = {"valid": True} + client = client_class.from_service_account_info(info, transport=transport_name) + assert client.transport._credentials == creds + assert isinstance(client, client_class) + + assert client.transport._host == ( + 'privateca.googleapis.com:443' + ) + + +@pytest.mark.parametrize("transport_class,transport_name", [ + (transports.CertificateAuthorityServiceGrpcTransport, "grpc"), + (transports.CertificateAuthorityServiceGrpcAsyncIOTransport, "grpc_asyncio"), +]) +def test_certificate_authority_service_client_service_account_always_use_jwt(transport_class, transport_name): + with mock.patch.object(service_account.Credentials, 'with_always_use_jwt_access', create=True) as use_jwt: + creds = service_account.Credentials(None, None, None) + transport = transport_class(credentials=creds, always_use_jwt_access=True) + use_jwt.assert_called_once_with(True) + + with mock.patch.object(service_account.Credentials, 'with_always_use_jwt_access', create=True) as use_jwt: + creds = service_account.Credentials(None, None, None) + transport = transport_class(credentials=creds, always_use_jwt_access=False) + use_jwt.assert_not_called() + + +@pytest.mark.parametrize("client_class,transport_name", [ + (CertificateAuthorityServiceClient, "grpc"), + (CertificateAuthorityServiceAsyncClient, "grpc_asyncio"), +]) +def test_certificate_authority_service_client_from_service_account_file(client_class, transport_name): + creds = ga_credentials.AnonymousCredentials() + with mock.patch.object(service_account.Credentials, 'from_service_account_file') as factory: + factory.return_value = creds + client = client_class.from_service_account_file("dummy/file/path.json", transport=transport_name) + assert client.transport._credentials == creds + assert isinstance(client, client_class) + + client = client_class.from_service_account_json("dummy/file/path.json", transport=transport_name) + assert client.transport._credentials == creds + assert isinstance(client, client_class) + + assert client.transport._host == ( + 'privateca.googleapis.com:443' + ) + + +def test_certificate_authority_service_client_get_transport_class(): + transport = CertificateAuthorityServiceClient.get_transport_class() + available_transports = [ + transports.CertificateAuthorityServiceGrpcTransport, + ] + assert transport in available_transports + + transport = CertificateAuthorityServiceClient.get_transport_class("grpc") + assert transport == transports.CertificateAuthorityServiceGrpcTransport + + +@pytest.mark.parametrize("client_class,transport_class,transport_name", [ + (CertificateAuthorityServiceClient, transports.CertificateAuthorityServiceGrpcTransport, "grpc"), + (CertificateAuthorityServiceAsyncClient, transports.CertificateAuthorityServiceGrpcAsyncIOTransport, "grpc_asyncio"), +]) +@mock.patch.object(CertificateAuthorityServiceClient, "DEFAULT_ENDPOINT", modify_default_endpoint(CertificateAuthorityServiceClient)) +@mock.patch.object(CertificateAuthorityServiceAsyncClient, "DEFAULT_ENDPOINT", modify_default_endpoint(CertificateAuthorityServiceAsyncClient)) +def test_certificate_authority_service_client_client_options(client_class, transport_class, transport_name): + # Check that if channel is provided we won't create a new one. + with mock.patch.object(CertificateAuthorityServiceClient, 'get_transport_class') as gtc: + transport = transport_class( + credentials=ga_credentials.AnonymousCredentials() + ) + client = client_class(transport=transport) + gtc.assert_not_called() + + # Check that if channel is provided via str we will create a new one. + with mock.patch.object(CertificateAuthorityServiceClient, 'get_transport_class') as gtc: + client = client_class(transport=transport_name) + gtc.assert_called() + + # Check the case api_endpoint is provided. + options = client_options.ClientOptions(api_endpoint="squid.clam.whelk") + with mock.patch.object(transport_class, '__init__') as patched: + patched.return_value = None + client = client_class(transport=transport_name, client_options=options) + patched.assert_called_once_with( + credentials=None, + credentials_file=None, + host="squid.clam.whelk", + scopes=None, + client_cert_source_for_mtls=None, + quota_project_id=None, + client_info=transports.base.DEFAULT_CLIENT_INFO, + always_use_jwt_access=True, + api_audience=None, + ) + + # Check the case api_endpoint is not provided and GOOGLE_API_USE_MTLS_ENDPOINT is + # "never". + with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "never"}): + with mock.patch.object(transport_class, '__init__') as patched: + patched.return_value = None + client = client_class(transport=transport_name) + patched.assert_called_once_with( + credentials=None, + credentials_file=None, + host=client.DEFAULT_ENDPOINT, + scopes=None, + client_cert_source_for_mtls=None, + quota_project_id=None, + client_info=transports.base.DEFAULT_CLIENT_INFO, + always_use_jwt_access=True, + api_audience=None, + ) + + # Check the case api_endpoint is not provided and GOOGLE_API_USE_MTLS_ENDPOINT is + # "always". + with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "always"}): + with mock.patch.object(transport_class, '__init__') as patched: + patched.return_value = None + client = client_class(transport=transport_name) + patched.assert_called_once_with( + credentials=None, + credentials_file=None, + host=client.DEFAULT_MTLS_ENDPOINT, + scopes=None, + client_cert_source_for_mtls=None, + quota_project_id=None, + client_info=transports.base.DEFAULT_CLIENT_INFO, + always_use_jwt_access=True, + api_audience=None, + ) + + # Check the case api_endpoint is not provided and GOOGLE_API_USE_MTLS_ENDPOINT has + # unsupported value. + with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "Unsupported"}): + with pytest.raises(MutualTLSChannelError): + client = client_class(transport=transport_name) + + # Check the case GOOGLE_API_USE_CLIENT_CERTIFICATE has unsupported value. + with mock.patch.dict(os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": "Unsupported"}): + with pytest.raises(ValueError): + client = client_class(transport=transport_name) + + # Check the case quota_project_id is provided + options = client_options.ClientOptions(quota_project_id="octopus") + with mock.patch.object(transport_class, '__init__') as patched: + patched.return_value = None + client = client_class(client_options=options, transport=transport_name) + patched.assert_called_once_with( + credentials=None, + credentials_file=None, + host=client.DEFAULT_ENDPOINT, + scopes=None, + client_cert_source_for_mtls=None, + quota_project_id="octopus", + client_info=transports.base.DEFAULT_CLIENT_INFO, + always_use_jwt_access=True, + api_audience=None, + ) + # Check the case api_endpoint is provided + options = client_options.ClientOptions(api_audience="https://language.googleapis.com") + with mock.patch.object(transport_class, '__init__') as patched: + patched.return_value = None + client = client_class(client_options=options, transport=transport_name) + patched.assert_called_once_with( + credentials=None, + credentials_file=None, + host=client.DEFAULT_ENDPOINT, + scopes=None, + client_cert_source_for_mtls=None, + quota_project_id=None, + client_info=transports.base.DEFAULT_CLIENT_INFO, + always_use_jwt_access=True, + api_audience="https://language.googleapis.com" + ) + +@pytest.mark.parametrize("client_class,transport_class,transport_name,use_client_cert_env", [ + (CertificateAuthorityServiceClient, transports.CertificateAuthorityServiceGrpcTransport, "grpc", "true"), + (CertificateAuthorityServiceAsyncClient, transports.CertificateAuthorityServiceGrpcAsyncIOTransport, "grpc_asyncio", "true"), + (CertificateAuthorityServiceClient, transports.CertificateAuthorityServiceGrpcTransport, "grpc", "false"), + (CertificateAuthorityServiceAsyncClient, transports.CertificateAuthorityServiceGrpcAsyncIOTransport, "grpc_asyncio", "false"), +]) +@mock.patch.object(CertificateAuthorityServiceClient, "DEFAULT_ENDPOINT", modify_default_endpoint(CertificateAuthorityServiceClient)) +@mock.patch.object(CertificateAuthorityServiceAsyncClient, "DEFAULT_ENDPOINT", modify_default_endpoint(CertificateAuthorityServiceAsyncClient)) +@mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "auto"}) +def test_certificate_authority_service_client_mtls_env_auto(client_class, transport_class, transport_name, use_client_cert_env): + # This tests the endpoint autoswitch behavior. Endpoint is autoswitched to the default + # mtls endpoint, if GOOGLE_API_USE_CLIENT_CERTIFICATE is "true" and client cert exists. + + # Check the case client_cert_source is provided. Whether client cert is used depends on + # GOOGLE_API_USE_CLIENT_CERTIFICATE value. + with mock.patch.dict(os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": use_client_cert_env}): + options = client_options.ClientOptions(client_cert_source=client_cert_source_callback) + with mock.patch.object(transport_class, '__init__') as patched: + patched.return_value = None + client = client_class(client_options=options, transport=transport_name) + + if use_client_cert_env == "false": + expected_client_cert_source = None + expected_host = client.DEFAULT_ENDPOINT + else: + expected_client_cert_source = client_cert_source_callback + expected_host = client.DEFAULT_MTLS_ENDPOINT + + patched.assert_called_once_with( + credentials=None, + credentials_file=None, + host=expected_host, + scopes=None, + client_cert_source_for_mtls=expected_client_cert_source, + quota_project_id=None, + client_info=transports.base.DEFAULT_CLIENT_INFO, + always_use_jwt_access=True, + api_audience=None, + ) + + # Check the case ADC client cert is provided. Whether client cert is used depends on + # GOOGLE_API_USE_CLIENT_CERTIFICATE value. + with mock.patch.dict(os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": use_client_cert_env}): + with mock.patch.object(transport_class, '__init__') as patched: + with mock.patch('google.auth.transport.mtls.has_default_client_cert_source', return_value=True): + with mock.patch('google.auth.transport.mtls.default_client_cert_source', return_value=client_cert_source_callback): + if use_client_cert_env == "false": + expected_host = client.DEFAULT_ENDPOINT + expected_client_cert_source = None + else: + expected_host = client.DEFAULT_MTLS_ENDPOINT + expected_client_cert_source = client_cert_source_callback + + patched.return_value = None + client = client_class(transport=transport_name) + patched.assert_called_once_with( + credentials=None, + credentials_file=None, + host=expected_host, + scopes=None, + client_cert_source_for_mtls=expected_client_cert_source, + quota_project_id=None, + client_info=transports.base.DEFAULT_CLIENT_INFO, + always_use_jwt_access=True, + api_audience=None, + ) + + # Check the case client_cert_source and ADC client cert are not provided. + with mock.patch.dict(os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": use_client_cert_env}): + with mock.patch.object(transport_class, '__init__') as patched: + with mock.patch("google.auth.transport.mtls.has_default_client_cert_source", return_value=False): + patched.return_value = None + client = client_class(transport=transport_name) + patched.assert_called_once_with( + credentials=None, + credentials_file=None, + host=client.DEFAULT_ENDPOINT, + scopes=None, + client_cert_source_for_mtls=None, + quota_project_id=None, + client_info=transports.base.DEFAULT_CLIENT_INFO, + always_use_jwt_access=True, + api_audience=None, + ) + + +@pytest.mark.parametrize("client_class", [ + CertificateAuthorityServiceClient, CertificateAuthorityServiceAsyncClient +]) +@mock.patch.object(CertificateAuthorityServiceClient, "DEFAULT_ENDPOINT", modify_default_endpoint(CertificateAuthorityServiceClient)) +@mock.patch.object(CertificateAuthorityServiceAsyncClient, "DEFAULT_ENDPOINT", modify_default_endpoint(CertificateAuthorityServiceAsyncClient)) +def test_certificate_authority_service_client_get_mtls_endpoint_and_cert_source(client_class): + mock_client_cert_source = mock.Mock() + + # Test the case GOOGLE_API_USE_CLIENT_CERTIFICATE is "true". + with mock.patch.dict(os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": "true"}): + mock_api_endpoint = "foo" + options = client_options.ClientOptions(client_cert_source=mock_client_cert_source, api_endpoint=mock_api_endpoint) + api_endpoint, cert_source = client_class.get_mtls_endpoint_and_cert_source(options) + assert api_endpoint == mock_api_endpoint + assert cert_source == mock_client_cert_source + + # Test the case GOOGLE_API_USE_CLIENT_CERTIFICATE is "false". + with mock.patch.dict(os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": "false"}): + mock_client_cert_source = mock.Mock() + mock_api_endpoint = "foo" + options = client_options.ClientOptions(client_cert_source=mock_client_cert_source, api_endpoint=mock_api_endpoint) + api_endpoint, cert_source = client_class.get_mtls_endpoint_and_cert_source(options) + assert api_endpoint == mock_api_endpoint + assert cert_source is None + + # Test the case GOOGLE_API_USE_MTLS_ENDPOINT is "never". + with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "never"}): + api_endpoint, cert_source = client_class.get_mtls_endpoint_and_cert_source() + assert api_endpoint == client_class.DEFAULT_ENDPOINT + assert cert_source is None + + # Test the case GOOGLE_API_USE_MTLS_ENDPOINT is "always". + with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "always"}): + api_endpoint, cert_source = client_class.get_mtls_endpoint_and_cert_source() + assert api_endpoint == client_class.DEFAULT_MTLS_ENDPOINT + assert cert_source is None + + # Test the case GOOGLE_API_USE_MTLS_ENDPOINT is "auto" and default cert doesn't exist. + with mock.patch.dict(os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": "true"}): + with mock.patch('google.auth.transport.mtls.has_default_client_cert_source', return_value=False): + api_endpoint, cert_source = client_class.get_mtls_endpoint_and_cert_source() + assert api_endpoint == client_class.DEFAULT_ENDPOINT + assert cert_source is None + + # Test the case GOOGLE_API_USE_MTLS_ENDPOINT is "auto" and default cert exists. + with mock.patch.dict(os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": "true"}): + with mock.patch('google.auth.transport.mtls.has_default_client_cert_source', return_value=True): + with mock.patch('google.auth.transport.mtls.default_client_cert_source', return_value=mock_client_cert_source): + api_endpoint, cert_source = client_class.get_mtls_endpoint_and_cert_source() + assert api_endpoint == client_class.DEFAULT_MTLS_ENDPOINT + assert cert_source == mock_client_cert_source + + +@pytest.mark.parametrize("client_class,transport_class,transport_name", [ + (CertificateAuthorityServiceClient, transports.CertificateAuthorityServiceGrpcTransport, "grpc"), + (CertificateAuthorityServiceAsyncClient, transports.CertificateAuthorityServiceGrpcAsyncIOTransport, "grpc_asyncio"), +]) +def test_certificate_authority_service_client_client_options_scopes(client_class, transport_class, transport_name): + # Check the case scopes are provided. + options = client_options.ClientOptions( + scopes=["1", "2"], + ) + with mock.patch.object(transport_class, '__init__') as patched: + patched.return_value = None + client = client_class(client_options=options, transport=transport_name) + patched.assert_called_once_with( + credentials=None, + credentials_file=None, + host=client.DEFAULT_ENDPOINT, + scopes=["1", "2"], + client_cert_source_for_mtls=None, + quota_project_id=None, + client_info=transports.base.DEFAULT_CLIENT_INFO, + always_use_jwt_access=True, + api_audience=None, + ) + +@pytest.mark.parametrize("client_class,transport_class,transport_name,grpc_helpers", [ + (CertificateAuthorityServiceClient, transports.CertificateAuthorityServiceGrpcTransport, "grpc", grpc_helpers), + (CertificateAuthorityServiceAsyncClient, transports.CertificateAuthorityServiceGrpcAsyncIOTransport, "grpc_asyncio", grpc_helpers_async), +]) +def test_certificate_authority_service_client_client_options_credentials_file(client_class, transport_class, transport_name, grpc_helpers): + # Check the case credentials file is provided. + options = client_options.ClientOptions( + credentials_file="credentials.json" + ) + + with mock.patch.object(transport_class, '__init__') as patched: + patched.return_value = None + client = client_class(client_options=options, transport=transport_name) + patched.assert_called_once_with( + credentials=None, + credentials_file="credentials.json", + host=client.DEFAULT_ENDPOINT, + scopes=None, + client_cert_source_for_mtls=None, + quota_project_id=None, + client_info=transports.base.DEFAULT_CLIENT_INFO, + always_use_jwt_access=True, + api_audience=None, + ) + +def test_certificate_authority_service_client_client_options_from_dict(): + with mock.patch('google.cloud.security.privateca_v1.services.certificate_authority_service.transports.CertificateAuthorityServiceGrpcTransport.__init__') as grpc_transport: + grpc_transport.return_value = None + client = CertificateAuthorityServiceClient( + client_options={'api_endpoint': 'squid.clam.whelk'} + ) + grpc_transport.assert_called_once_with( + credentials=None, + credentials_file=None, + host="squid.clam.whelk", + scopes=None, + client_cert_source_for_mtls=None, + quota_project_id=None, + client_info=transports.base.DEFAULT_CLIENT_INFO, + always_use_jwt_access=True, + api_audience=None, + ) + + +@pytest.mark.parametrize("client_class,transport_class,transport_name,grpc_helpers", [ + (CertificateAuthorityServiceClient, transports.CertificateAuthorityServiceGrpcTransport, "grpc", grpc_helpers), + (CertificateAuthorityServiceAsyncClient, transports.CertificateAuthorityServiceGrpcAsyncIOTransport, "grpc_asyncio", grpc_helpers_async), +]) +def test_certificate_authority_service_client_create_channel_credentials_file(client_class, transport_class, transport_name, grpc_helpers): + # Check the case credentials file is provided. + options = client_options.ClientOptions( + credentials_file="credentials.json" + ) + + with mock.patch.object(transport_class, '__init__') as patched: + patched.return_value = None + client = client_class(client_options=options, transport=transport_name) + patched.assert_called_once_with( + credentials=None, + credentials_file="credentials.json", + host=client.DEFAULT_ENDPOINT, + scopes=None, + client_cert_source_for_mtls=None, + quota_project_id=None, + client_info=transports.base.DEFAULT_CLIENT_INFO, + always_use_jwt_access=True, + api_audience=None, + ) + + # test that the credentials from file are saved and used as the credentials. + with mock.patch.object( + google.auth, "load_credentials_from_file", autospec=True + ) as load_creds, mock.patch.object( + google.auth, "default", autospec=True + ) as adc, mock.patch.object( + grpc_helpers, "create_channel" + ) as create_channel: + creds = ga_credentials.AnonymousCredentials() + file_creds = ga_credentials.AnonymousCredentials() + load_creds.return_value = (file_creds, None) + adc.return_value = (creds, None) + client = client_class(client_options=options, transport=transport_name) + create_channel.assert_called_with( + "privateca.googleapis.com:443", + credentials=file_creds, + credentials_file=None, + quota_project_id=None, + default_scopes=( + 'https://www.googleapis.com/auth/cloud-platform', +), + scopes=None, + default_host="privateca.googleapis.com", + ssl_credentials=None, + options=[ + ("grpc.max_send_message_length", -1), + ("grpc.max_receive_message_length", -1), + ], + ) + + +@pytest.mark.parametrize("request_type", [ + service.CreateCertificateRequest, + dict, +]) +def test_create_certificate(request_type, transport: str = 'grpc'): + client = CertificateAuthorityServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.create_certificate), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = resources.Certificate( + name='name_value', + issuer_certificate_authority='issuer_certificate_authority_value', + certificate_template='certificate_template_value', + subject_mode=resources.SubjectRequestMode.DEFAULT, + pem_certificate='pem_certificate_value', + 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'] + + +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=ga_credentials.AnonymousCredentials(), + transport='grpc', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.create_certificate), + '__call__') as call: + client.create_certificate() + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == service.CreateCertificateRequest() + +@pytest.mark.asyncio +async def test_create_certificate_async(transport: str = 'grpc_asyncio', request_type=service.CreateCertificateRequest): + client = CertificateAuthorityServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.create_certificate), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(resources.Certificate( + name='name_value', + issuer_certificate_authority='issuer_certificate_authority_value', + certificate_template='certificate_template_value', + subject_mode=resources.SubjectRequestMode.DEFAULT, + pem_certificate='pem_certificate_value', + 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'] + + +@pytest.mark.asyncio +async def test_create_certificate_async_from_dict(): + await test_create_certificate_async(request_type=dict) + + +def test_create_certificate_field_headers(): + client = CertificateAuthorityServiceClient( + 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. + with mock.patch.object( + 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. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ( + 'x-goog-request-params', + 'parent=parent_value', + ) in kw['metadata'] + + +@pytest.mark.asyncio +async def test_create_certificate_field_headers_async(): + client = CertificateAuthorityServiceAsyncClient( + 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. + with mock.patch.object( + type(client.transport.create_certificate), + '__call__') as call: + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(resources.Certificate()) + 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] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ( + 'x-goog-request-params', + 'parent=parent_value', + ) in kw['metadata'] + + +def test_create_certificate_flattened(): + client = CertificateAuthorityServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.create_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.create_certificate( + parent='parent_value', + certificate=resources.Certificate(name='name_value'), + certificate_id='certificate_id_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] + arg = args[0].parent + mock_val = 'parent_value' + assert arg == mock_val + arg = args[0].certificate + mock_val = resources.Certificate(name='name_value') + assert arg == mock_val + arg = args[0].certificate_id + mock_val = 'certificate_id_value' + assert arg == mock_val + + +def test_create_certificate_flattened_error(): + client = CertificateAuthorityServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + client.create_certificate( + service.CreateCertificateRequest(), + parent='parent_value', + certificate=resources.Certificate(name='name_value'), + certificate_id='certificate_id_value', + ) + +@pytest.mark.asyncio +async def test_create_certificate_flattened_async(): + client = CertificateAuthorityServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.create_certificate), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = resources.Certificate() + + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(resources.Certificate()) + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + response = await client.create_certificate( + parent='parent_value', + certificate=resources.Certificate(name='name_value'), + certificate_id='certificate_id_value', + ) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + arg = args[0].parent + mock_val = 'parent_value' + assert arg == mock_val + arg = args[0].certificate + mock_val = resources.Certificate(name='name_value') + assert arg == mock_val + arg = args[0].certificate_id + mock_val = 'certificate_id_value' + assert arg == mock_val + +@pytest.mark.asyncio +async def test_create_certificate_flattened_error_async(): + client = CertificateAuthorityServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + await client.create_certificate( + service.CreateCertificateRequest(), + parent='parent_value', + certificate=resources.Certificate(name='name_value'), + certificate_id='certificate_id_value', + ) + + +@pytest.mark.parametrize("request_type", [ + service.GetCertificateRequest, + dict, +]) +def test_get_certificate(request_type, transport: str = 'grpc'): + client = CertificateAuthorityServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # 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( + name='name_value', + issuer_certificate_authority='issuer_certificate_authority_value', + certificate_template='certificate_template_value', + subject_mode=resources.SubjectRequestMode.DEFAULT, + pem_certificate='pem_certificate_value', + 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'] + + +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=ga_credentials.AnonymousCredentials(), + transport='grpc', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.get_certificate), + '__call__') as call: + client.get_certificate() + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == service.GetCertificateRequest() + +@pytest.mark.asyncio +async def test_get_certificate_async(transport: str = 'grpc_asyncio', request_type=service.GetCertificateRequest): + client = CertificateAuthorityServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # 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 =grpc_helpers_async.FakeUnaryUnaryCall(resources.Certificate( + name='name_value', + issuer_certificate_authority='issuer_certificate_authority_value', + certificate_template='certificate_template_value', + subject_mode=resources.SubjectRequestMode.DEFAULT, + pem_certificate='pem_certificate_value', + 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'] + + +@pytest.mark.asyncio +async def test_get_certificate_async_from_dict(): + await test_get_certificate_async(request_type=dict) + + +def test_get_certificate_field_headers(): + client = CertificateAuthorityServiceClient( + 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. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ( + 'x-goog-request-params', + 'name=name_value', + ) in kw['metadata'] + + +@pytest.mark.asyncio +async def test_get_certificate_field_headers_async(): + client = CertificateAuthorityServiceAsyncClient( + 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 = grpc_helpers_async.FakeUnaryUnaryCall(resources.Certificate()) + 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] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ( + 'x-goog-request-params', + 'name=name_value', + ) in kw['metadata'] + + +def test_get_certificate_flattened(): + client = CertificateAuthorityServiceClient( + 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', + ) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + arg = args[0].name + mock_val = 'name_value' + assert arg == mock_val + + +def test_get_certificate_flattened_error(): + client = CertificateAuthorityServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + client.get_certificate( + service.GetCertificateRequest(), + name='name_value', + ) + +@pytest.mark.asyncio +async def test_get_certificate_flattened_async(): + client = CertificateAuthorityServiceAsyncClient( + 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.return_value = grpc_helpers_async.FakeUnaryUnaryCall(resources.Certificate()) + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + response = await client.get_certificate( + name='name_value', + ) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + arg = args[0].name + mock_val = 'name_value' + assert arg == mock_val + +@pytest.mark.asyncio +async def test_get_certificate_flattened_error_async(): + client = CertificateAuthorityServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + await client.get_certificate( + service.GetCertificateRequest(), + name='name_value', + ) + + +@pytest.mark.parametrize("request_type", [ + service.ListCertificatesRequest, + dict, +]) +def test_list_certificates(request_type, transport: str = 'grpc'): + client = CertificateAuthorityServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_certificates), + '__call__') as call: + # Designate an appropriate return value for the call. + 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'] + + +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=ga_credentials.AnonymousCredentials(), + transport='grpc', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_certificates), + '__call__') as call: + client.list_certificates() + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == service.ListCertificatesRequest() + +@pytest.mark.asyncio +async def test_list_certificates_async(transport: str = 'grpc_asyncio', request_type=service.ListCertificatesRequest): + client = CertificateAuthorityServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_certificates), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(service.ListCertificatesResponse( + next_page_token='next_page_token_value', + 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'] + + +@pytest.mark.asyncio +async def test_list_certificates_async_from_dict(): + await test_list_certificates_async(request_type=dict) + + +def test_list_certificates_field_headers(): + client = CertificateAuthorityServiceClient( + 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. + with mock.patch.object( + 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. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ( + 'x-goog-request-params', + 'parent=parent_value', + ) in kw['metadata'] + + +@pytest.mark.asyncio +async def test_list_certificates_field_headers_async(): + client = CertificateAuthorityServiceAsyncClient( + 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. + with mock.patch.object( + type(client.transport.list_certificates), + '__call__') as call: + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(service.ListCertificatesResponse()) + 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] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ( + 'x-goog-request-params', + 'parent=parent_value', + ) in kw['metadata'] + + +def test_list_certificates_flattened(): + client = CertificateAuthorityServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_certificates), + '__call__') 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', + ) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + arg = args[0].parent + mock_val = 'parent_value' + assert arg == mock_val + + +def test_list_certificates_flattened_error(): + client = CertificateAuthorityServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + client.list_certificates( + service.ListCertificatesRequest(), + parent='parent_value', + ) + +@pytest.mark.asyncio +async def test_list_certificates_flattened_async(): + client = CertificateAuthorityServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_certificates), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = service.ListCertificatesResponse() + + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(service.ListCertificatesResponse()) + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + response = await client.list_certificates( + parent='parent_value', + ) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + arg = args[0].parent + mock_val = 'parent_value' + assert arg == mock_val + +@pytest.mark.asyncio +async def test_list_certificates_flattened_error_async(): + client = CertificateAuthorityServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + await client.list_certificates( + service.ListCertificatesRequest(), + parent='parent_value', + ) + + +def test_list_certificates_pager(transport_name: str = "grpc"): + client = CertificateAuthorityServiceClient( + credentials=ga_credentials.AnonymousCredentials, + transport=transport_name, + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_certificates), + '__call__') as call: + # Set the response to a series of pages. + call.side_effect = ( + service.ListCertificatesResponse( + certificates=[ + resources.Certificate(), + resources.Certificate(), + resources.Certificate(), + ], + next_page_token='abc', + ), + service.ListCertificatesResponse( + certificates=[], + next_page_token='def', + ), + service.ListCertificatesResponse( + certificates=[ + resources.Certificate(), + ], + next_page_token='ghi', + ), + service.ListCertificatesResponse( + certificates=[ + resources.Certificate(), + resources.Certificate(), + ], + ), + RuntimeError, + ) + + metadata = () + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata(( + ('parent', ''), + )), + ) + pager = client.list_certificates(request={}) + + assert pager._metadata == metadata + + results = list(pager) + assert len(results) == 6 + assert all(isinstance(i, resources.Certificate) + for i in results) +def test_list_certificates_pages(transport_name: str = "grpc"): + client = CertificateAuthorityServiceClient( + credentials=ga_credentials.AnonymousCredentials, + transport=transport_name, + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_certificates), + '__call__') as call: + # Set the response to a series of pages. + call.side_effect = ( + service.ListCertificatesResponse( + certificates=[ + resources.Certificate(), + resources.Certificate(), + resources.Certificate(), + ], + next_page_token='abc', + ), + service.ListCertificatesResponse( + certificates=[], + next_page_token='def', + ), + service.ListCertificatesResponse( + certificates=[ + resources.Certificate(), + ], + next_page_token='ghi', + ), + service.ListCertificatesResponse( + certificates=[ + resources.Certificate(), + resources.Certificate(), + ], + ), + RuntimeError, + ) + pages = list(client.list_certificates(request={}).pages) + for page_, token in zip(pages, ['abc','def','ghi', '']): + assert page_.raw_page.next_page_token == token + +@pytest.mark.asyncio +async def test_list_certificates_async_pager(): + client = CertificateAuthorityServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials, + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_certificates), + '__call__', new_callable=mock.AsyncMock) as call: + # Set the response to a series of pages. + call.side_effect = ( + service.ListCertificatesResponse( + certificates=[ + resources.Certificate(), + resources.Certificate(), + resources.Certificate(), + ], + next_page_token='abc', + ), + service.ListCertificatesResponse( + certificates=[], + next_page_token='def', + ), + service.ListCertificatesResponse( + certificates=[ + resources.Certificate(), + ], + next_page_token='ghi', + ), + service.ListCertificatesResponse( + certificates=[ + resources.Certificate(), + resources.Certificate(), + ], + ), + RuntimeError, + ) + async_pager = await client.list_certificates(request={},) + assert async_pager.next_page_token == 'abc' + responses = [] + async for response in async_pager: # pragma: no branch + responses.append(response) + + assert len(responses) == 6 + assert all(isinstance(i, resources.Certificate) + for i in responses) + + +@pytest.mark.asyncio +async def test_list_certificates_async_pages(): + client = CertificateAuthorityServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials, + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_certificates), + '__call__', new_callable=mock.AsyncMock) as call: + # Set the response to a series of pages. + call.side_effect = ( + service.ListCertificatesResponse( + certificates=[ + resources.Certificate(), + resources.Certificate(), + resources.Certificate(), + ], + next_page_token='abc', + ), + service.ListCertificatesResponse( + certificates=[], + next_page_token='def', + ), + service.ListCertificatesResponse( + certificates=[ + resources.Certificate(), + ], + next_page_token='ghi', + ), + service.ListCertificatesResponse( + certificates=[ + resources.Certificate(), + resources.Certificate(), + ], + ), + RuntimeError, + ) + pages = [] + async for page_ in (await client.list_certificates(request={})).pages: # pragma: no branch + pages.append(page_) + for page_, token in zip(pages, ['abc','def','ghi', '']): + assert page_.raw_page.next_page_token == token + +@pytest.mark.parametrize("request_type", [ + service.RevokeCertificateRequest, + dict, +]) +def test_revoke_certificate(request_type, transport: str = 'grpc'): + client = CertificateAuthorityServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.revoke_certificate), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = resources.Certificate( + name='name_value', + issuer_certificate_authority='issuer_certificate_authority_value', + certificate_template='certificate_template_value', + subject_mode=resources.SubjectRequestMode.DEFAULT, + pem_certificate='pem_certificate_value', + 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'] + + +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=ga_credentials.AnonymousCredentials(), + transport='grpc', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.revoke_certificate), + '__call__') as call: + client.revoke_certificate() + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == service.RevokeCertificateRequest() + +@pytest.mark.asyncio +async def test_revoke_certificate_async(transport: str = 'grpc_asyncio', request_type=service.RevokeCertificateRequest): + client = CertificateAuthorityServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.revoke_certificate), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(resources.Certificate( + name='name_value', + issuer_certificate_authority='issuer_certificate_authority_value', + certificate_template='certificate_template_value', + subject_mode=resources.SubjectRequestMode.DEFAULT, + pem_certificate='pem_certificate_value', + 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'] + + +@pytest.mark.asyncio +async def test_revoke_certificate_async_from_dict(): + await test_revoke_certificate_async(request_type=dict) + + +def test_revoke_certificate_field_headers(): + client = CertificateAuthorityServiceClient( + 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. + with mock.patch.object( + 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. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ( + 'x-goog-request-params', + 'name=name_value', + ) in kw['metadata'] + + +@pytest.mark.asyncio +async def test_revoke_certificate_field_headers_async(): + client = CertificateAuthorityServiceAsyncClient( + 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. + with mock.patch.object( + type(client.transport.revoke_certificate), + '__call__') as call: + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(resources.Certificate()) + 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] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ( + 'x-goog-request-params', + 'name=name_value', + ) in kw['metadata'] + + +def test_revoke_certificate_flattened(): + client = CertificateAuthorityServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.revoke_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.revoke_certificate( + name='name_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] + arg = args[0].name + mock_val = 'name_value' + assert arg == mock_val + + +def test_revoke_certificate_flattened_error(): + client = CertificateAuthorityServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + client.revoke_certificate( + service.RevokeCertificateRequest(), + name='name_value', + ) + +@pytest.mark.asyncio +async def test_revoke_certificate_flattened_async(): + client = CertificateAuthorityServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.revoke_certificate), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = resources.Certificate() + + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(resources.Certificate()) + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + response = await client.revoke_certificate( + name='name_value', + ) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + arg = args[0].name + mock_val = 'name_value' + assert arg == mock_val + +@pytest.mark.asyncio +async def test_revoke_certificate_flattened_error_async(): + client = CertificateAuthorityServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + await client.revoke_certificate( + service.RevokeCertificateRequest(), + name='name_value', + ) + + +@pytest.mark.parametrize("request_type", [ + service.UpdateCertificateRequest, + dict, +]) +def test_update_certificate(request_type, transport: str = 'grpc'): + client = CertificateAuthorityServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.update_certificate), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = resources.Certificate( + name='name_value', + issuer_certificate_authority='issuer_certificate_authority_value', + certificate_template='certificate_template_value', + subject_mode=resources.SubjectRequestMode.DEFAULT, + pem_certificate='pem_certificate_value', + 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'] + + +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=ga_credentials.AnonymousCredentials(), + transport='grpc', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.update_certificate), + '__call__') as call: + client.update_certificate() + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == service.UpdateCertificateRequest() + +@pytest.mark.asyncio +async def test_update_certificate_async(transport: str = 'grpc_asyncio', request_type=service.UpdateCertificateRequest): + client = CertificateAuthorityServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.update_certificate), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(resources.Certificate( + name='name_value', + issuer_certificate_authority='issuer_certificate_authority_value', + certificate_template='certificate_template_value', + subject_mode=resources.SubjectRequestMode.DEFAULT, + pem_certificate='pem_certificate_value', + 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'] + + +@pytest.mark.asyncio +async def test_update_certificate_async_from_dict(): + await test_update_certificate_async(request_type=dict) + + +def test_update_certificate_field_headers(): + client = CertificateAuthorityServiceClient( + 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 = 'name_value' + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + 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. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ( + 'x-goog-request-params', + 'certificate.name=name_value', + ) in kw['metadata'] + + +@pytest.mark.asyncio +async def test_update_certificate_field_headers_async(): + client = CertificateAuthorityServiceAsyncClient( + 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 = 'name_value' + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.update_certificate), + '__call__') as call: + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(resources.Certificate()) + 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] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ( + 'x-goog-request-params', + 'certificate.name=name_value', + ) in kw['metadata'] + + +def test_update_certificate_flattened(): + client = CertificateAuthorityServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.update_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.update_certificate( + certificate=resources.Certificate(name='name_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] + arg = args[0].certificate + mock_val = resources.Certificate(name='name_value') + assert arg == mock_val + arg = args[0].update_mask + mock_val = field_mask_pb2.FieldMask(paths=['paths_value']) + assert arg == mock_val + + +def test_update_certificate_flattened_error(): + client = CertificateAuthorityServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + client.update_certificate( + service.UpdateCertificateRequest(), + certificate=resources.Certificate(name='name_value'), + update_mask=field_mask_pb2.FieldMask(paths=['paths_value']), + ) + +@pytest.mark.asyncio +async def test_update_certificate_flattened_async(): + client = CertificateAuthorityServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.update_certificate), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = resources.Certificate() + + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(resources.Certificate()) + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + response = await client.update_certificate( + certificate=resources.Certificate(name='name_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] + arg = args[0].certificate + mock_val = resources.Certificate(name='name_value') + assert arg == mock_val + arg = args[0].update_mask + mock_val = field_mask_pb2.FieldMask(paths=['paths_value']) + assert arg == mock_val + +@pytest.mark.asyncio +async def test_update_certificate_flattened_error_async(): + client = CertificateAuthorityServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + await client.update_certificate( + service.UpdateCertificateRequest(), + certificate=resources.Certificate(name='name_value'), + update_mask=field_mask_pb2.FieldMask(paths=['paths_value']), + ) + + +@pytest.mark.parametrize("request_type", [ + service.ActivateCertificateAuthorityRequest, + dict, +]) +def test_activate_certificate_authority(request_type, transport: str = 'grpc'): + client = CertificateAuthorityServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.activate_certificate_authority), + '__call__') 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. + assert isinstance(response, future.Future) + + +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=ga_credentials.AnonymousCredentials(), + transport='grpc', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.activate_certificate_authority), + '__call__') as call: + client.activate_certificate_authority() + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == service.ActivateCertificateAuthorityRequest() + +@pytest.mark.asyncio +async def test_activate_certificate_authority_async(transport: str = 'grpc_asyncio', request_type=service.ActivateCertificateAuthorityRequest): + client = CertificateAuthorityServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.activate_certificate_authority), + '__call__') as call: + # Designate an appropriate return value for the call. + 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. + assert isinstance(response, future.Future) + + +@pytest.mark.asyncio +async def test_activate_certificate_authority_async_from_dict(): + await test_activate_certificate_authority_async(request_type=dict) + + +def test_activate_certificate_authority_field_headers(): + client = CertificateAuthorityServiceClient( + 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. + with mock.patch.object( + 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. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ( + 'x-goog-request-params', + 'name=name_value', + ) in kw['metadata'] + + +@pytest.mark.asyncio +async def test_activate_certificate_authority_field_headers_async(): + client = CertificateAuthorityServiceAsyncClient( + 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. + with mock.patch.object( + type(client.transport.activate_certificate_authority), + '__call__') as call: + 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. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ( + 'x-goog-request-params', + 'name=name_value', + ) in kw['metadata'] + + +def test_activate_certificate_authority_flattened(): + client = CertificateAuthorityServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.activate_certificate_authority), + '__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.activate_certificate_authority( + name='name_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] + arg = args[0].name + mock_val = 'name_value' + assert arg == mock_val + + +def test_activate_certificate_authority_flattened_error(): + client = CertificateAuthorityServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + client.activate_certificate_authority( + service.ActivateCertificateAuthorityRequest(), + name='name_value', + ) + +@pytest.mark.asyncio +async def test_activate_certificate_authority_flattened_async(): + client = CertificateAuthorityServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.activate_certificate_authority), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = operations_pb2.Operation(name='operations/op') + + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + operations_pb2.Operation(name='operations/spam') + ) + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + response = await client.activate_certificate_authority( + name='name_value', + ) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + arg = args[0].name + mock_val = 'name_value' + assert arg == mock_val + +@pytest.mark.asyncio +async def test_activate_certificate_authority_flattened_error_async(): + client = CertificateAuthorityServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + await client.activate_certificate_authority( + service.ActivateCertificateAuthorityRequest(), + name='name_value', + ) + + +@pytest.mark.parametrize("request_type", [ + service.CreateCertificateAuthorityRequest, + dict, +]) +def test_create_certificate_authority(request_type, transport: str = 'grpc'): + client = CertificateAuthorityServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.create_certificate_authority), + '__call__') 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. + assert isinstance(response, future.Future) + + +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=ga_credentials.AnonymousCredentials(), + transport='grpc', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.create_certificate_authority), + '__call__') as call: + client.create_certificate_authority() + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == service.CreateCertificateAuthorityRequest() + +@pytest.mark.asyncio +async def test_create_certificate_authority_async(transport: str = 'grpc_asyncio', request_type=service.CreateCertificateAuthorityRequest): + client = CertificateAuthorityServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.create_certificate_authority), + '__call__') as call: + # Designate an appropriate return value for the call. + 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. + assert isinstance(response, future.Future) + + +@pytest.mark.asyncio +async def test_create_certificate_authority_async_from_dict(): + await test_create_certificate_authority_async(request_type=dict) + + +def test_create_certificate_authority_field_headers(): + client = CertificateAuthorityServiceClient( + 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. + with mock.patch.object( + 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. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ( + 'x-goog-request-params', + 'parent=parent_value', + ) in kw['metadata'] + + +@pytest.mark.asyncio +async def test_create_certificate_authority_field_headers_async(): + client = CertificateAuthorityServiceAsyncClient( + 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. + with mock.patch.object( + type(client.transport.create_certificate_authority), + '__call__') as call: + 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. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ( + 'x-goog-request-params', + 'parent=parent_value', + ) in kw['metadata'] + + +def test_create_certificate_authority_flattened(): + client = CertificateAuthorityServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.create_certificate_authority), + '__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_certificate_authority( + parent='parent_value', + certificate_authority=resources.CertificateAuthority(name='name_value'), + certificate_authority_id='certificate_authority_id_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] + arg = args[0].parent + mock_val = 'parent_value' + assert arg == mock_val + arg = args[0].certificate_authority + mock_val = resources.CertificateAuthority(name='name_value') + assert arg == mock_val + arg = args[0].certificate_authority_id + mock_val = 'certificate_authority_id_value' + assert arg == mock_val + + +def test_create_certificate_authority_flattened_error(): + client = CertificateAuthorityServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + client.create_certificate_authority( + service.CreateCertificateAuthorityRequest(), + parent='parent_value', + certificate_authority=resources.CertificateAuthority(name='name_value'), + certificate_authority_id='certificate_authority_id_value', + ) + +@pytest.mark.asyncio +async def test_create_certificate_authority_flattened_async(): + client = CertificateAuthorityServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.create_certificate_authority), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = operations_pb2.Operation(name='operations/op') + + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + operations_pb2.Operation(name='operations/spam') + ) + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + response = await client.create_certificate_authority( + parent='parent_value', + certificate_authority=resources.CertificateAuthority(name='name_value'), + certificate_authority_id='certificate_authority_id_value', + ) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + arg = args[0].parent + mock_val = 'parent_value' + assert arg == mock_val + arg = args[0].certificate_authority + mock_val = resources.CertificateAuthority(name='name_value') + assert arg == mock_val + arg = args[0].certificate_authority_id + mock_val = 'certificate_authority_id_value' + assert arg == mock_val + +@pytest.mark.asyncio +async def test_create_certificate_authority_flattened_error_async(): + client = CertificateAuthorityServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + await client.create_certificate_authority( + service.CreateCertificateAuthorityRequest(), + parent='parent_value', + certificate_authority=resources.CertificateAuthority(name='name_value'), + certificate_authority_id='certificate_authority_id_value', + ) + + +@pytest.mark.parametrize("request_type", [ + service.DisableCertificateAuthorityRequest, + dict, +]) +def test_disable_certificate_authority(request_type, transport: str = 'grpc'): + client = CertificateAuthorityServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.disable_certificate_authority), + '__call__') 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. + assert isinstance(response, future.Future) + + +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=ga_credentials.AnonymousCredentials(), + transport='grpc', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.disable_certificate_authority), + '__call__') as call: + client.disable_certificate_authority() + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == service.DisableCertificateAuthorityRequest() + +@pytest.mark.asyncio +async def test_disable_certificate_authority_async(transport: str = 'grpc_asyncio', request_type=service.DisableCertificateAuthorityRequest): + client = CertificateAuthorityServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.disable_certificate_authority), + '__call__') as call: + # Designate an appropriate return value for the call. + 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. + assert isinstance(response, future.Future) + + +@pytest.mark.asyncio +async def test_disable_certificate_authority_async_from_dict(): + await test_disable_certificate_authority_async(request_type=dict) + + +def test_disable_certificate_authority_field_headers(): + client = CertificateAuthorityServiceClient( + 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. + with mock.patch.object( + 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. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ( + 'x-goog-request-params', + 'name=name_value', + ) in kw['metadata'] + + +@pytest.mark.asyncio +async def test_disable_certificate_authority_field_headers_async(): + client = CertificateAuthorityServiceAsyncClient( + 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. + with mock.patch.object( + type(client.transport.disable_certificate_authority), + '__call__') as call: + 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. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ( + 'x-goog-request-params', + 'name=name_value', + ) in kw['metadata'] + + +def test_disable_certificate_authority_flattened(): + client = CertificateAuthorityServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.disable_certificate_authority), + '__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.disable_certificate_authority( + name='name_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] + arg = args[0].name + mock_val = 'name_value' + assert arg == mock_val + + +def test_disable_certificate_authority_flattened_error(): + client = CertificateAuthorityServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + client.disable_certificate_authority( + service.DisableCertificateAuthorityRequest(), + name='name_value', + ) + +@pytest.mark.asyncio +async def test_disable_certificate_authority_flattened_async(): + client = CertificateAuthorityServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.disable_certificate_authority), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = operations_pb2.Operation(name='operations/op') + + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + operations_pb2.Operation(name='operations/spam') + ) + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + response = await client.disable_certificate_authority( + name='name_value', + ) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + arg = args[0].name + mock_val = 'name_value' + assert arg == mock_val + +@pytest.mark.asyncio +async def test_disable_certificate_authority_flattened_error_async(): + client = CertificateAuthorityServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + await client.disable_certificate_authority( + service.DisableCertificateAuthorityRequest(), + name='name_value', + ) + + +@pytest.mark.parametrize("request_type", [ + service.EnableCertificateAuthorityRequest, + dict, +]) +def test_enable_certificate_authority(request_type, transport: str = 'grpc'): + client = CertificateAuthorityServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.enable_certificate_authority), + '__call__') 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. + assert isinstance(response, future.Future) + + +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=ga_credentials.AnonymousCredentials(), + transport='grpc', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.enable_certificate_authority), + '__call__') as call: + client.enable_certificate_authority() + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == service.EnableCertificateAuthorityRequest() + +@pytest.mark.asyncio +async def test_enable_certificate_authority_async(transport: str = 'grpc_asyncio', request_type=service.EnableCertificateAuthorityRequest): + client = CertificateAuthorityServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.enable_certificate_authority), + '__call__') as call: + # Designate an appropriate return value for the call. + 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. + assert isinstance(response, future.Future) + + +@pytest.mark.asyncio +async def test_enable_certificate_authority_async_from_dict(): + await test_enable_certificate_authority_async(request_type=dict) + + +def test_enable_certificate_authority_field_headers(): + client = CertificateAuthorityServiceClient( + 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. + with mock.patch.object( + 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. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ( + 'x-goog-request-params', + 'name=name_value', + ) in kw['metadata'] + + +@pytest.mark.asyncio +async def test_enable_certificate_authority_field_headers_async(): + client = CertificateAuthorityServiceAsyncClient( + 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. + with mock.patch.object( + type(client.transport.enable_certificate_authority), + '__call__') as call: + 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. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ( + 'x-goog-request-params', + 'name=name_value', + ) in kw['metadata'] + + +def test_enable_certificate_authority_flattened(): + client = CertificateAuthorityServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.enable_certificate_authority), + '__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.enable_certificate_authority( + name='name_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] + arg = args[0].name + mock_val = 'name_value' + assert arg == mock_val + + +def test_enable_certificate_authority_flattened_error(): + client = CertificateAuthorityServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + client.enable_certificate_authority( + service.EnableCertificateAuthorityRequest(), + name='name_value', + ) + +@pytest.mark.asyncio +async def test_enable_certificate_authority_flattened_async(): + client = CertificateAuthorityServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.enable_certificate_authority), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = operations_pb2.Operation(name='operations/op') + + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + operations_pb2.Operation(name='operations/spam') + ) + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + response = await client.enable_certificate_authority( + name='name_value', + ) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + arg = args[0].name + mock_val = 'name_value' + assert arg == mock_val + +@pytest.mark.asyncio +async def test_enable_certificate_authority_flattened_error_async(): + client = CertificateAuthorityServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + await client.enable_certificate_authority( + service.EnableCertificateAuthorityRequest(), + name='name_value', + ) + + +@pytest.mark.parametrize("request_type", [ + service.FetchCertificateAuthorityCsrRequest, + dict, +]) +def test_fetch_certificate_authority_csr(request_type, transport: str = 'grpc'): + client = CertificateAuthorityServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.fetch_certificate_authority_csr), + '__call__') as call: + # Designate an appropriate return value for the call. + 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' + + +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=ga_credentials.AnonymousCredentials(), + transport='grpc', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.fetch_certificate_authority_csr), + '__call__') as call: + client.fetch_certificate_authority_csr() + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == service.FetchCertificateAuthorityCsrRequest() + +@pytest.mark.asyncio +async def test_fetch_certificate_authority_csr_async(transport: str = 'grpc_asyncio', request_type=service.FetchCertificateAuthorityCsrRequest): + client = CertificateAuthorityServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.fetch_certificate_authority_csr), + '__call__') as call: + # Designate an appropriate return value for the call. + 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' + + +@pytest.mark.asyncio +async def test_fetch_certificate_authority_csr_async_from_dict(): + await test_fetch_certificate_authority_csr_async(request_type=dict) + + +def test_fetch_certificate_authority_csr_field_headers(): + client = CertificateAuthorityServiceClient( + 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. + with mock.patch.object( + 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. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ( + 'x-goog-request-params', + 'name=name_value', + ) in kw['metadata'] + + +@pytest.mark.asyncio +async def test_fetch_certificate_authority_csr_field_headers_async(): + client = CertificateAuthorityServiceAsyncClient( + 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. + with mock.patch.object( + type(client.transport.fetch_certificate_authority_csr), + '__call__') as call: + 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. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ( + 'x-goog-request-params', + 'name=name_value', + ) in kw['metadata'] + + +def test_fetch_certificate_authority_csr_flattened(): + client = CertificateAuthorityServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.fetch_certificate_authority_csr), + '__call__') 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', + ) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + arg = args[0].name + mock_val = 'name_value' + assert arg == mock_val + + +def test_fetch_certificate_authority_csr_flattened_error(): + client = CertificateAuthorityServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + client.fetch_certificate_authority_csr( + service.FetchCertificateAuthorityCsrRequest(), + name='name_value', + ) + +@pytest.mark.asyncio +async def test_fetch_certificate_authority_csr_flattened_async(): + client = CertificateAuthorityServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.fetch_certificate_authority_csr), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = service.FetchCertificateAuthorityCsrResponse() + + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(service.FetchCertificateAuthorityCsrResponse()) + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + response = await client.fetch_certificate_authority_csr( + name='name_value', + ) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + arg = args[0].name + mock_val = 'name_value' + assert arg == mock_val + +@pytest.mark.asyncio +async def test_fetch_certificate_authority_csr_flattened_error_async(): + client = CertificateAuthorityServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + await client.fetch_certificate_authority_csr( + service.FetchCertificateAuthorityCsrRequest(), + name='name_value', + ) + + +@pytest.mark.parametrize("request_type", [ + service.GetCertificateAuthorityRequest, + dict, +]) +def test_get_certificate_authority(request_type, transport: str = 'grpc'): + client = CertificateAuthorityServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.get_certificate_authority), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = resources.CertificateAuthority( + name='name_value', + type_=resources.CertificateAuthority.Type.SELF_SIGNED, + tier=resources.CaPool.Tier.ENTERPRISE, + state=resources.CertificateAuthority.State.ENABLED, + 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' + + +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=ga_credentials.AnonymousCredentials(), + transport='grpc', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.get_certificate_authority), + '__call__') as call: + client.get_certificate_authority() + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == service.GetCertificateAuthorityRequest() + +@pytest.mark.asyncio +async def test_get_certificate_authority_async(transport: str = 'grpc_asyncio', request_type=service.GetCertificateAuthorityRequest): + client = CertificateAuthorityServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.get_certificate_authority), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(resources.CertificateAuthority( + name='name_value', + type_=resources.CertificateAuthority.Type.SELF_SIGNED, + tier=resources.CaPool.Tier.ENTERPRISE, + state=resources.CertificateAuthority.State.ENABLED, + pem_ca_certificates=['pem_ca_certificates_value'], + 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' + + +@pytest.mark.asyncio +async def test_get_certificate_authority_async_from_dict(): + await test_get_certificate_authority_async(request_type=dict) + + +def test_get_certificate_authority_field_headers(): + client = CertificateAuthorityServiceClient( + 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. + with mock.patch.object( + 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. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ( + 'x-goog-request-params', + 'name=name_value', + ) in kw['metadata'] + + +@pytest.mark.asyncio +async def test_get_certificate_authority_field_headers_async(): + client = CertificateAuthorityServiceAsyncClient( + 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. + with mock.patch.object( + type(client.transport.get_certificate_authority), + '__call__') as call: + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(resources.CertificateAuthority()) + 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] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ( + 'x-goog-request-params', + 'name=name_value', + ) in kw['metadata'] + + +def test_get_certificate_authority_flattened(): + client = CertificateAuthorityServiceClient( + 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_authority), + '__call__') 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', + ) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + arg = args[0].name + mock_val = 'name_value' + assert arg == mock_val + + +def test_get_certificate_authority_flattened_error(): + client = CertificateAuthorityServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + client.get_certificate_authority( + service.GetCertificateAuthorityRequest(), + name='name_value', + ) + +@pytest.mark.asyncio +async def test_get_certificate_authority_flattened_async(): + client = CertificateAuthorityServiceAsyncClient( + 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_authority), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = resources.CertificateAuthority() + + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(resources.CertificateAuthority()) + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + response = await client.get_certificate_authority( + name='name_value', + ) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + arg = args[0].name + mock_val = 'name_value' + assert arg == mock_val + +@pytest.mark.asyncio +async def test_get_certificate_authority_flattened_error_async(): + client = CertificateAuthorityServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + await client.get_certificate_authority( + service.GetCertificateAuthorityRequest(), + name='name_value', + ) + + +@pytest.mark.parametrize("request_type", [ + service.ListCertificateAuthoritiesRequest, + dict, +]) +def test_list_certificate_authorities(request_type, transport: str = 'grpc'): + client = CertificateAuthorityServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_certificate_authorities), + '__call__') as call: + # Designate an appropriate return value for the call. + 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'] + + +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=ga_credentials.AnonymousCredentials(), + transport='grpc', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_certificate_authorities), + '__call__') as call: + client.list_certificate_authorities() + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == service.ListCertificateAuthoritiesRequest() + +@pytest.mark.asyncio +async def test_list_certificate_authorities_async(transport: str = 'grpc_asyncio', request_type=service.ListCertificateAuthoritiesRequest): + client = CertificateAuthorityServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_certificate_authorities), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(service.ListCertificateAuthoritiesResponse( + next_page_token='next_page_token_value', + 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'] + + +@pytest.mark.asyncio +async def test_list_certificate_authorities_async_from_dict(): + await test_list_certificate_authorities_async(request_type=dict) + + +def test_list_certificate_authorities_field_headers(): + client = CertificateAuthorityServiceClient( + 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. + with mock.patch.object( + 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. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ( + 'x-goog-request-params', + 'parent=parent_value', + ) in kw['metadata'] + + +@pytest.mark.asyncio +async def test_list_certificate_authorities_field_headers_async(): + client = CertificateAuthorityServiceAsyncClient( + 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. + with mock.patch.object( + type(client.transport.list_certificate_authorities), + '__call__') as call: + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(service.ListCertificateAuthoritiesResponse()) + 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] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ( + 'x-goog-request-params', + 'parent=parent_value', + ) in kw['metadata'] + + +def test_list_certificate_authorities_flattened(): + client = CertificateAuthorityServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_certificate_authorities), + '__call__') 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', + ) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + arg = args[0].parent + mock_val = 'parent_value' + assert arg == mock_val + + +def test_list_certificate_authorities_flattened_error(): + client = CertificateAuthorityServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + client.list_certificate_authorities( + service.ListCertificateAuthoritiesRequest(), + parent='parent_value', + ) + +@pytest.mark.asyncio +async def test_list_certificate_authorities_flattened_async(): + client = CertificateAuthorityServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_certificate_authorities), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = service.ListCertificateAuthoritiesResponse() + + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(service.ListCertificateAuthoritiesResponse()) + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + response = await client.list_certificate_authorities( + parent='parent_value', + ) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + arg = args[0].parent + mock_val = 'parent_value' + assert arg == mock_val + +@pytest.mark.asyncio +async def test_list_certificate_authorities_flattened_error_async(): + client = CertificateAuthorityServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + await client.list_certificate_authorities( + service.ListCertificateAuthoritiesRequest(), + parent='parent_value', + ) + + +def test_list_certificate_authorities_pager(transport_name: str = "grpc"): + client = CertificateAuthorityServiceClient( + credentials=ga_credentials.AnonymousCredentials, + transport=transport_name, + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_certificate_authorities), + '__call__') as call: + # Set the response to a series of pages. + call.side_effect = ( + service.ListCertificateAuthoritiesResponse( + certificate_authorities=[ + resources.CertificateAuthority(), + resources.CertificateAuthority(), + resources.CertificateAuthority(), + ], + next_page_token='abc', + ), + service.ListCertificateAuthoritiesResponse( + certificate_authorities=[], + next_page_token='def', + ), + service.ListCertificateAuthoritiesResponse( + certificate_authorities=[ + resources.CertificateAuthority(), + ], + next_page_token='ghi', + ), + service.ListCertificateAuthoritiesResponse( + certificate_authorities=[ + resources.CertificateAuthority(), + resources.CertificateAuthority(), + ], + ), + RuntimeError, + ) + + metadata = () + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata(( + ('parent', ''), + )), + ) + pager = client.list_certificate_authorities(request={}) + + assert pager._metadata == metadata + + results = list(pager) + assert len(results) == 6 + assert all(isinstance(i, resources.CertificateAuthority) + for i in results) +def test_list_certificate_authorities_pages(transport_name: str = "grpc"): + client = CertificateAuthorityServiceClient( + credentials=ga_credentials.AnonymousCredentials, + transport=transport_name, + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_certificate_authorities), + '__call__') as call: + # Set the response to a series of pages. + call.side_effect = ( + service.ListCertificateAuthoritiesResponse( + certificate_authorities=[ + resources.CertificateAuthority(), + resources.CertificateAuthority(), + resources.CertificateAuthority(), + ], + next_page_token='abc', + ), + service.ListCertificateAuthoritiesResponse( + certificate_authorities=[], + next_page_token='def', + ), + service.ListCertificateAuthoritiesResponse( + certificate_authorities=[ + resources.CertificateAuthority(), + ], + next_page_token='ghi', + ), + service.ListCertificateAuthoritiesResponse( + certificate_authorities=[ + resources.CertificateAuthority(), + resources.CertificateAuthority(), + ], + ), + RuntimeError, + ) + pages = list(client.list_certificate_authorities(request={}).pages) + for page_, token in zip(pages, ['abc','def','ghi', '']): + assert page_.raw_page.next_page_token == token + +@pytest.mark.asyncio +async def test_list_certificate_authorities_async_pager(): + client = CertificateAuthorityServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials, + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_certificate_authorities), + '__call__', new_callable=mock.AsyncMock) as call: + # Set the response to a series of pages. + call.side_effect = ( + service.ListCertificateAuthoritiesResponse( + certificate_authorities=[ + resources.CertificateAuthority(), + resources.CertificateAuthority(), + resources.CertificateAuthority(), + ], + next_page_token='abc', + ), + service.ListCertificateAuthoritiesResponse( + certificate_authorities=[], + next_page_token='def', + ), + service.ListCertificateAuthoritiesResponse( + certificate_authorities=[ + resources.CertificateAuthority(), + ], + next_page_token='ghi', + ), + service.ListCertificateAuthoritiesResponse( + certificate_authorities=[ + resources.CertificateAuthority(), + resources.CertificateAuthority(), + ], + ), + RuntimeError, + ) + async_pager = await client.list_certificate_authorities(request={},) + assert async_pager.next_page_token == 'abc' + responses = [] + async for response in async_pager: # pragma: no branch + responses.append(response) + + assert len(responses) == 6 + assert all(isinstance(i, resources.CertificateAuthority) + for i in responses) + + +@pytest.mark.asyncio +async def test_list_certificate_authorities_async_pages(): + client = CertificateAuthorityServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials, + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_certificate_authorities), + '__call__', new_callable=mock.AsyncMock) as call: + # Set the response to a series of pages. + call.side_effect = ( + service.ListCertificateAuthoritiesResponse( + certificate_authorities=[ + resources.CertificateAuthority(), + resources.CertificateAuthority(), + resources.CertificateAuthority(), + ], + next_page_token='abc', + ), + service.ListCertificateAuthoritiesResponse( + certificate_authorities=[], + next_page_token='def', + ), + service.ListCertificateAuthoritiesResponse( + certificate_authorities=[ + resources.CertificateAuthority(), + ], + next_page_token='ghi', + ), + service.ListCertificateAuthoritiesResponse( + certificate_authorities=[ + resources.CertificateAuthority(), + resources.CertificateAuthority(), + ], + ), + RuntimeError, + ) + pages = [] + async for page_ in (await client.list_certificate_authorities(request={})).pages: # pragma: no branch + pages.append(page_) + for page_, token in zip(pages, ['abc','def','ghi', '']): + assert page_.raw_page.next_page_token == token + +@pytest.mark.parametrize("request_type", [ + service.UndeleteCertificateAuthorityRequest, + dict, +]) +def test_undelete_certificate_authority(request_type, transport: str = 'grpc'): + client = CertificateAuthorityServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.undelete_certificate_authority), + '__call__') 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. + assert isinstance(response, future.Future) + + +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=ga_credentials.AnonymousCredentials(), + transport='grpc', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.undelete_certificate_authority), + '__call__') as call: + client.undelete_certificate_authority() + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == service.UndeleteCertificateAuthorityRequest() + +@pytest.mark.asyncio +async def test_undelete_certificate_authority_async(transport: str = 'grpc_asyncio', request_type=service.UndeleteCertificateAuthorityRequest): + client = CertificateAuthorityServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.undelete_certificate_authority), + '__call__') as call: + # Designate an appropriate return value for the call. + 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. + assert isinstance(response, future.Future) + + +@pytest.mark.asyncio +async def test_undelete_certificate_authority_async_from_dict(): + await test_undelete_certificate_authority_async(request_type=dict) + + +def test_undelete_certificate_authority_field_headers(): + client = CertificateAuthorityServiceClient( + 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. + with mock.patch.object( + 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. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ( + 'x-goog-request-params', + 'name=name_value', + ) in kw['metadata'] + + +@pytest.mark.asyncio +async def test_undelete_certificate_authority_field_headers_async(): + client = CertificateAuthorityServiceAsyncClient( + 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. + with mock.patch.object( + type(client.transport.undelete_certificate_authority), + '__call__') as call: + 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. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ( + 'x-goog-request-params', + 'name=name_value', + ) in kw['metadata'] + + +def test_undelete_certificate_authority_flattened(): + client = CertificateAuthorityServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.undelete_certificate_authority), + '__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.undelete_certificate_authority( + name='name_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] + arg = args[0].name + mock_val = 'name_value' + assert arg == mock_val + + +def test_undelete_certificate_authority_flattened_error(): + client = CertificateAuthorityServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + client.undelete_certificate_authority( + service.UndeleteCertificateAuthorityRequest(), + name='name_value', + ) + +@pytest.mark.asyncio +async def test_undelete_certificate_authority_flattened_async(): + client = CertificateAuthorityServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.undelete_certificate_authority), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = operations_pb2.Operation(name='operations/op') + + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + operations_pb2.Operation(name='operations/spam') + ) + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + response = await client.undelete_certificate_authority( + name='name_value', + ) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + arg = args[0].name + mock_val = 'name_value' + assert arg == mock_val + +@pytest.mark.asyncio +async def test_undelete_certificate_authority_flattened_error_async(): + client = CertificateAuthorityServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + await client.undelete_certificate_authority( + service.UndeleteCertificateAuthorityRequest(), + name='name_value', + ) + + +@pytest.mark.parametrize("request_type", [ + service.DeleteCertificateAuthorityRequest, + dict, +]) +def test_delete_certificate_authority(request_type, transport: str = 'grpc'): + client = CertificateAuthorityServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.delete_certificate_authority), + '__call__') 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. + assert isinstance(response, future.Future) + + +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=ga_credentials.AnonymousCredentials(), + transport='grpc', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.delete_certificate_authority), + '__call__') as call: + client.delete_certificate_authority() + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == service.DeleteCertificateAuthorityRequest() + +@pytest.mark.asyncio +async def test_delete_certificate_authority_async(transport: str = 'grpc_asyncio', request_type=service.DeleteCertificateAuthorityRequest): + client = CertificateAuthorityServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.delete_certificate_authority), + '__call__') as call: + # Designate an appropriate return value for the call. + 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. + assert isinstance(response, future.Future) + + +@pytest.mark.asyncio +async def test_delete_certificate_authority_async_from_dict(): + await test_delete_certificate_authority_async(request_type=dict) + + +def test_delete_certificate_authority_field_headers(): + client = CertificateAuthorityServiceClient( + 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. + with mock.patch.object( + 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. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ( + 'x-goog-request-params', + 'name=name_value', + ) in kw['metadata'] + + +@pytest.mark.asyncio +async def test_delete_certificate_authority_field_headers_async(): + client = CertificateAuthorityServiceAsyncClient( + 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. + with mock.patch.object( + type(client.transport.delete_certificate_authority), + '__call__') as call: + 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. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ( + 'x-goog-request-params', + 'name=name_value', + ) in kw['metadata'] + + +def test_delete_certificate_authority_flattened(): + client = CertificateAuthorityServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.delete_certificate_authority), + '__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_certificate_authority( + name='name_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] + arg = args[0].name + mock_val = 'name_value' + assert arg == mock_val + + +def test_delete_certificate_authority_flattened_error(): + client = CertificateAuthorityServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + client.delete_certificate_authority( + service.DeleteCertificateAuthorityRequest(), + name='name_value', + ) + +@pytest.mark.asyncio +async def test_delete_certificate_authority_flattened_async(): + client = CertificateAuthorityServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.delete_certificate_authority), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = operations_pb2.Operation(name='operations/op') + + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + operations_pb2.Operation(name='operations/spam') + ) + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + response = await client.delete_certificate_authority( + name='name_value', + ) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + arg = args[0].name + mock_val = 'name_value' + assert arg == mock_val + +@pytest.mark.asyncio +async def test_delete_certificate_authority_flattened_error_async(): + client = CertificateAuthorityServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + await client.delete_certificate_authority( + service.DeleteCertificateAuthorityRequest(), + name='name_value', + ) + + +@pytest.mark.parametrize("request_type", [ + service.UpdateCertificateAuthorityRequest, + dict, +]) +def test_update_certificate_authority(request_type, transport: str = 'grpc'): + client = CertificateAuthorityServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.update_certificate_authority), + '__call__') 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. + assert isinstance(response, future.Future) + + +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=ga_credentials.AnonymousCredentials(), + transport='grpc', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.update_certificate_authority), + '__call__') as call: + client.update_certificate_authority() + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == service.UpdateCertificateAuthorityRequest() + +@pytest.mark.asyncio +async def test_update_certificate_authority_async(transport: str = 'grpc_asyncio', request_type=service.UpdateCertificateAuthorityRequest): + client = CertificateAuthorityServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.update_certificate_authority), + '__call__') as call: + # Designate an appropriate return value for the call. + 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. + assert isinstance(response, future.Future) + + +@pytest.mark.asyncio +async def test_update_certificate_authority_async_from_dict(): + await test_update_certificate_authority_async(request_type=dict) + + +def test_update_certificate_authority_field_headers(): + client = CertificateAuthorityServiceClient( + 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 = 'name_value' + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + 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. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ( + 'x-goog-request-params', + 'certificate_authority.name=name_value', + ) in kw['metadata'] + + +@pytest.mark.asyncio +async def test_update_certificate_authority_field_headers_async(): + client = CertificateAuthorityServiceAsyncClient( + 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 = 'name_value' + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.update_certificate_authority), + '__call__') as call: + 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. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ( + 'x-goog-request-params', + 'certificate_authority.name=name_value', + ) in kw['metadata'] + + +def test_update_certificate_authority_flattened(): + client = CertificateAuthorityServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.update_certificate_authority), + '__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_certificate_authority( + certificate_authority=resources.CertificateAuthority(name='name_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] + arg = args[0].certificate_authority + mock_val = resources.CertificateAuthority(name='name_value') + assert arg == mock_val + arg = args[0].update_mask + mock_val = field_mask_pb2.FieldMask(paths=['paths_value']) + assert arg == mock_val + + +def test_update_certificate_authority_flattened_error(): + client = CertificateAuthorityServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + client.update_certificate_authority( + service.UpdateCertificateAuthorityRequest(), + certificate_authority=resources.CertificateAuthority(name='name_value'), + update_mask=field_mask_pb2.FieldMask(paths=['paths_value']), + ) + +@pytest.mark.asyncio +async def test_update_certificate_authority_flattened_async(): + client = CertificateAuthorityServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.update_certificate_authority), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = operations_pb2.Operation(name='operations/op') + + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + operations_pb2.Operation(name='operations/spam') + ) + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + response = await client.update_certificate_authority( + certificate_authority=resources.CertificateAuthority(name='name_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] + arg = args[0].certificate_authority + mock_val = resources.CertificateAuthority(name='name_value') + assert arg == mock_val + arg = args[0].update_mask + mock_val = field_mask_pb2.FieldMask(paths=['paths_value']) + assert arg == mock_val + +@pytest.mark.asyncio +async def test_update_certificate_authority_flattened_error_async(): + client = CertificateAuthorityServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + await client.update_certificate_authority( + service.UpdateCertificateAuthorityRequest(), + certificate_authority=resources.CertificateAuthority(name='name_value'), + update_mask=field_mask_pb2.FieldMask(paths=['paths_value']), + ) + + +@pytest.mark.parametrize("request_type", [ + service.CreateCaPoolRequest, + dict, +]) +def test_create_ca_pool(request_type, transport: str = 'grpc'): + client = CertificateAuthorityServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # 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/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. + assert isinstance(response, future.Future) + + +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=ga_credentials.AnonymousCredentials(), + transport='grpc', + ) + + # 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: + client.create_ca_pool() + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == service.CreateCaPoolRequest() + +@pytest.mark.asyncio +async def test_create_ca_pool_async(transport: str = 'grpc_asyncio', request_type=service.CreateCaPoolRequest): + client = CertificateAuthorityServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # 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 = 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. + assert isinstance(response, future.Future) + + +@pytest.mark.asyncio +async def test_create_ca_pool_async_from_dict(): + await test_create_ca_pool_async(request_type=dict) + + +def test_create_ca_pool_field_headers(): + client = CertificateAuthorityServiceClient( + 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. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ( + 'x-goog-request-params', + 'parent=parent_value', + ) in kw['metadata'] + + +@pytest.mark.asyncio +async def test_create_ca_pool_field_headers_async(): + client = CertificateAuthorityServiceAsyncClient( + 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 = 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. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ( + 'x-goog-request-params', + 'parent=parent_value', + ) in kw['metadata'] + + +def test_create_ca_pool_flattened(): + client = CertificateAuthorityServiceClient( + 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( + parent='parent_value', + ca_pool=resources.CaPool(name='name_value'), + ca_pool_id='ca_pool_id_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] + arg = args[0].parent + mock_val = 'parent_value' + assert arg == mock_val + arg = args[0].ca_pool + mock_val = resources.CaPool(name='name_value') + assert arg == mock_val + arg = args[0].ca_pool_id + mock_val = 'ca_pool_id_value' + assert arg == mock_val + + +def test_create_ca_pool_flattened_error(): + client = CertificateAuthorityServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + client.create_ca_pool( + service.CreateCaPoolRequest(), + parent='parent_value', + ca_pool=resources.CaPool(name='name_value'), + ca_pool_id='ca_pool_id_value', + ) + +@pytest.mark.asyncio +async def test_create_ca_pool_flattened_async(): + client = CertificateAuthorityServiceAsyncClient( + 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.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + operations_pb2.Operation(name='operations/spam') + ) + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + response = await client.create_ca_pool( + parent='parent_value', + ca_pool=resources.CaPool(name='name_value'), + ca_pool_id='ca_pool_id_value', + ) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + arg = args[0].parent + mock_val = 'parent_value' + assert arg == mock_val + arg = args[0].ca_pool + mock_val = resources.CaPool(name='name_value') + assert arg == mock_val + arg = args[0].ca_pool_id + mock_val = 'ca_pool_id_value' + assert arg == mock_val + +@pytest.mark.asyncio +async def test_create_ca_pool_flattened_error_async(): + client = CertificateAuthorityServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + await client.create_ca_pool( + service.CreateCaPoolRequest(), + parent='parent_value', + ca_pool=resources.CaPool(name='name_value'), + ca_pool_id='ca_pool_id_value', + ) + + +@pytest.mark.parametrize("request_type", [ + service.UpdateCaPoolRequest, + dict, +]) +def test_update_ca_pool(request_type, transport: str = 'grpc'): + client = CertificateAuthorityServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # 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/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. + assert isinstance(response, future.Future) + + +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=ga_credentials.AnonymousCredentials(), + transport='grpc', + ) + + # 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: + client.update_ca_pool() + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == service.UpdateCaPoolRequest() + +@pytest.mark.asyncio +async def test_update_ca_pool_async(transport: str = 'grpc_asyncio', request_type=service.UpdateCaPoolRequest): + client = CertificateAuthorityServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # 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 = 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. + assert isinstance(response, future.Future) + + +@pytest.mark.asyncio +async def test_update_ca_pool_async_from_dict(): + await test_update_ca_pool_async(request_type=dict) + + +def test_update_ca_pool_field_headers(): + client = CertificateAuthorityServiceClient( + 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 = '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. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ( + 'x-goog-request-params', + 'ca_pool.name=name_value', + ) in kw['metadata'] + + +@pytest.mark.asyncio +async def test_update_ca_pool_field_headers_async(): + client = CertificateAuthorityServiceAsyncClient( + 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 = '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 = 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. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ( + 'x-goog-request-params', + 'ca_pool.name=name_value', + ) in kw['metadata'] + + +def test_update_ca_pool_flattened(): + client = CertificateAuthorityServiceClient( + 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_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] + arg = args[0].ca_pool + mock_val = resources.CaPool(name='name_value') + assert arg == mock_val + arg = args[0].update_mask + mock_val = field_mask_pb2.FieldMask(paths=['paths_value']) + assert arg == mock_val + + +def test_update_ca_pool_flattened_error(): + client = CertificateAuthorityServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + client.update_ca_pool( + service.UpdateCaPoolRequest(), + ca_pool=resources.CaPool(name='name_value'), + update_mask=field_mask_pb2.FieldMask(paths=['paths_value']), + ) + +@pytest.mark.asyncio +async def test_update_ca_pool_flattened_async(): + client = CertificateAuthorityServiceAsyncClient( + 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.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + operations_pb2.Operation(name='operations/spam') + ) + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + response = await client.update_ca_pool( + ca_pool=resources.CaPool(name='name_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] + arg = args[0].ca_pool + mock_val = resources.CaPool(name='name_value') + assert arg == mock_val + arg = args[0].update_mask + mock_val = field_mask_pb2.FieldMask(paths=['paths_value']) + assert arg == mock_val + +@pytest.mark.asyncio +async def test_update_ca_pool_flattened_error_async(): + client = CertificateAuthorityServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + await client.update_ca_pool( + service.UpdateCaPoolRequest(), + ca_pool=resources.CaPool(name='name_value'), + update_mask=field_mask_pb2.FieldMask(paths=['paths_value']), + ) + + +@pytest.mark.parametrize("request_type", [ + service.GetCaPoolRequest, + dict, +]) +def test_get_ca_pool(request_type, transport: str = 'grpc'): + client = CertificateAuthorityServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # 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( + 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 + + +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=ga_credentials.AnonymousCredentials(), + transport='grpc', + ) + + # 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: + client.get_ca_pool() + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == service.GetCaPoolRequest() + +@pytest.mark.asyncio +async def test_get_ca_pool_async(transport: str = 'grpc_asyncio', request_type=service.GetCaPoolRequest): + client = CertificateAuthorityServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # 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 =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 + + +@pytest.mark.asyncio +async def test_get_ca_pool_async_from_dict(): + await test_get_ca_pool_async(request_type=dict) + + +def test_get_ca_pool_field_headers(): + client = CertificateAuthorityServiceClient( + 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. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ( + 'x-goog-request-params', + 'name=name_value', + ) in kw['metadata'] + + +@pytest.mark.asyncio +async def test_get_ca_pool_field_headers_async(): + client = CertificateAuthorityServiceAsyncClient( + 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. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ( + 'x-goog-request-params', + 'name=name_value', + ) in kw['metadata'] + + +def test_get_ca_pool_flattened(): + client = CertificateAuthorityServiceClient( + 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', + ) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + arg = args[0].name + mock_val = 'name_value' + assert arg == mock_val + + +def test_get_ca_pool_flattened_error(): + client = CertificateAuthorityServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + client.get_ca_pool( + service.GetCaPoolRequest(), + name='name_value', + ) + +@pytest.mark.asyncio +async def test_get_ca_pool_flattened_async(): + client = CertificateAuthorityServiceAsyncClient( + 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.return_value = grpc_helpers_async.FakeUnaryUnaryCall(resources.CaPool()) + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + response = await client.get_ca_pool( + name='name_value', + ) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + arg = args[0].name + mock_val = 'name_value' + assert arg == mock_val + +@pytest.mark.asyncio +async def test_get_ca_pool_flattened_error_async(): + client = CertificateAuthorityServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + await client.get_ca_pool( + service.GetCaPoolRequest(), + name='name_value', + ) + + +@pytest.mark.parametrize("request_type", [ + service.ListCaPoolsRequest, + dict, +]) +def test_list_ca_pools(request_type, transport: str = 'grpc'): + client = CertificateAuthorityServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # 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( + 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'] + + +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=ga_credentials.AnonymousCredentials(), + transport='grpc', + ) + + # 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: + client.list_ca_pools() + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == service.ListCaPoolsRequest() + +@pytest.mark.asyncio +async def test_list_ca_pools_async(transport: str = 'grpc_asyncio', request_type=service.ListCaPoolsRequest): + client = CertificateAuthorityServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # 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 =grpc_helpers_async.FakeUnaryUnaryCall(service.ListCaPoolsResponse( + next_page_token='next_page_token_value', + 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'] + + +@pytest.mark.asyncio +async def test_list_ca_pools_async_from_dict(): + await test_list_ca_pools_async(request_type=dict) + + +def test_list_ca_pools_field_headers(): + client = CertificateAuthorityServiceClient( + 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. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ( + 'x-goog-request-params', + 'parent=parent_value', + ) in kw['metadata'] + + +@pytest.mark.asyncio +async def test_list_ca_pools_field_headers_async(): + client = CertificateAuthorityServiceAsyncClient( + 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 = grpc_helpers_async.FakeUnaryUnaryCall(service.ListCaPoolsResponse()) + 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] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ( + 'x-goog-request-params', + 'parent=parent_value', + ) in kw['metadata'] + + +def test_list_ca_pools_flattened(): + client = CertificateAuthorityServiceClient( + 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', + ) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + arg = args[0].parent + mock_val = 'parent_value' + assert arg == mock_val + + +def test_list_ca_pools_flattened_error(): + client = CertificateAuthorityServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + client.list_ca_pools( + service.ListCaPoolsRequest(), + parent='parent_value', + ) + +@pytest.mark.asyncio +async def test_list_ca_pools_flattened_async(): + client = CertificateAuthorityServiceAsyncClient( + 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.return_value = grpc_helpers_async.FakeUnaryUnaryCall(service.ListCaPoolsResponse()) + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + response = await client.list_ca_pools( + parent='parent_value', + ) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + arg = args[0].parent + mock_val = 'parent_value' + assert arg == mock_val + +@pytest.mark.asyncio +async def test_list_ca_pools_flattened_error_async(): + client = CertificateAuthorityServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + await client.list_ca_pools( + service.ListCaPoolsRequest(), + parent='parent_value', + ) + + +def test_list_ca_pools_pager(transport_name: str = "grpc"): + client = CertificateAuthorityServiceClient( + credentials=ga_credentials.AnonymousCredentials, + transport=transport_name, + ) + + # 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: + # Set the response to a series of pages. + call.side_effect = ( + service.ListCaPoolsResponse( + ca_pools=[ + resources.CaPool(), + resources.CaPool(), + resources.CaPool(), + ], + next_page_token='abc', + ), + service.ListCaPoolsResponse( + ca_pools=[], + next_page_token='def', + ), + service.ListCaPoolsResponse( + ca_pools=[ + resources.CaPool(), + ], + next_page_token='ghi', + ), + service.ListCaPoolsResponse( + ca_pools=[ + resources.CaPool(), + resources.CaPool(), + ], + ), + RuntimeError, + ) + + metadata = () + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata(( + ('parent', ''), + )), + ) + pager = client.list_ca_pools(request={}) + + assert pager._metadata == metadata + + results = list(pager) + assert len(results) == 6 + assert all(isinstance(i, resources.CaPool) + for i in results) +def test_list_ca_pools_pages(transport_name: str = "grpc"): + client = CertificateAuthorityServiceClient( + credentials=ga_credentials.AnonymousCredentials, + transport=transport_name, + ) + + # 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: + # Set the response to a series of pages. + call.side_effect = ( + service.ListCaPoolsResponse( + ca_pools=[ + resources.CaPool(), + resources.CaPool(), + resources.CaPool(), + ], + next_page_token='abc', + ), + service.ListCaPoolsResponse( + ca_pools=[], + next_page_token='def', + ), + service.ListCaPoolsResponse( + ca_pools=[ + resources.CaPool(), + ], + next_page_token='ghi', + ), + service.ListCaPoolsResponse( + ca_pools=[ + resources.CaPool(), + resources.CaPool(), + ], + ), + RuntimeError, + ) + pages = list(client.list_ca_pools(request={}).pages) + for page_, token in zip(pages, ['abc','def','ghi', '']): + assert page_.raw_page.next_page_token == token + +@pytest.mark.asyncio +async def test_list_ca_pools_async_pager(): + client = CertificateAuthorityServiceAsyncClient( + 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__', new_callable=mock.AsyncMock) as call: + # Set the response to a series of pages. + call.side_effect = ( + service.ListCaPoolsResponse( + ca_pools=[ + resources.CaPool(), + resources.CaPool(), + resources.CaPool(), + ], + next_page_token='abc', + ), + service.ListCaPoolsResponse( + ca_pools=[], + next_page_token='def', + ), + service.ListCaPoolsResponse( + ca_pools=[ + resources.CaPool(), + ], + next_page_token='ghi', + ), + service.ListCaPoolsResponse( + ca_pools=[ + resources.CaPool(), + resources.CaPool(), + ], + ), + RuntimeError, + ) + async_pager = await client.list_ca_pools(request={},) + assert async_pager.next_page_token == 'abc' + responses = [] + async for response in async_pager: # pragma: no branch + responses.append(response) + + assert len(responses) == 6 + assert all(isinstance(i, resources.CaPool) + for i in responses) + + +@pytest.mark.asyncio +async def test_list_ca_pools_async_pages(): + client = CertificateAuthorityServiceAsyncClient( + 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__', new_callable=mock.AsyncMock) as call: + # Set the response to a series of pages. + call.side_effect = ( + service.ListCaPoolsResponse( + ca_pools=[ + resources.CaPool(), + resources.CaPool(), + resources.CaPool(), + ], + next_page_token='abc', + ), + service.ListCaPoolsResponse( + ca_pools=[], + next_page_token='def', + ), + service.ListCaPoolsResponse( + ca_pools=[ + resources.CaPool(), + ], + next_page_token='ghi', + ), + service.ListCaPoolsResponse( + ca_pools=[ + resources.CaPool(), + resources.CaPool(), + ], + ), + RuntimeError, + ) + pages = [] + async for page_ in (await client.list_ca_pools(request={})).pages: # pragma: no branch + pages.append(page_) + for page_, token in zip(pages, ['abc','def','ghi', '']): + assert page_.raw_page.next_page_token == token + +@pytest.mark.parametrize("request_type", [ + service.DeleteCaPoolRequest, + dict, +]) +def test_delete_ca_pool(request_type, transport: str = 'grpc'): + client = CertificateAuthorityServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # 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/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. + assert isinstance(response, future.Future) + + +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=ga_credentials.AnonymousCredentials(), + transport='grpc', + ) + + # 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: + client.delete_ca_pool() + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == service.DeleteCaPoolRequest() + +@pytest.mark.asyncio +async def test_delete_ca_pool_async(transport: str = 'grpc_asyncio', request_type=service.DeleteCaPoolRequest): + client = CertificateAuthorityServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # 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 = 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. + assert isinstance(response, future.Future) + + +@pytest.mark.asyncio +async def test_delete_ca_pool_async_from_dict(): + await test_delete_ca_pool_async(request_type=dict) + + +def test_delete_ca_pool_field_headers(): + client = CertificateAuthorityServiceClient( + 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. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ( + 'x-goog-request-params', + 'name=name_value', + ) in kw['metadata'] + + +@pytest.mark.asyncio +async def test_delete_ca_pool_field_headers_async(): + client = CertificateAuthorityServiceAsyncClient( + 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 = 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. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ( + 'x-goog-request-params', + 'name=name_value', + ) in kw['metadata'] + + +def test_delete_ca_pool_flattened(): + client = CertificateAuthorityServiceClient( + 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', + ) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + arg = args[0].name + mock_val = 'name_value' + assert arg == mock_val + + +def test_delete_ca_pool_flattened_error(): + client = CertificateAuthorityServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + client.delete_ca_pool( + service.DeleteCaPoolRequest(), + name='name_value', + ) + +@pytest.mark.asyncio +async def test_delete_ca_pool_flattened_async(): + client = CertificateAuthorityServiceAsyncClient( + 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.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + operations_pb2.Operation(name='operations/spam') + ) + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + response = await client.delete_ca_pool( + name='name_value', + ) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + arg = args[0].name + mock_val = 'name_value' + assert arg == mock_val + +@pytest.mark.asyncio +async def test_delete_ca_pool_flattened_error_async(): + client = CertificateAuthorityServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + await client.delete_ca_pool( + service.DeleteCaPoolRequest(), + name='name_value', + ) + + +@pytest.mark.parametrize("request_type", [ + service.FetchCaCertsRequest, + dict, +]) +def test_fetch_ca_certs(request_type, transport: str = 'grpc'): + client = CertificateAuthorityServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # 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( + ) + 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) + + +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=ga_credentials.AnonymousCredentials(), + transport='grpc', + ) + + # 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: + client.fetch_ca_certs() + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == service.FetchCaCertsRequest() + +@pytest.mark.asyncio +async def test_fetch_ca_certs_async(transport: str = 'grpc_asyncio', request_type=service.FetchCaCertsRequest): + client = CertificateAuthorityServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # 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 =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. + assert isinstance(response, service.FetchCaCertsResponse) + + +@pytest.mark.asyncio +async def test_fetch_ca_certs_async_from_dict(): + await test_fetch_ca_certs_async(request_type=dict) + + +def test_fetch_ca_certs_field_headers(): + client = CertificateAuthorityServiceClient( + 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. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ( + 'x-goog-request-params', + 'ca_pool=ca_pool_value', + ) in kw['metadata'] + + +@pytest.mark.asyncio +async def test_fetch_ca_certs_field_headers_async(): + client = CertificateAuthorityServiceAsyncClient( + 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 = grpc_helpers_async.FakeUnaryUnaryCall(service.FetchCaCertsResponse()) + 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] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ( + 'x-goog-request-params', + 'ca_pool=ca_pool_value', + ) in kw['metadata'] + + +def test_fetch_ca_certs_flattened(): + client = CertificateAuthorityServiceClient( + 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', + ) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + arg = args[0].ca_pool + mock_val = 'ca_pool_value' + assert arg == mock_val + + +def test_fetch_ca_certs_flattened_error(): + client = CertificateAuthorityServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + client.fetch_ca_certs( + service.FetchCaCertsRequest(), + ca_pool='ca_pool_value', + ) + +@pytest.mark.asyncio +async def test_fetch_ca_certs_flattened_async(): + client = CertificateAuthorityServiceAsyncClient( + 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.return_value = grpc_helpers_async.FakeUnaryUnaryCall(service.FetchCaCertsResponse()) + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + response = await client.fetch_ca_certs( + ca_pool='ca_pool_value', + ) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + arg = args[0].ca_pool + mock_val = 'ca_pool_value' + assert arg == mock_val + +@pytest.mark.asyncio +async def test_fetch_ca_certs_flattened_error_async(): + client = CertificateAuthorityServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + await client.fetch_ca_certs( + service.FetchCaCertsRequest(), + ca_pool='ca_pool_value', + ) + + +@pytest.mark.parametrize("request_type", [ + service.GetCertificateRevocationListRequest, + dict, +]) +def test_get_certificate_revocation_list(request_type, transport: str = 'grpc'): + client = CertificateAuthorityServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.get_certificate_revocation_list), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = resources.CertificateRevocationList( + name='name_value', + sequence_number=1601, + pem_crl='pem_crl_value', + access_url='access_url_value', + 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' + + +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=ga_credentials.AnonymousCredentials(), + transport='grpc', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.get_certificate_revocation_list), + '__call__') as call: + client.get_certificate_revocation_list() + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == service.GetCertificateRevocationListRequest() + +@pytest.mark.asyncio +async def test_get_certificate_revocation_list_async(transport: str = 'grpc_asyncio', request_type=service.GetCertificateRevocationListRequest): + client = CertificateAuthorityServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.get_certificate_revocation_list), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(resources.CertificateRevocationList( + name='name_value', + sequence_number=1601, + pem_crl='pem_crl_value', + access_url='access_url_value', + state=resources.CertificateRevocationList.State.ACTIVE, + 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' + + +@pytest.mark.asyncio +async def test_get_certificate_revocation_list_async_from_dict(): + await test_get_certificate_revocation_list_async(request_type=dict) + + +def test_get_certificate_revocation_list_field_headers(): + client = CertificateAuthorityServiceClient( + 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. + with mock.patch.object( + 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. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ( + 'x-goog-request-params', + 'name=name_value', + ) in kw['metadata'] + + +@pytest.mark.asyncio +async def test_get_certificate_revocation_list_field_headers_async(): + client = CertificateAuthorityServiceAsyncClient( + 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. + with mock.patch.object( + type(client.transport.get_certificate_revocation_list), + '__call__') as call: + 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. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ( + 'x-goog-request-params', + 'name=name_value', + ) in kw['metadata'] + + +def test_get_certificate_revocation_list_flattened(): + client = CertificateAuthorityServiceClient( + 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_revocation_list), + '__call__') 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', + ) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + arg = args[0].name + mock_val = 'name_value' + assert arg == mock_val + + +def test_get_certificate_revocation_list_flattened_error(): + client = CertificateAuthorityServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + client.get_certificate_revocation_list( + service.GetCertificateRevocationListRequest(), + name='name_value', + ) + +@pytest.mark.asyncio +async def test_get_certificate_revocation_list_flattened_async(): + client = CertificateAuthorityServiceAsyncClient( + 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_revocation_list), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = resources.CertificateRevocationList() + + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(resources.CertificateRevocationList()) + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + response = await client.get_certificate_revocation_list( + name='name_value', + ) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + arg = args[0].name + mock_val = 'name_value' + assert arg == mock_val + +@pytest.mark.asyncio +async def test_get_certificate_revocation_list_flattened_error_async(): + client = CertificateAuthorityServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + await client.get_certificate_revocation_list( + service.GetCertificateRevocationListRequest(), + name='name_value', + ) + + +@pytest.mark.parametrize("request_type", [ + service.ListCertificateRevocationListsRequest, + dict, +]) +def test_list_certificate_revocation_lists(request_type, transport: str = 'grpc'): + client = CertificateAuthorityServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_certificate_revocation_lists), + '__call__') as call: + # Designate an appropriate return value for the call. + 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'] + + +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=ga_credentials.AnonymousCredentials(), + transport='grpc', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_certificate_revocation_lists), + '__call__') as call: + client.list_certificate_revocation_lists() + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == service.ListCertificateRevocationListsRequest() + +@pytest.mark.asyncio +async def test_list_certificate_revocation_lists_async(transport: str = 'grpc_asyncio', request_type=service.ListCertificateRevocationListsRequest): + client = CertificateAuthorityServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_certificate_revocation_lists), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(service.ListCertificateRevocationListsResponse( + next_page_token='next_page_token_value', + 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'] + + +@pytest.mark.asyncio +async def test_list_certificate_revocation_lists_async_from_dict(): + await test_list_certificate_revocation_lists_async(request_type=dict) + + +def test_list_certificate_revocation_lists_field_headers(): + client = CertificateAuthorityServiceClient( + 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. + with mock.patch.object( + 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. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ( + 'x-goog-request-params', + 'parent=parent_value', + ) in kw['metadata'] + + +@pytest.mark.asyncio +async def test_list_certificate_revocation_lists_field_headers_async(): + client = CertificateAuthorityServiceAsyncClient( + 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. + with mock.patch.object( + type(client.transport.list_certificate_revocation_lists), + '__call__') as call: + 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. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ( + 'x-goog-request-params', + 'parent=parent_value', + ) in kw['metadata'] + + +def test_list_certificate_revocation_lists_flattened(): + client = CertificateAuthorityServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_certificate_revocation_lists), + '__call__') 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', + ) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + arg = args[0].parent + mock_val = 'parent_value' + assert arg == mock_val + + +def test_list_certificate_revocation_lists_flattened_error(): + client = CertificateAuthorityServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + client.list_certificate_revocation_lists( + service.ListCertificateRevocationListsRequest(), + parent='parent_value', + ) + +@pytest.mark.asyncio +async def test_list_certificate_revocation_lists_flattened_async(): + client = CertificateAuthorityServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_certificate_revocation_lists), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = service.ListCertificateRevocationListsResponse() + + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(service.ListCertificateRevocationListsResponse()) + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + response = await client.list_certificate_revocation_lists( + parent='parent_value', + ) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + arg = args[0].parent + mock_val = 'parent_value' + assert arg == mock_val + +@pytest.mark.asyncio +async def test_list_certificate_revocation_lists_flattened_error_async(): + client = CertificateAuthorityServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + await client.list_certificate_revocation_lists( + service.ListCertificateRevocationListsRequest(), + parent='parent_value', + ) + + +def test_list_certificate_revocation_lists_pager(transport_name: str = "grpc"): + client = CertificateAuthorityServiceClient( + credentials=ga_credentials.AnonymousCredentials, + transport=transport_name, + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_certificate_revocation_lists), + '__call__') as call: + # Set the response to a series of pages. + call.side_effect = ( + service.ListCertificateRevocationListsResponse( + certificate_revocation_lists=[ + resources.CertificateRevocationList(), + resources.CertificateRevocationList(), + resources.CertificateRevocationList(), + ], + next_page_token='abc', + ), + service.ListCertificateRevocationListsResponse( + certificate_revocation_lists=[], + next_page_token='def', + ), + service.ListCertificateRevocationListsResponse( + certificate_revocation_lists=[ + resources.CertificateRevocationList(), + ], + next_page_token='ghi', + ), + service.ListCertificateRevocationListsResponse( + certificate_revocation_lists=[ + resources.CertificateRevocationList(), + resources.CertificateRevocationList(), + ], + ), + RuntimeError, + ) + + metadata = () + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata(( + ('parent', ''), + )), + ) + pager = client.list_certificate_revocation_lists(request={}) + + assert pager._metadata == metadata + + results = list(pager) + assert len(results) == 6 + assert all(isinstance(i, resources.CertificateRevocationList) + for i in results) +def test_list_certificate_revocation_lists_pages(transport_name: str = "grpc"): + client = CertificateAuthorityServiceClient( + credentials=ga_credentials.AnonymousCredentials, + transport=transport_name, + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_certificate_revocation_lists), + '__call__') as call: + # Set the response to a series of pages. + call.side_effect = ( + service.ListCertificateRevocationListsResponse( + certificate_revocation_lists=[ + resources.CertificateRevocationList(), + resources.CertificateRevocationList(), + resources.CertificateRevocationList(), + ], + next_page_token='abc', + ), + service.ListCertificateRevocationListsResponse( + certificate_revocation_lists=[], + next_page_token='def', + ), + service.ListCertificateRevocationListsResponse( + certificate_revocation_lists=[ + resources.CertificateRevocationList(), + ], + next_page_token='ghi', + ), + service.ListCertificateRevocationListsResponse( + certificate_revocation_lists=[ + resources.CertificateRevocationList(), + resources.CertificateRevocationList(), + ], + ), + RuntimeError, + ) + pages = list(client.list_certificate_revocation_lists(request={}).pages) + for page_, token in zip(pages, ['abc','def','ghi', '']): + assert page_.raw_page.next_page_token == token + +@pytest.mark.asyncio +async def test_list_certificate_revocation_lists_async_pager(): + client = CertificateAuthorityServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials, + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_certificate_revocation_lists), + '__call__', new_callable=mock.AsyncMock) as call: + # Set the response to a series of pages. + call.side_effect = ( + service.ListCertificateRevocationListsResponse( + certificate_revocation_lists=[ + resources.CertificateRevocationList(), + resources.CertificateRevocationList(), + resources.CertificateRevocationList(), + ], + next_page_token='abc', + ), + service.ListCertificateRevocationListsResponse( + certificate_revocation_lists=[], + next_page_token='def', + ), + service.ListCertificateRevocationListsResponse( + certificate_revocation_lists=[ + resources.CertificateRevocationList(), + ], + next_page_token='ghi', + ), + service.ListCertificateRevocationListsResponse( + certificate_revocation_lists=[ + resources.CertificateRevocationList(), + resources.CertificateRevocationList(), + ], + ), + RuntimeError, + ) + async_pager = await client.list_certificate_revocation_lists(request={},) + assert async_pager.next_page_token == 'abc' + responses = [] + async for response in async_pager: # pragma: no branch + responses.append(response) + + assert len(responses) == 6 + assert all(isinstance(i, resources.CertificateRevocationList) + for i in responses) + + +@pytest.mark.asyncio +async def test_list_certificate_revocation_lists_async_pages(): + client = CertificateAuthorityServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials, + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_certificate_revocation_lists), + '__call__', new_callable=mock.AsyncMock) as call: + # Set the response to a series of pages. + call.side_effect = ( + service.ListCertificateRevocationListsResponse( + certificate_revocation_lists=[ + resources.CertificateRevocationList(), + resources.CertificateRevocationList(), + resources.CertificateRevocationList(), + ], + next_page_token='abc', + ), + service.ListCertificateRevocationListsResponse( + certificate_revocation_lists=[], + next_page_token='def', + ), + service.ListCertificateRevocationListsResponse( + certificate_revocation_lists=[ + resources.CertificateRevocationList(), + ], + next_page_token='ghi', + ), + service.ListCertificateRevocationListsResponse( + certificate_revocation_lists=[ + resources.CertificateRevocationList(), + resources.CertificateRevocationList(), + ], + ), + RuntimeError, + ) + pages = [] + async for page_ in (await client.list_certificate_revocation_lists(request={})).pages: # pragma: no branch + pages.append(page_) + for page_, token in zip(pages, ['abc','def','ghi', '']): + assert page_.raw_page.next_page_token == token + +@pytest.mark.parametrize("request_type", [ + service.UpdateCertificateRevocationListRequest, + dict, +]) +def test_update_certificate_revocation_list(request_type, transport: str = 'grpc'): + client = CertificateAuthorityServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.update_certificate_revocation_list), + '__call__') 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. + assert isinstance(response, future.Future) + + +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=ga_credentials.AnonymousCredentials(), + transport='grpc', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.update_certificate_revocation_list), + '__call__') as call: + client.update_certificate_revocation_list() + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == service.UpdateCertificateRevocationListRequest() + +@pytest.mark.asyncio +async def test_update_certificate_revocation_list_async(transport: str = 'grpc_asyncio', request_type=service.UpdateCertificateRevocationListRequest): + client = CertificateAuthorityServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.update_certificate_revocation_list), + '__call__') as call: + # Designate an appropriate return value for the call. + 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. + assert isinstance(response, future.Future) + + +@pytest.mark.asyncio +async def test_update_certificate_revocation_list_async_from_dict(): + await test_update_certificate_revocation_list_async(request_type=dict) + + +def test_update_certificate_revocation_list_field_headers(): + client = CertificateAuthorityServiceClient( + 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 = 'name_value' + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + 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. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ( + 'x-goog-request-params', + 'certificate_revocation_list.name=name_value', + ) in kw['metadata'] + + +@pytest.mark.asyncio +async def test_update_certificate_revocation_list_field_headers_async(): + client = CertificateAuthorityServiceAsyncClient( + 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 = 'name_value' + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.update_certificate_revocation_list), + '__call__') as call: + 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. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ( + 'x-goog-request-params', + 'certificate_revocation_list.name=name_value', + ) in kw['metadata'] + + +def test_update_certificate_revocation_list_flattened(): + client = CertificateAuthorityServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.update_certificate_revocation_list), + '__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_certificate_revocation_list( + certificate_revocation_list=resources.CertificateRevocationList(name='name_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] + arg = args[0].certificate_revocation_list + mock_val = resources.CertificateRevocationList(name='name_value') + assert arg == mock_val + arg = args[0].update_mask + mock_val = field_mask_pb2.FieldMask(paths=['paths_value']) + assert arg == mock_val + + +def test_update_certificate_revocation_list_flattened_error(): + client = CertificateAuthorityServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + client.update_certificate_revocation_list( + service.UpdateCertificateRevocationListRequest(), + certificate_revocation_list=resources.CertificateRevocationList(name='name_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=ga_credentials.AnonymousCredentials(), + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.update_certificate_revocation_list), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = operations_pb2.Operation(name='operations/op') + + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + operations_pb2.Operation(name='operations/spam') + ) + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + response = await client.update_certificate_revocation_list( + certificate_revocation_list=resources.CertificateRevocationList(name='name_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] + arg = args[0].certificate_revocation_list + mock_val = resources.CertificateRevocationList(name='name_value') + assert arg == mock_val + arg = args[0].update_mask + mock_val = field_mask_pb2.FieldMask(paths=['paths_value']) + assert arg == mock_val + +@pytest.mark.asyncio +async def test_update_certificate_revocation_list_flattened_error_async(): + client = CertificateAuthorityServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + await client.update_certificate_revocation_list( + service.UpdateCertificateRevocationListRequest(), + certificate_revocation_list=resources.CertificateRevocationList(name='name_value'), + update_mask=field_mask_pb2.FieldMask(paths=['paths_value']), + ) + + +@pytest.mark.parametrize("request_type", [ + service.CreateCertificateTemplateRequest, + dict, +]) +def test_create_certificate_template(request_type, transport: str = 'grpc'): + client = CertificateAuthorityServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.create_certificate_template), + '__call__') 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. + assert isinstance(response, future.Future) + + +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=ga_credentials.AnonymousCredentials(), + transport='grpc', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.create_certificate_template), + '__call__') as call: + client.create_certificate_template() + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == service.CreateCertificateTemplateRequest() + +@pytest.mark.asyncio +async def test_create_certificate_template_async(transport: str = 'grpc_asyncio', request_type=service.CreateCertificateTemplateRequest): + client = CertificateAuthorityServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.create_certificate_template), + '__call__') as call: + # Designate an appropriate return value for the call. + 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. + assert isinstance(response, future.Future) + + +@pytest.mark.asyncio +async def test_create_certificate_template_async_from_dict(): + await test_create_certificate_template_async(request_type=dict) + + +def test_create_certificate_template_field_headers(): + client = CertificateAuthorityServiceClient( + 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. + with mock.patch.object( + 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. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ( + 'x-goog-request-params', + 'parent=parent_value', + ) in kw['metadata'] + + +@pytest.mark.asyncio +async def test_create_certificate_template_field_headers_async(): + client = CertificateAuthorityServiceAsyncClient( + 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. + with mock.patch.object( + type(client.transport.create_certificate_template), + '__call__') as call: + 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. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ( + 'x-goog-request-params', + 'parent=parent_value', + ) in kw['metadata'] + + +def test_create_certificate_template_flattened(): + client = CertificateAuthorityServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.create_certificate_template), + '__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_certificate_template( + parent='parent_value', + certificate_template=resources.CertificateTemplate(name='name_value'), + certificate_template_id='certificate_template_id_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] + arg = args[0].parent + mock_val = 'parent_value' + assert arg == mock_val + arg = args[0].certificate_template + mock_val = resources.CertificateTemplate(name='name_value') + assert arg == mock_val + arg = args[0].certificate_template_id + mock_val = 'certificate_template_id_value' + assert arg == mock_val + + +def test_create_certificate_template_flattened_error(): + client = CertificateAuthorityServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + client.create_certificate_template( + service.CreateCertificateTemplateRequest(), + parent='parent_value', + certificate_template=resources.CertificateTemplate(name='name_value'), + certificate_template_id='certificate_template_id_value', + ) + +@pytest.mark.asyncio +async def test_create_certificate_template_flattened_async(): + client = CertificateAuthorityServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.create_certificate_template), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = operations_pb2.Operation(name='operations/op') + + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + operations_pb2.Operation(name='operations/spam') + ) + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + response = await client.create_certificate_template( + parent='parent_value', + certificate_template=resources.CertificateTemplate(name='name_value'), + certificate_template_id='certificate_template_id_value', + ) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + arg = args[0].parent + mock_val = 'parent_value' + assert arg == mock_val + arg = args[0].certificate_template + mock_val = resources.CertificateTemplate(name='name_value') + assert arg == mock_val + arg = args[0].certificate_template_id + mock_val = 'certificate_template_id_value' + assert arg == mock_val + +@pytest.mark.asyncio +async def test_create_certificate_template_flattened_error_async(): + client = CertificateAuthorityServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + await client.create_certificate_template( + service.CreateCertificateTemplateRequest(), + parent='parent_value', + certificate_template=resources.CertificateTemplate(name='name_value'), + certificate_template_id='certificate_template_id_value', + ) + + +@pytest.mark.parametrize("request_type", [ + service.DeleteCertificateTemplateRequest, + dict, +]) +def test_delete_certificate_template(request_type, transport: str = 'grpc'): + client = CertificateAuthorityServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.delete_certificate_template), + '__call__') 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. + assert isinstance(response, future.Future) + + +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=ga_credentials.AnonymousCredentials(), + transport='grpc', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.delete_certificate_template), + '__call__') as call: + client.delete_certificate_template() + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == service.DeleteCertificateTemplateRequest() + +@pytest.mark.asyncio +async def test_delete_certificate_template_async(transport: str = 'grpc_asyncio', request_type=service.DeleteCertificateTemplateRequest): + client = CertificateAuthorityServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.delete_certificate_template), + '__call__') as call: + # Designate an appropriate return value for the call. + 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. + assert isinstance(response, future.Future) + + +@pytest.mark.asyncio +async def test_delete_certificate_template_async_from_dict(): + await test_delete_certificate_template_async(request_type=dict) + + +def test_delete_certificate_template_field_headers(): + client = CertificateAuthorityServiceClient( + 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. + with mock.patch.object( + 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. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ( + 'x-goog-request-params', + 'name=name_value', + ) in kw['metadata'] + + +@pytest.mark.asyncio +async def test_delete_certificate_template_field_headers_async(): + client = CertificateAuthorityServiceAsyncClient( + 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. + with mock.patch.object( + type(client.transport.delete_certificate_template), + '__call__') as call: + 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. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ( + 'x-goog-request-params', + 'name=name_value', + ) in kw['metadata'] + + +def test_delete_certificate_template_flattened(): + client = CertificateAuthorityServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.delete_certificate_template), + '__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_certificate_template( + name='name_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] + arg = args[0].name + mock_val = 'name_value' + assert arg == mock_val + + +def test_delete_certificate_template_flattened_error(): + client = CertificateAuthorityServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + client.delete_certificate_template( + service.DeleteCertificateTemplateRequest(), + name='name_value', + ) + +@pytest.mark.asyncio +async def test_delete_certificate_template_flattened_async(): + client = CertificateAuthorityServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.delete_certificate_template), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = operations_pb2.Operation(name='operations/op') + + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + operations_pb2.Operation(name='operations/spam') + ) + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + response = await client.delete_certificate_template( + name='name_value', + ) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + arg = args[0].name + mock_val = 'name_value' + assert arg == mock_val + +@pytest.mark.asyncio +async def test_delete_certificate_template_flattened_error_async(): + client = CertificateAuthorityServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + await client.delete_certificate_template( + service.DeleteCertificateTemplateRequest(), + name='name_value', + ) + + +@pytest.mark.parametrize("request_type", [ + service.GetCertificateTemplateRequest, + dict, +]) +def test_get_certificate_template(request_type, transport: str = 'grpc'): + client = CertificateAuthorityServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.get_certificate_template), + '__call__') as call: + # Designate an appropriate return value for the call. + 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' + + +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=ga_credentials.AnonymousCredentials(), + transport='grpc', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.get_certificate_template), + '__call__') as call: + client.get_certificate_template() + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == service.GetCertificateTemplateRequest() + +@pytest.mark.asyncio +async def test_get_certificate_template_async(transport: str = 'grpc_asyncio', request_type=service.GetCertificateTemplateRequest): + client = CertificateAuthorityServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.get_certificate_template), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(resources.CertificateTemplate( + 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' + + +@pytest.mark.asyncio +async def test_get_certificate_template_async_from_dict(): + await test_get_certificate_template_async(request_type=dict) + + +def test_get_certificate_template_field_headers(): + client = CertificateAuthorityServiceClient( + 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. + with mock.patch.object( + 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. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ( + 'x-goog-request-params', + 'name=name_value', + ) in kw['metadata'] + + +@pytest.mark.asyncio +async def test_get_certificate_template_field_headers_async(): + client = CertificateAuthorityServiceAsyncClient( + 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. + with mock.patch.object( + type(client.transport.get_certificate_template), + '__call__') as call: + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(resources.CertificateTemplate()) + 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] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ( + 'x-goog-request-params', + 'name=name_value', + ) in kw['metadata'] + + +def test_get_certificate_template_flattened(): + client = CertificateAuthorityServiceClient( + 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_template), + '__call__') 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', + ) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + arg = args[0].name + mock_val = 'name_value' + assert arg == mock_val + + +def test_get_certificate_template_flattened_error(): + client = CertificateAuthorityServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + client.get_certificate_template( + service.GetCertificateTemplateRequest(), + name='name_value', + ) + +@pytest.mark.asyncio +async def test_get_certificate_template_flattened_async(): + client = CertificateAuthorityServiceAsyncClient( + 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_template), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = resources.CertificateTemplate() + + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(resources.CertificateTemplate()) + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + response = await client.get_certificate_template( + name='name_value', + ) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + arg = args[0].name + mock_val = 'name_value' + assert arg == mock_val + +@pytest.mark.asyncio +async def test_get_certificate_template_flattened_error_async(): + client = CertificateAuthorityServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + await client.get_certificate_template( + service.GetCertificateTemplateRequest(), + name='name_value', + ) + + +@pytest.mark.parametrize("request_type", [ + service.ListCertificateTemplatesRequest, + dict, +]) +def test_list_certificate_templates(request_type, transport: str = 'grpc'): + client = CertificateAuthorityServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_certificate_templates), + '__call__') as call: + # Designate an appropriate return value for the call. + 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'] + + +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=ga_credentials.AnonymousCredentials(), + transport='grpc', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_certificate_templates), + '__call__') as call: + client.list_certificate_templates() + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == service.ListCertificateTemplatesRequest() + +@pytest.mark.asyncio +async def test_list_certificate_templates_async(transport: str = 'grpc_asyncio', request_type=service.ListCertificateTemplatesRequest): + client = CertificateAuthorityServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_certificate_templates), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(service.ListCertificateTemplatesResponse( + next_page_token='next_page_token_value', + 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'] + + +@pytest.mark.asyncio +async def test_list_certificate_templates_async_from_dict(): + await test_list_certificate_templates_async(request_type=dict) + + +def test_list_certificate_templates_field_headers(): + client = CertificateAuthorityServiceClient( + 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. + with mock.patch.object( + 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. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ( + 'x-goog-request-params', + 'parent=parent_value', + ) in kw['metadata'] + + +@pytest.mark.asyncio +async def test_list_certificate_templates_field_headers_async(): + client = CertificateAuthorityServiceAsyncClient( + 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. + with mock.patch.object( + type(client.transport.list_certificate_templates), + '__call__') as call: + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(service.ListCertificateTemplatesResponse()) + 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] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ( + 'x-goog-request-params', + 'parent=parent_value', + ) in kw['metadata'] + + +def test_list_certificate_templates_flattened(): + client = CertificateAuthorityServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_certificate_templates), + '__call__') 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', + ) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + arg = args[0].parent + mock_val = 'parent_value' + assert arg == mock_val + + +def test_list_certificate_templates_flattened_error(): + client = CertificateAuthorityServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + client.list_certificate_templates( + service.ListCertificateTemplatesRequest(), + parent='parent_value', + ) + +@pytest.mark.asyncio +async def test_list_certificate_templates_flattened_async(): + client = CertificateAuthorityServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_certificate_templates), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = service.ListCertificateTemplatesResponse() + + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(service.ListCertificateTemplatesResponse()) + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + response = await client.list_certificate_templates( + parent='parent_value', + ) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + arg = args[0].parent + mock_val = 'parent_value' + assert arg == mock_val + +@pytest.mark.asyncio +async def test_list_certificate_templates_flattened_error_async(): + client = CertificateAuthorityServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + await client.list_certificate_templates( + service.ListCertificateTemplatesRequest(), + parent='parent_value', + ) + + +def test_list_certificate_templates_pager(transport_name: str = "grpc"): + client = CertificateAuthorityServiceClient( + credentials=ga_credentials.AnonymousCredentials, + transport=transport_name, + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_certificate_templates), + '__call__') as call: + # Set the response to a series of pages. + call.side_effect = ( + service.ListCertificateTemplatesResponse( + certificate_templates=[ + resources.CertificateTemplate(), + resources.CertificateTemplate(), + resources.CertificateTemplate(), + ], + next_page_token='abc', + ), + service.ListCertificateTemplatesResponse( + certificate_templates=[], + next_page_token='def', + ), + service.ListCertificateTemplatesResponse( + certificate_templates=[ + resources.CertificateTemplate(), + ], + next_page_token='ghi', + ), + service.ListCertificateTemplatesResponse( + certificate_templates=[ + resources.CertificateTemplate(), + resources.CertificateTemplate(), + ], + ), + RuntimeError, + ) + + metadata = () + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata(( + ('parent', ''), + )), + ) + pager = client.list_certificate_templates(request={}) + + assert pager._metadata == metadata + + results = list(pager) + assert len(results) == 6 + assert all(isinstance(i, resources.CertificateTemplate) + for i in results) +def test_list_certificate_templates_pages(transport_name: str = "grpc"): + client = CertificateAuthorityServiceClient( + credentials=ga_credentials.AnonymousCredentials, + transport=transport_name, + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_certificate_templates), + '__call__') as call: + # Set the response to a series of pages. + call.side_effect = ( + service.ListCertificateTemplatesResponse( + certificate_templates=[ + resources.CertificateTemplate(), + resources.CertificateTemplate(), + resources.CertificateTemplate(), + ], + next_page_token='abc', + ), + service.ListCertificateTemplatesResponse( + certificate_templates=[], + next_page_token='def', + ), + service.ListCertificateTemplatesResponse( + certificate_templates=[ + resources.CertificateTemplate(), + ], + next_page_token='ghi', + ), + service.ListCertificateTemplatesResponse( + certificate_templates=[ + resources.CertificateTemplate(), + resources.CertificateTemplate(), + ], + ), + RuntimeError, + ) + pages = list(client.list_certificate_templates(request={}).pages) + for page_, token in zip(pages, ['abc','def','ghi', '']): + assert page_.raw_page.next_page_token == token + +@pytest.mark.asyncio +async def test_list_certificate_templates_async_pager(): + client = CertificateAuthorityServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials, + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_certificate_templates), + '__call__', new_callable=mock.AsyncMock) as call: + # Set the response to a series of pages. + call.side_effect = ( + service.ListCertificateTemplatesResponse( + certificate_templates=[ + resources.CertificateTemplate(), + resources.CertificateTemplate(), + resources.CertificateTemplate(), + ], + next_page_token='abc', + ), + service.ListCertificateTemplatesResponse( + certificate_templates=[], + next_page_token='def', + ), + service.ListCertificateTemplatesResponse( + certificate_templates=[ + resources.CertificateTemplate(), + ], + next_page_token='ghi', + ), + service.ListCertificateTemplatesResponse( + certificate_templates=[ + resources.CertificateTemplate(), + resources.CertificateTemplate(), + ], + ), + RuntimeError, + ) + async_pager = await client.list_certificate_templates(request={},) + assert async_pager.next_page_token == 'abc' + responses = [] + async for response in async_pager: # pragma: no branch + responses.append(response) + + assert len(responses) == 6 + assert all(isinstance(i, resources.CertificateTemplate) + for i in responses) + + +@pytest.mark.asyncio +async def test_list_certificate_templates_async_pages(): + client = CertificateAuthorityServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials, + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_certificate_templates), + '__call__', new_callable=mock.AsyncMock) as call: + # Set the response to a series of pages. + call.side_effect = ( + service.ListCertificateTemplatesResponse( + certificate_templates=[ + resources.CertificateTemplate(), + resources.CertificateTemplate(), + resources.CertificateTemplate(), + ], + next_page_token='abc', + ), + service.ListCertificateTemplatesResponse( + certificate_templates=[], + next_page_token='def', + ), + service.ListCertificateTemplatesResponse( + certificate_templates=[ + resources.CertificateTemplate(), + ], + next_page_token='ghi', + ), + service.ListCertificateTemplatesResponse( + certificate_templates=[ + resources.CertificateTemplate(), + resources.CertificateTemplate(), + ], + ), + RuntimeError, + ) + pages = [] + async for page_ in (await client.list_certificate_templates(request={})).pages: # pragma: no branch + pages.append(page_) + for page_, token in zip(pages, ['abc','def','ghi', '']): + assert page_.raw_page.next_page_token == token + +@pytest.mark.parametrize("request_type", [ + service.UpdateCertificateTemplateRequest, + dict, +]) +def test_update_certificate_template(request_type, transport: str = 'grpc'): + client = CertificateAuthorityServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.update_certificate_template), + '__call__') 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. + assert isinstance(response, future.Future) + + +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=ga_credentials.AnonymousCredentials(), + transport='grpc', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.update_certificate_template), + '__call__') as call: + client.update_certificate_template() + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == service.UpdateCertificateTemplateRequest() + +@pytest.mark.asyncio +async def test_update_certificate_template_async(transport: str = 'grpc_asyncio', request_type=service.UpdateCertificateTemplateRequest): + client = CertificateAuthorityServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.update_certificate_template), + '__call__') as call: + # Designate an appropriate return value for the call. + 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. + assert isinstance(response, future.Future) + + +@pytest.mark.asyncio +async def test_update_certificate_template_async_from_dict(): + await test_update_certificate_template_async(request_type=dict) + + +def test_update_certificate_template_field_headers(): + client = CertificateAuthorityServiceClient( + 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 = 'name_value' + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + 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. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ( + 'x-goog-request-params', + 'certificate_template.name=name_value', + ) in kw['metadata'] + + +@pytest.mark.asyncio +async def test_update_certificate_template_field_headers_async(): + client = CertificateAuthorityServiceAsyncClient( + 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 = 'name_value' + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.update_certificate_template), + '__call__') as call: + 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. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ( + 'x-goog-request-params', + 'certificate_template.name=name_value', + ) in kw['metadata'] + + +def test_update_certificate_template_flattened(): + client = CertificateAuthorityServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.update_certificate_template), + '__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_certificate_template( + certificate_template=resources.CertificateTemplate(name='name_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] + arg = args[0].certificate_template + mock_val = resources.CertificateTemplate(name='name_value') + assert arg == mock_val + arg = args[0].update_mask + mock_val = field_mask_pb2.FieldMask(paths=['paths_value']) + assert arg == mock_val + + +def test_update_certificate_template_flattened_error(): + client = CertificateAuthorityServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + client.update_certificate_template( + service.UpdateCertificateTemplateRequest(), + certificate_template=resources.CertificateTemplate(name='name_value'), + update_mask=field_mask_pb2.FieldMask(paths=['paths_value']), + ) + +@pytest.mark.asyncio +async def test_update_certificate_template_flattened_async(): + client = CertificateAuthorityServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.update_certificate_template), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = operations_pb2.Operation(name='operations/op') + + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + operations_pb2.Operation(name='operations/spam') + ) + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + response = await client.update_certificate_template( + certificate_template=resources.CertificateTemplate(name='name_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] + arg = args[0].certificate_template + mock_val = resources.CertificateTemplate(name='name_value') + assert arg == mock_val + arg = args[0].update_mask + mock_val = field_mask_pb2.FieldMask(paths=['paths_value']) + assert arg == mock_val + +@pytest.mark.asyncio +async def test_update_certificate_template_flattened_error_async(): + client = CertificateAuthorityServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + await client.update_certificate_template( + service.UpdateCertificateTemplateRequest(), + certificate_template=resources.CertificateTemplate(name='name_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=ga_credentials.AnonymousCredentials(), + ) + with pytest.raises(ValueError): + client = CertificateAuthorityServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # It is an error to provide a credentials file and a transport instance. + transport = transports.CertificateAuthorityServiceGrpcTransport( + credentials=ga_credentials.AnonymousCredentials(), + ) + with pytest.raises(ValueError): + client = CertificateAuthorityServiceClient( + client_options={"credentials_file": "credentials.json"}, + transport=transport, + ) + + # It is an error to provide an api_key and a transport instance. + transport = transports.CertificateAuthorityServiceGrpcTransport( + credentials=ga_credentials.AnonymousCredentials(), + ) + options = client_options.ClientOptions() + options.api_key = "api_key" + with pytest.raises(ValueError): + client = CertificateAuthorityServiceClient( + client_options=options, + transport=transport, + ) + + # It is an error to provide an api_key and a credential. + options = mock.Mock() + options.api_key = "api_key" + with pytest.raises(ValueError): + client = CertificateAuthorityServiceClient( + client_options=options, + credentials=ga_credentials.AnonymousCredentials() + ) + + # It is an error to provide scopes and a transport instance. + transport = transports.CertificateAuthorityServiceGrpcTransport( + credentials=ga_credentials.AnonymousCredentials(), + ) + with pytest.raises(ValueError): + client = CertificateAuthorityServiceClient( + client_options={"scopes": ["1", "2"]}, + transport=transport, + ) + + +def test_transport_instance(): + # A client may be instantiated with a custom transport instance. + transport = transports.CertificateAuthorityServiceGrpcTransport( + credentials=ga_credentials.AnonymousCredentials(), + ) + client = CertificateAuthorityServiceClient(transport=transport) + assert client.transport is transport + +def test_transport_get_channel(): + # A client may be instantiated with a custom transport instance. + transport = transports.CertificateAuthorityServiceGrpcTransport( + credentials=ga_credentials.AnonymousCredentials(), + ) + channel = transport.grpc_channel + assert channel + + transport = transports.CertificateAuthorityServiceGrpcAsyncIOTransport( + credentials=ga_credentials.AnonymousCredentials(), + ) + channel = transport.grpc_channel + assert channel + +@pytest.mark.parametrize("transport_class", [ + transports.CertificateAuthorityServiceGrpcTransport, + transports.CertificateAuthorityServiceGrpcAsyncIOTransport, +]) +def test_transport_adc(transport_class): + # Test default credentials are used if not provided. + with mock.patch.object(google.auth, 'default') as adc: + adc.return_value = (ga_credentials.AnonymousCredentials(), None) + transport_class() + adc.assert_called_once() + +@pytest.mark.parametrize("transport_name", [ + "grpc", +]) +def test_transport_kind(transport_name): + transport = CertificateAuthorityServiceClient.get_transport_class(transport_name)( + credentials=ga_credentials.AnonymousCredentials(), + ) + assert transport.kind == transport_name + +def test_transport_grpc_default(): + # A client should use the gRPC transport by default. + client = CertificateAuthorityServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + assert isinstance( + client.transport, + transports.CertificateAuthorityServiceGrpcTransport, + ) + +def test_certificate_authority_service_base_transport_error(): + # Passing both a credentials object and credentials_file should raise an error + with pytest.raises(core_exceptions.DuplicateCredentialArgs): + transport = transports.CertificateAuthorityServiceTransport( + credentials=ga_credentials.AnonymousCredentials(), + credentials_file="credentials.json" + ) + + +def test_certificate_authority_service_base_transport(): + # Instantiate the base transport. + with mock.patch('google.cloud.security.privateca_v1.services.certificate_authority_service.transports.CertificateAuthorityServiceTransport.__init__') as Transport: + Transport.return_value = None + transport = transports.CertificateAuthorityServiceTransport( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Every method on the transport should just blindly + # raise NotImplementedError. + methods = ( + 'create_certificate', + 'get_certificate', + 'list_certificates', + 'revoke_certificate', + 'update_certificate', + 'activate_certificate_authority', + 'create_certificate_authority', + 'disable_certificate_authority', + 'enable_certificate_authority', + 'fetch_certificate_authority_csr', + 'get_certificate_authority', + 'list_certificate_authorities', + 'undelete_certificate_authority', + 'delete_certificate_authority', + 'update_certificate_authority', + 'create_ca_pool', + 'update_ca_pool', + 'get_ca_pool', + 'list_ca_pools', + 'delete_ca_pool', + 'fetch_ca_certs', + 'get_certificate_revocation_list', + 'list_certificate_revocation_lists', + 'update_certificate_revocation_list', + 'create_certificate_template', + 'delete_certificate_template', + 'get_certificate_template', + 'list_certificate_templates', + 'update_certificate_template', + ) + for method in methods: + with pytest.raises(NotImplementedError): + getattr(transport, method)(request=object()) + + with pytest.raises(NotImplementedError): + transport.close() + + # Additionally, the LRO client (a property) should + # also raise NotImplementedError + with pytest.raises(NotImplementedError): + transport.operations_client + + # Catch all for all remaining methods and properties + remainder = [ + 'kind', + ] + for r in remainder: + with pytest.raises(NotImplementedError): + getattr(transport, r)() + + +def test_certificate_authority_service_base_transport_with_credentials_file(): + # 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 = (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", + ) + + +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(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 = (ga_credentials.AnonymousCredentials(), None) + transport = transports.CertificateAuthorityServiceTransport() + adc.assert_called_once() + + +def test_certificate_authority_service_auth_adc(): + # 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=None, + default_scopes=( + 'https://www.googleapis.com/auth/cloud-platform', +), + quota_project_id=None, + ) + + +@pytest.mark.parametrize( + "transport_class", + [ + transports.CertificateAuthorityServiceGrpcTransport, + transports.CertificateAuthorityServiceGrpcAsyncIOTransport, + ], +) +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(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, + ], +) +def test_certificate_authority_service_transport_auth_gdch_credentials(transport_class): + host = 'https://language.com' + api_audience_tests = [None, 'https://language2.com'] + api_audience_expect = [host, 'https://language2.com'] + for t, e in zip(api_audience_tests, api_audience_expect): + with mock.patch.object(google.auth, 'default', autospec=True) as adc: + gdch_mock = mock.MagicMock() + type(gdch_mock).with_gdch_audience = mock.PropertyMock(return_value=gdch_mock) + adc.return_value = (gdch_mock, None) + transport_class(host=host, api_audience=t) + gdch_mock.with_gdch_audience.assert_called_once_with( + e + ) + + +@pytest.mark.parametrize( + "transport_class,grpc_helpers", + [ + (transports.CertificateAuthorityServiceGrpcTransport, grpc_helpers), + (transports.CertificateAuthorityServiceGrpcAsyncIOTransport, grpc_helpers_async) + ], +) +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", [transports.CertificateAuthorityServiceGrpcTransport, transports.CertificateAuthorityServiceGrpcAsyncIOTransport]) +def test_certificate_authority_service_grpc_transport_client_cert_source_for_mtls( + transport_class +): + cred = ga_credentials.AnonymousCredentials() + + # Check ssl_channel_credentials is used if provided. + with mock.patch.object(transport_class, "create_channel") as mock_create_channel: + mock_ssl_channel_creds = mock.Mock() + transport_class( + host="squid.clam.whelk", + credentials=cred, + ssl_channel_credentials=mock_ssl_channel_creds + ) + mock_create_channel.assert_called_once_with( + "squid.clam.whelk:443", + credentials=cred, + credentials_file=None, + scopes=None, + ssl_credentials=mock_ssl_channel_creds, + quota_project_id=None, + options=[ + ("grpc.max_send_message_length", -1), + ("grpc.max_receive_message_length", -1), + ], + ) + + # Check if ssl_channel_credentials is not provided, then client_cert_source_for_mtls + # is used. + with mock.patch.object(transport_class, "create_channel", return_value=mock.Mock()): + with mock.patch("grpc.ssl_channel_credentials") as mock_ssl_cred: + transport_class( + credentials=cred, + client_cert_source_for_mtls=client_cert_source_callback + ) + expected_cert, expected_key = client_cert_source_callback() + mock_ssl_cred.assert_called_once_with( + certificate_chain=expected_cert, + private_key=expected_key + ) + + +@pytest.mark.parametrize("transport_name", [ + "grpc", + "grpc_asyncio", +]) +def test_certificate_authority_service_host_no_port(transport_name): + client = CertificateAuthorityServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + client_options=client_options.ClientOptions(api_endpoint='privateca.googleapis.com'), + transport=transport_name, + ) + assert client.transport._host == ( + 'privateca.googleapis.com:443' + ) + +@pytest.mark.parametrize("transport_name", [ + "grpc", + "grpc_asyncio", +]) +def test_certificate_authority_service_host_with_port(transport_name): + client = CertificateAuthorityServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + client_options=client_options.ClientOptions(api_endpoint='privateca.googleapis.com:8000'), + transport=transport_name, + ) + assert client.transport._host == ( + 'privateca.googleapis.com:8000' + ) + +def test_certificate_authority_service_grpc_transport_channel(): + channel = grpc.secure_channel('http://localhost/', grpc.local_channel_credentials()) + + # Check that channel is used if provided. + transport = transports.CertificateAuthorityServiceGrpcTransport( + host="squid.clam.whelk", + channel=channel, + ) + assert transport.grpc_channel == channel + assert transport._host == "squid.clam.whelk:443" + assert transport._ssl_channel_credentials == None + + +def test_certificate_authority_service_grpc_asyncio_transport_channel(): + channel = aio.secure_channel('http://localhost/', grpc.local_channel_credentials()) + + # Check that channel is used if provided. + transport = transports.CertificateAuthorityServiceGrpcAsyncIOTransport( + host="squid.clam.whelk", + channel=channel, + ) + assert transport.grpc_channel == channel + assert transport._host == "squid.clam.whelk:443" + assert transport._ssl_channel_credentials == None + + +# Remove this test when deprecated arguments (api_mtls_endpoint, client_cert_source) are +# removed from grpc/grpc_asyncio transport constructor. +@pytest.mark.parametrize("transport_class", [transports.CertificateAuthorityServiceGrpcTransport, transports.CertificateAuthorityServiceGrpcAsyncIOTransport]) +def test_certificate_authority_service_transport_channel_mtls_with_client_cert_source( + transport_class +): + with mock.patch("grpc.ssl_channel_credentials", autospec=True) as grpc_ssl_channel_cred: + with mock.patch.object(transport_class, "create_channel") as grpc_create_channel: + mock_ssl_cred = mock.Mock() + grpc_ssl_channel_cred.return_value = mock_ssl_cred + + mock_grpc_channel = mock.Mock() + grpc_create_channel.return_value = mock_grpc_channel + + cred = ga_credentials.AnonymousCredentials() + with pytest.warns(DeprecationWarning): + with mock.patch.object(google.auth, 'default') as adc: + adc.return_value = (cred, None) + transport = transport_class( + host="squid.clam.whelk", + api_mtls_endpoint="mtls.squid.clam.whelk", + client_cert_source=client_cert_source_callback, + ) + adc.assert_called_once() + + grpc_ssl_channel_cred.assert_called_once_with( + certificate_chain=b"cert bytes", private_key=b"key bytes" + ) + grpc_create_channel.assert_called_once_with( + "mtls.squid.clam.whelk:443", + credentials=cred, + credentials_file=None, + scopes=None, + ssl_credentials=mock_ssl_cred, + quota_project_id=None, + options=[ + ("grpc.max_send_message_length", -1), + ("grpc.max_receive_message_length", -1), + ], + ) + assert transport.grpc_channel == mock_grpc_channel + assert transport._ssl_channel_credentials == mock_ssl_cred + + +# Remove this test when deprecated arguments (api_mtls_endpoint, client_cert_source) are +# removed from grpc/grpc_asyncio transport constructor. +@pytest.mark.parametrize("transport_class", [transports.CertificateAuthorityServiceGrpcTransport, transports.CertificateAuthorityServiceGrpcAsyncIOTransport]) +def test_certificate_authority_service_transport_channel_mtls_with_adc( + transport_class +): + mock_ssl_cred = mock.Mock() + with mock.patch.multiple( + "google.auth.transport.grpc.SslCredentials", + __init__=mock.Mock(return_value=None), + ssl_credentials=mock.PropertyMock(return_value=mock_ssl_cred), + ): + with mock.patch.object(transport_class, "create_channel") as grpc_create_channel: + mock_grpc_channel = mock.Mock() + grpc_create_channel.return_value = mock_grpc_channel + mock_cred = mock.Mock() + + with pytest.warns(DeprecationWarning): + transport = transport_class( + host="squid.clam.whelk", + credentials=mock_cred, + api_mtls_endpoint="mtls.squid.clam.whelk", + client_cert_source=None, + ) + + grpc_create_channel.assert_called_once_with( + "mtls.squid.clam.whelk:443", + credentials=mock_cred, + credentials_file=None, + scopes=None, + ssl_credentials=mock_ssl_cred, + quota_project_id=None, + options=[ + ("grpc.max_send_message_length", -1), + ("grpc.max_receive_message_length", -1), + ], + ) + assert transport.grpc_channel == mock_grpc_channel + + +def test_certificate_authority_service_grpc_lro_client(): + client = CertificateAuthorityServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + transport='grpc', + ) + transport = client.transport + + # Ensure that we have a api-core operations client. + assert isinstance( + transport.operations_client, + operations_v1.OperationsClient, + ) + + # Ensure that subsequent calls to the property send the exact same object. + assert transport.operations_client is transport.operations_client + + +def test_certificate_authority_service_grpc_lro_async_client(): + client = CertificateAuthorityServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + transport='grpc_asyncio', + ) + transport = client.transport + + # Ensure that we have a api-core operations client. + assert isinstance( + transport.operations_client, + operations_v1.OperationsAsyncClient, + ) + + # Ensure that subsequent calls to the property send the exact same object. + assert transport.operations_client is transport.operations_client + + +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, ) + actual = CertificateAuthorityServiceClient.ca_pool_path(project, location, ca_pool) + assert expected == actual + + +def test_parse_ca_pool_path(): + expected = { + "project": "octopus", + "location": "oyster", + "ca_pool": "nudibranch", + } + path = CertificateAuthorityServiceClient.ca_pool_path(**expected) + + # Check that the path construction is reversible. + actual = CertificateAuthorityServiceClient.parse_ca_pool_path(path) + assert expected == actual + +def test_certificate_path(): + project = "cuttlefish" + 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, ) + actual = CertificateAuthorityServiceClient.certificate_path(project, location, ca_pool, certificate) + assert expected == actual + + +def test_parse_certificate_path(): + expected = { + "project": "scallop", + "location": "abalone", + "ca_pool": "squid", + "certificate": "clam", + } + path = CertificateAuthorityServiceClient.certificate_path(**expected) + + # Check that the path construction is reversible. + actual = CertificateAuthorityServiceClient.parse_certificate_path(path) + assert expected == actual + +def test_certificate_authority_path(): + project = "whelk" + location = "octopus" + ca_pool = "oyster" + certificate_authority = "nudibranch" + expected = "projects/{project}/locations/{location}/caPools/{ca_pool}/certificateAuthorities/{certificate_authority}".format(project=project, location=location, ca_pool=ca_pool, certificate_authority=certificate_authority, ) + actual = CertificateAuthorityServiceClient.certificate_authority_path(project, location, ca_pool, certificate_authority) + assert expected == actual + + +def test_parse_certificate_authority_path(): + expected = { + "project": "cuttlefish", + "location": "mussel", + "ca_pool": "winkle", + "certificate_authority": "nautilus", + } + path = CertificateAuthorityServiceClient.certificate_authority_path(**expected) + + # Check that the path construction is reversible. + actual = CertificateAuthorityServiceClient.parse_certificate_authority_path(path) + assert expected == actual + +def test_certificate_revocation_list_path(): + project = "scallop" + location = "abalone" + 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, ca_pool=ca_pool, certificate_authority=certificate_authority, certificate_revocation_list=certificate_revocation_list, ) + actual = CertificateAuthorityServiceClient.certificate_revocation_list_path(project, location, ca_pool, certificate_authority, certificate_revocation_list) + assert expected == actual + + +def test_parse_certificate_revocation_list_path(): + expected = { + "project": "octopus", + "location": "oyster", + "ca_pool": "nudibranch", + "certificate_authority": "cuttlefish", + "certificate_revocation_list": "mussel", + } + path = CertificateAuthorityServiceClient.certificate_revocation_list_path(**expected) + + # Check that the path construction is reversible. + actual = CertificateAuthorityServiceClient.parse_certificate_revocation_list_path(path) + assert expected == actual + +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, ) + actual = CertificateAuthorityServiceClient.certificate_template_path(project, location, certificate_template) + assert expected == actual + + +def test_parse_certificate_template_path(): + expected = { + "project": "abalone", + "location": "squid", + "certificate_template": "clam", + } + path = CertificateAuthorityServiceClient.certificate_template_path(**expected) + + # Check that the path construction is reversible. + actual = CertificateAuthorityServiceClient.parse_certificate_template_path(path) + assert expected == actual + +def test_common_billing_account_path(): + billing_account = "whelk" + expected = "billingAccounts/{billing_account}".format(billing_account=billing_account, ) + actual = CertificateAuthorityServiceClient.common_billing_account_path(billing_account) + assert expected == actual + + +def test_parse_common_billing_account_path(): + expected = { + "billing_account": "octopus", + } + path = CertificateAuthorityServiceClient.common_billing_account_path(**expected) + + # Check that the path construction is reversible. + actual = CertificateAuthorityServiceClient.parse_common_billing_account_path(path) + assert expected == actual + +def test_common_folder_path(): + folder = "oyster" + expected = "folders/{folder}".format(folder=folder, ) + actual = CertificateAuthorityServiceClient.common_folder_path(folder) + assert expected == actual + + +def test_parse_common_folder_path(): + expected = { + "folder": "nudibranch", + } + path = CertificateAuthorityServiceClient.common_folder_path(**expected) + + # Check that the path construction is reversible. + actual = CertificateAuthorityServiceClient.parse_common_folder_path(path) + assert expected == actual + +def test_common_organization_path(): + organization = "cuttlefish" + expected = "organizations/{organization}".format(organization=organization, ) + actual = CertificateAuthorityServiceClient.common_organization_path(organization) + assert expected == actual + + +def test_parse_common_organization_path(): + expected = { + "organization": "mussel", + } + path = CertificateAuthorityServiceClient.common_organization_path(**expected) + + # Check that the path construction is reversible. + actual = CertificateAuthorityServiceClient.parse_common_organization_path(path) + assert expected == actual + +def test_common_project_path(): + project = "winkle" + expected = "projects/{project}".format(project=project, ) + actual = CertificateAuthorityServiceClient.common_project_path(project) + assert expected == actual + + +def test_parse_common_project_path(): + expected = { + "project": "nautilus", + } + path = CertificateAuthorityServiceClient.common_project_path(**expected) + + # Check that the path construction is reversible. + actual = CertificateAuthorityServiceClient.parse_common_project_path(path) + assert expected == actual + +def test_common_location_path(): + project = "scallop" + location = "abalone" + expected = "projects/{project}/locations/{location}".format(project=project, location=location, ) + actual = CertificateAuthorityServiceClient.common_location_path(project, location) + assert expected == actual + + +def test_parse_common_location_path(): + expected = { + "project": "squid", + "location": "clam", + } + path = CertificateAuthorityServiceClient.common_location_path(**expected) + + # Check that the path construction is reversible. + actual = CertificateAuthorityServiceClient.parse_common_location_path(path) + assert expected == actual + + +def test_client_with_default_client_info(): + client_info = gapic_v1.client_info.ClientInfo() + + with mock.patch.object(transports.CertificateAuthorityServiceTransport, '_prep_wrapped_messages') as prep: + client = CertificateAuthorityServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + client_info=client_info, + ) + prep.assert_called_once_with(client_info) + + with mock.patch.object(transports.CertificateAuthorityServiceTransport, '_prep_wrapped_messages') as prep: + transport_class = CertificateAuthorityServiceClient.get_transport_class() + transport = transport_class( + credentials=ga_credentials.AnonymousCredentials(), + client_info=client_info, + ) + prep.assert_called_once_with(client_info) + +@pytest.mark.asyncio +async def test_transport_close_async(): + client = CertificateAuthorityServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc_asyncio", + ) + with mock.patch.object(type(getattr(client.transport, "grpc_channel")), "close") as close: + async with client: + close.assert_not_called() + close.assert_called_once() + + +def test_transport_close(): + transports = { + "grpc": "_grpc_channel", + } + + for transport, close_name in transports.items(): + client = CertificateAuthorityServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport + ) + with mock.patch.object(type(getattr(client.transport, close_name)), "close") as close: + with client: + close.assert_not_called() + close.assert_called_once() + +def test_client_ctx(): + transports = [ + 'grpc', + ] + for transport in transports: + client = CertificateAuthorityServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport + ) + # Test client calls underlying transport. + with mock.patch.object(type(client.transport), "close") as close: + close.assert_not_called() + with client: + pass + close.assert_called() + +@pytest.mark.parametrize("client_class,transport_class", [ + (CertificateAuthorityServiceClient, transports.CertificateAuthorityServiceGrpcTransport), + (CertificateAuthorityServiceAsyncClient, transports.CertificateAuthorityServiceGrpcAsyncIOTransport), +]) +def test_api_key_credentials(client_class, transport_class): + with mock.patch.object( + google.auth._default, "get_api_key_credentials", create=True + ) as get_api_key_credentials: + mock_cred = mock.Mock() + get_api_key_credentials.return_value = mock_cred + options = client_options.ClientOptions() + options.api_key = "api_key" + with mock.patch.object(transport_class, "__init__") as patched: + patched.return_value = None + client = client_class(client_options=options) + patched.assert_called_once_with( + credentials=mock_cred, + credentials_file=None, + host=client.DEFAULT_ENDPOINT, + scopes=None, + client_cert_source_for_mtls=None, + quota_project_id=None, + client_info=transports.base.DEFAULT_CLIENT_INFO, + always_use_jwt_access=True, + api_audience=None, + ) diff --git a/owl-bot-staging/v1beta1/.coveragerc b/owl-bot-staging/v1beta1/.coveragerc new file mode 100644 index 0000000..eeab431 --- /dev/null +++ b/owl-bot-staging/v1beta1/.coveragerc @@ -0,0 +1,13 @@ +[run] +branch = True + +[report] +show_missing = True +omit = + google/cloud/security/privateca/__init__.py + google/cloud/security/privateca/gapic_version.py +exclude_lines = + # Re-enable the standard pragma + pragma: NO COVER + # Ignore debug-only repr + def __repr__ diff --git a/owl-bot-staging/v1beta1/.flake8 b/owl-bot-staging/v1beta1/.flake8 new file mode 100644 index 0000000..29227d4 --- /dev/null +++ b/owl-bot-staging/v1beta1/.flake8 @@ -0,0 +1,33 @@ +# -*- 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 +# +# https://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. + +# Generated by synthtool. DO NOT EDIT! +[flake8] +ignore = E203, E266, E501, W503 +exclude = + # Exclude generated code. + **/proto/** + **/gapic/** + **/services/** + **/types/** + *_pb2.py + + # Standard linting exemptions. + **/.nox/** + __pycache__, + .git, + *.pyc, + conf.py diff --git a/owl-bot-staging/v1beta1/MANIFEST.in b/owl-bot-staging/v1beta1/MANIFEST.in new file mode 100644 index 0000000..de196ee --- /dev/null +++ b/owl-bot-staging/v1beta1/MANIFEST.in @@ -0,0 +1,2 @@ +recursive-include google/cloud/security/privateca *.py +recursive-include google/cloud/security/privateca_v1beta1 *.py diff --git a/owl-bot-staging/v1beta1/README.rst b/owl-bot-staging/v1beta1/README.rst new file mode 100644 index 0000000..d1e676b --- /dev/null +++ b/owl-bot-staging/v1beta1/README.rst @@ -0,0 +1,49 @@ +Python Client for Google Cloud Security Privateca API +================================================= + +Quick Start +----------- + +In order to use this library, you first need to go through the following steps: + +1. `Select or create a Cloud Platform project.`_ +2. `Enable billing for your project.`_ +3. Enable the Google Cloud Security Privateca API. +4. `Setup Authentication.`_ + +.. _Select or create a Cloud Platform project.: https://console.cloud.google.com/project +.. _Enable billing for your project.: https://cloud.google.com/billing/docs/how-to/modify-project#enable_billing_for_a_project +.. _Setup Authentication.: https://googleapis.dev/python/google-api-core/latest/auth.html + +Installation +~~~~~~~~~~~~ + +Install this library in a `virtualenv`_ using pip. `virtualenv`_ is a tool to +create isolated Python environments. The basic problem it addresses is one of +dependencies and versions, and indirectly permissions. + +With `virtualenv`_, it's possible to install this library without needing system +install permissions, and without clashing with the installed system +dependencies. + +.. _`virtualenv`: https://virtualenv.pypa.io/en/latest/ + + +Mac/Linux +^^^^^^^^^ + +.. code-block:: console + + python3 -m venv + source /bin/activate + /bin/pip install /path/to/library + + +Windows +^^^^^^^ + +.. code-block:: console + + python3 -m venv + \Scripts\activate + \Scripts\pip.exe install \path\to\library diff --git a/owl-bot-staging/v1beta1/docs/conf.py b/owl-bot-staging/v1beta1/docs/conf.py new file mode 100644 index 0000000..529fb70 --- /dev/null +++ b/owl-bot-staging/v1beta1/docs/conf.py @@ -0,0 +1,376 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# +# google-cloud-private-ca documentation build configuration file +# +# This file is execfile()d with the current directory set to its +# containing dir. +# +# Note that not all possible configuration values are present in this +# autogenerated file. +# +# All configuration values have a default; values that are commented out +# serve to show the default. + +import sys +import os +import shlex + +# If extensions (or modules to document with autodoc) are in another directory, +# add these directories to sys.path here. If the directory is relative to the +# documentation root, use os.path.abspath to make it absolute, like shown here. +sys.path.insert(0, os.path.abspath("..")) + +__version__ = "0.1.0" + +# -- General configuration ------------------------------------------------ + +# If your documentation needs a minimal Sphinx version, state it here. +needs_sphinx = "4.0.1" + +# Add any Sphinx extension module names here, as strings. They can be +# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom +# ones. +extensions = [ + "sphinx.ext.autodoc", + "sphinx.ext.autosummary", + "sphinx.ext.intersphinx", + "sphinx.ext.coverage", + "sphinx.ext.napoleon", + "sphinx.ext.todo", + "sphinx.ext.viewcode", +] + +# autodoc/autosummary flags +autoclass_content = "both" +autodoc_default_flags = ["members"] +autosummary_generate = True + + +# Add any paths that contain templates here, relative to this directory. +templates_path = ["_templates"] + +# Allow markdown includes (so releases.md can include CHANGLEOG.md) +# http://www.sphinx-doc.org/en/master/markdown.html +source_parsers = {".md": "recommonmark.parser.CommonMarkParser"} + +# The suffix(es) of source filenames. +# You can specify multiple suffix as a list of string: +source_suffix = [".rst", ".md"] + +# The encoding of source files. +# source_encoding = 'utf-8-sig' + +# The root toctree document. +root_doc = "index" + +# General information about the project. +project = u"google-cloud-private-ca" +copyright = u"2022, Google, LLC" +author = u"Google APIs" # TODO: autogenerate this bit + +# The version info for the project you're documenting, acts as replacement for +# |version| and |release|, also used in various other places throughout the +# built documents. +# +# The full version, including alpha/beta/rc tags. +release = __version__ +# The short X.Y version. +version = ".".join(release.split(".")[0:2]) + +# The language for content autogenerated by Sphinx. Refer to documentation +# for a list of supported languages. +# +# This is also used if you do content translation via gettext catalogs. +# Usually you set "language" from the command line for these cases. +language = None + +# There are two options for replacing |today|: either, you set today to some +# non-false value, then it is used: +# today = '' +# Else, today_fmt is used as the format for a strftime call. +# today_fmt = '%B %d, %Y' + +# List of patterns, relative to source directory, that match files and +# directories to ignore when looking for source files. +exclude_patterns = ["_build"] + +# The reST default role (used for this markup: `text`) to use for all +# documents. +# default_role = None + +# If true, '()' will be appended to :func: etc. cross-reference text. +# add_function_parentheses = True + +# If true, the current module name will be prepended to all description +# unit titles (such as .. function::). +# add_module_names = True + +# If true, sectionauthor and moduleauthor directives will be shown in the +# output. They are ignored by default. +# show_authors = False + +# The name of the Pygments (syntax highlighting) style to use. +pygments_style = "sphinx" + +# A list of ignored prefixes for module index sorting. +# modindex_common_prefix = [] + +# If true, keep warnings as "system message" paragraphs in the built documents. +# keep_warnings = False + +# If true, `todo` and `todoList` produce output, else they produce nothing. +todo_include_todos = True + + +# -- Options for HTML output ---------------------------------------------- + +# The theme to use for HTML and HTML Help pages. See the documentation for +# a list of builtin themes. +html_theme = "alabaster" + +# Theme options are theme-specific and customize the look and feel of a theme +# further. For a list of options available for each theme, see the +# documentation. +html_theme_options = { + "description": "Google Cloud Security Client Libraries for Python", + "github_user": "googleapis", + "github_repo": "google-cloud-python", + "github_banner": True, + "font_family": "'Roboto', Georgia, sans", + "head_font_family": "'Roboto', Georgia, serif", + "code_font_family": "'Roboto Mono', 'Consolas', monospace", +} + +# Add any paths that contain custom themes here, relative to this directory. +# html_theme_path = [] + +# The name for this set of Sphinx documents. If None, it defaults to +# " v documentation". +# html_title = None + +# A shorter title for the navigation bar. Default is the same as html_title. +# html_short_title = None + +# The name of an image file (relative to this directory) to place at the top +# of the sidebar. +# html_logo = None + +# The name of an image file (within the static path) to use as favicon of the +# docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32 +# pixels large. +# html_favicon = None + +# Add any paths that contain custom static files (such as style sheets) here, +# relative to this directory. They are copied after the builtin static files, +# so a file named "default.css" will overwrite the builtin "default.css". +html_static_path = ["_static"] + +# Add any extra paths that contain custom files (such as robots.txt or +# .htaccess) here, relative to this directory. These files are copied +# directly to the root of the documentation. +# html_extra_path = [] + +# If not '', a 'Last updated on:' timestamp is inserted at every page bottom, +# using the given strftime format. +# html_last_updated_fmt = '%b %d, %Y' + +# If true, SmartyPants will be used to convert quotes and dashes to +# typographically correct entities. +# html_use_smartypants = True + +# Custom sidebar templates, maps document names to template names. +# html_sidebars = {} + +# Additional templates that should be rendered to pages, maps page names to +# template names. +# html_additional_pages = {} + +# If false, no module index is generated. +# html_domain_indices = True + +# If false, no index is generated. +# html_use_index = True + +# If true, the index is split into individual pages for each letter. +# html_split_index = False + +# If true, links to the reST sources are added to the pages. +# html_show_sourcelink = True + +# If true, "Created using Sphinx" is shown in the HTML footer. Default is True. +# html_show_sphinx = True + +# If true, "(C) Copyright ..." is shown in the HTML footer. Default is True. +# html_show_copyright = True + +# If true, an OpenSearch description file will be output, and all pages will +# contain a tag referring to it. The value of this option must be the +# base URL from which the finished HTML is served. +# html_use_opensearch = '' + +# This is the file name suffix for HTML files (e.g. ".xhtml"). +# html_file_suffix = None + +# Language to be used for generating the HTML full-text search index. +# Sphinx supports the following languages: +# 'da', 'de', 'en', 'es', 'fi', 'fr', 'hu', 'it', 'ja' +# 'nl', 'no', 'pt', 'ro', 'ru', 'sv', 'tr' +# html_search_language = 'en' + +# A dictionary with options for the search language support, empty by default. +# Now only 'ja' uses this config value +# html_search_options = {'type': 'default'} + +# The name of a javascript file (relative to the configuration directory) that +# implements a search results scorer. If empty, the default will be used. +# html_search_scorer = 'scorer.js' + +# Output file base name for HTML help builder. +htmlhelp_basename = "google-cloud-private-ca-doc" + +# -- Options for warnings ------------------------------------------------------ + + +suppress_warnings = [ + # Temporarily suppress this to avoid "more than one target found for + # cross-reference" warning, which are intractable for us to avoid while in + # a mono-repo. + # See https://github.com/sphinx-doc/sphinx/blob + # /2a65ffeef5c107c19084fabdd706cdff3f52d93c/sphinx/domains/python.py#L843 + "ref.python" +] + +# -- Options for LaTeX output --------------------------------------------- + +latex_elements = { + # The paper size ('letterpaper' or 'a4paper'). + # 'papersize': 'letterpaper', + # The font size ('10pt', '11pt' or '12pt'). + # 'pointsize': '10pt', + # Additional stuff for the LaTeX preamble. + # 'preamble': '', + # Latex figure (float) alignment + # 'figure_align': 'htbp', +} + +# Grouping the document tree into LaTeX files. List of tuples +# (source start file, target name, title, +# author, documentclass [howto, manual, or own class]). +latex_documents = [ + ( + root_doc, + "google-cloud-private-ca.tex", + u"google-cloud-private-ca Documentation", + author, + "manual", + ) +] + +# The name of an image file (relative to this directory) to place at the top of +# the title page. +# latex_logo = None + +# For "manual" documents, if this is true, then toplevel headings are parts, +# not chapters. +# latex_use_parts = False + +# If true, show page references after internal links. +# latex_show_pagerefs = False + +# If true, show URL addresses after external links. +# latex_show_urls = False + +# Documents to append as an appendix to all manuals. +# latex_appendices = [] + +# If false, no module index is generated. +# latex_domain_indices = True + + +# -- Options for manual page output --------------------------------------- + +# One entry per manual page. List of tuples +# (source start file, name, description, authors, manual section). +man_pages = [ + ( + root_doc, + "google-cloud-private-ca", + u"Google Cloud Security Privateca Documentation", + [author], + 1, + ) +] + +# If true, show URL addresses after external links. +# man_show_urls = False + + +# -- Options for Texinfo output ------------------------------------------- + +# Grouping the document tree into Texinfo files. List of tuples +# (source start file, target name, title, author, +# dir menu entry, description, category) +texinfo_documents = [ + ( + root_doc, + "google-cloud-private-ca", + u"google-cloud-private-ca Documentation", + author, + "google-cloud-private-ca", + "GAPIC library for Google Cloud Security Privateca API", + "APIs", + ) +] + +# Documents to append as an appendix to all manuals. +# texinfo_appendices = [] + +# If false, no module index is generated. +# texinfo_domain_indices = True + +# How to display URL addresses: 'footnote', 'no', or 'inline'. +# texinfo_show_urls = 'footnote' + +# If true, do not generate a @detailmenu in the "Top" node's menu. +# texinfo_no_detailmenu = False + + +# Example configuration for intersphinx: refer to the Python standard library. +intersphinx_mapping = { + "python": ("http://python.readthedocs.org/en/latest/", None), + "gax": ("https://gax-python.readthedocs.org/en/latest/", None), + "google-auth": ("https://google-auth.readthedocs.io/en/stable", None), + "google-gax": ("https://gax-python.readthedocs.io/en/latest/", None), + "google.api_core": ("https://googleapis.dev/python/google-api-core/latest/", None), + "grpc": ("https://grpc.io/grpc/python/", None), + "requests": ("http://requests.kennethreitz.org/en/stable/", None), + "proto": ("https://proto-plus-python.readthedocs.io/en/stable", None), + "protobuf": ("https://googleapis.dev/python/protobuf/latest/", None), +} + + +# Napoleon settings +napoleon_google_docstring = True +napoleon_numpy_docstring = True +napoleon_include_private_with_doc = False +napoleon_include_special_with_doc = True +napoleon_use_admonition_for_examples = False +napoleon_use_admonition_for_notes = False +napoleon_use_admonition_for_references = False +napoleon_use_ivar = False +napoleon_use_param = True +napoleon_use_rtype = True diff --git a/owl-bot-staging/v1beta1/docs/index.rst b/owl-bot-staging/v1beta1/docs/index.rst new file mode 100644 index 0000000..43f127e --- /dev/null +++ b/owl-bot-staging/v1beta1/docs/index.rst @@ -0,0 +1,7 @@ +API Reference +------------- +.. toctree:: + :maxdepth: 2 + + privateca_v1beta1/services + privateca_v1beta1/types diff --git a/owl-bot-staging/v1beta1/docs/privateca_v1beta1/certificate_authority_service.rst b/owl-bot-staging/v1beta1/docs/privateca_v1beta1/certificate_authority_service.rst new file mode 100644 index 0000000..536a4c8 --- /dev/null +++ b/owl-bot-staging/v1beta1/docs/privateca_v1beta1/certificate_authority_service.rst @@ -0,0 +1,10 @@ +CertificateAuthorityService +--------------------------------------------- + +.. automodule:: google.cloud.security.privateca_v1beta1.services.certificate_authority_service + :members: + :inherited-members: + +.. automodule:: google.cloud.security.privateca_v1beta1.services.certificate_authority_service.pagers + :members: + :inherited-members: diff --git a/owl-bot-staging/v1beta1/docs/privateca_v1beta1/services.rst b/owl-bot-staging/v1beta1/docs/privateca_v1beta1/services.rst new file mode 100644 index 0000000..bb5adb3 --- /dev/null +++ b/owl-bot-staging/v1beta1/docs/privateca_v1beta1/services.rst @@ -0,0 +1,6 @@ +Services for Google Cloud Security Privateca v1beta1 API +======================================================== +.. toctree:: + :maxdepth: 2 + + certificate_authority_service diff --git a/owl-bot-staging/v1beta1/docs/privateca_v1beta1/types.rst b/owl-bot-staging/v1beta1/docs/privateca_v1beta1/types.rst new file mode 100644 index 0000000..f2394f1 --- /dev/null +++ b/owl-bot-staging/v1beta1/docs/privateca_v1beta1/types.rst @@ -0,0 +1,6 @@ +Types for Google Cloud Security Privateca v1beta1 API +===================================================== + +.. automodule:: google.cloud.security.privateca_v1beta1.types + :members: + :show-inheritance: diff --git a/owl-bot-staging/v1beta1/google/cloud/security/privateca/__init__.py b/owl-bot-staging/v1beta1/google/cloud/security/privateca/__init__.py new file mode 100644 index 0000000..243f36d --- /dev/null +++ b/owl-bot-staging/v1beta1/google/cloud/security/privateca/__init__.py @@ -0,0 +1,111 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +from google.cloud.security.privateca import gapic_version as package_version + +__version__ = package_version.__version__ + + +from google.cloud.security.privateca_v1beta1.services.certificate_authority_service.client import CertificateAuthorityServiceClient +from google.cloud.security.privateca_v1beta1.services.certificate_authority_service.async_client import CertificateAuthorityServiceAsyncClient + +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 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.resources import RevocationReason +from google.cloud.security.privateca_v1beta1.types.service import ActivateCertificateAuthorityRequest +from google.cloud.security.privateca_v1beta1.types.service import CreateCertificateAuthorityRequest +from google.cloud.security.privateca_v1beta1.types.service import CreateCertificateRequest +from google.cloud.security.privateca_v1beta1.types.service import DisableCertificateAuthorityRequest +from google.cloud.security.privateca_v1beta1.types.service import EnableCertificateAuthorityRequest +from google.cloud.security.privateca_v1beta1.types.service import FetchCertificateAuthorityCsrRequest +from google.cloud.security.privateca_v1beta1.types.service import FetchCertificateAuthorityCsrResponse +from google.cloud.security.privateca_v1beta1.types.service import GetCertificateAuthorityRequest +from google.cloud.security.privateca_v1beta1.types.service import GetCertificateRequest +from google.cloud.security.privateca_v1beta1.types.service import GetCertificateRevocationListRequest +from google.cloud.security.privateca_v1beta1.types.service import GetReusableConfigRequest +from google.cloud.security.privateca_v1beta1.types.service import ListCertificateAuthoritiesRequest +from google.cloud.security.privateca_v1beta1.types.service import ListCertificateAuthoritiesResponse +from google.cloud.security.privateca_v1beta1.types.service import ListCertificateRevocationListsRequest +from google.cloud.security.privateca_v1beta1.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_v1beta1.types.service import ListReusableConfigsRequest +from google.cloud.security.privateca_v1beta1.types.service import ListReusableConfigsResponse +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 UpdateCertificateAuthorityRequest +from google.cloud.security.privateca_v1beta1.types.service import UpdateCertificateRequest +from google.cloud.security.privateca_v1beta1.types.service import UpdateCertificateRevocationListRequest + +__all__ = ('CertificateAuthorityServiceClient', + 'CertificateAuthorityServiceAsyncClient', + 'Certificate', + 'CertificateAuthority', + 'CertificateConfig', + 'CertificateDescription', + 'CertificateRevocationList', + 'KeyUsage', + 'ObjectId', + 'PublicKey', + 'ReusableConfig', + 'ReusableConfigValues', + 'ReusableConfigWrapper', + 'Subject', + 'SubjectAltNames', + 'SubordinateConfig', + 'X509Extension', + 'RevocationReason', + 'ActivateCertificateAuthorityRequest', + 'CreateCertificateAuthorityRequest', + 'CreateCertificateRequest', + 'DisableCertificateAuthorityRequest', + 'EnableCertificateAuthorityRequest', + 'FetchCertificateAuthorityCsrRequest', + 'FetchCertificateAuthorityCsrResponse', + 'GetCertificateAuthorityRequest', + 'GetCertificateRequest', + 'GetCertificateRevocationListRequest', + 'GetReusableConfigRequest', + 'ListCertificateAuthoritiesRequest', + 'ListCertificateAuthoritiesResponse', + 'ListCertificateRevocationListsRequest', + 'ListCertificateRevocationListsResponse', + 'ListCertificatesRequest', + 'ListCertificatesResponse', + 'ListReusableConfigsRequest', + 'ListReusableConfigsResponse', + 'OperationMetadata', + 'RestoreCertificateAuthorityRequest', + 'RevokeCertificateRequest', + 'ScheduleDeleteCertificateAuthorityRequest', + 'UpdateCertificateAuthorityRequest', + 'UpdateCertificateRequest', + 'UpdateCertificateRevocationListRequest', +) diff --git a/owl-bot-staging/v1beta1/google/cloud/security/privateca/gapic_version.py b/owl-bot-staging/v1beta1/google/cloud/security/privateca/gapic_version.py new file mode 100644 index 0000000..405b1ce --- /dev/null +++ b/owl-bot-staging/v1beta1/google/cloud/security/privateca/gapic_version.py @@ -0,0 +1,16 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +__version__ = "0.1.0" # {x-release-please-version} diff --git a/owl-bot-staging/v1beta1/google/cloud/security/privateca/py.typed b/owl-bot-staging/v1beta1/google/cloud/security/privateca/py.typed new file mode 100644 index 0000000..2803606 --- /dev/null +++ b/owl-bot-staging/v1beta1/google/cloud/security/privateca/py.typed @@ -0,0 +1,2 @@ +# Marker file for PEP 561. +# The google-cloud-private-ca package uses inline types. diff --git a/owl-bot-staging/v1beta1/google/cloud/security/privateca_v1beta1/__init__.py b/owl-bot-staging/v1beta1/google/cloud/security/privateca_v1beta1/__init__.py new file mode 100644 index 0000000..7221827 --- /dev/null +++ b/owl-bot-staging/v1beta1/google/cloud/security/privateca_v1beta1/__init__.py @@ -0,0 +1,112 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +from google.cloud.security.privateca_v1beta1 import gapic_version as package_version + +__version__ = package_version.__version__ + + +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 +from .types.resources import CertificateDescription +from .types.resources import CertificateRevocationList +from .types.resources import KeyUsage +from .types.resources import ObjectId +from .types.resources import PublicKey +from .types.resources import ReusableConfig +from .types.resources import ReusableConfigValues +from .types.resources import ReusableConfigWrapper +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 +from .types.service import DisableCertificateAuthorityRequest +from .types.service import EnableCertificateAuthorityRequest +from .types.service import FetchCertificateAuthorityCsrRequest +from .types.service import FetchCertificateAuthorityCsrResponse +from .types.service import GetCertificateAuthorityRequest +from .types.service import GetCertificateRequest +from .types.service import GetCertificateRevocationListRequest +from .types.service import GetReusableConfigRequest +from .types.service import ListCertificateAuthoritiesRequest +from .types.service import ListCertificateAuthoritiesResponse +from .types.service import ListCertificateRevocationListsRequest +from .types.service import ListCertificateRevocationListsResponse +from .types.service import ListCertificatesRequest +from .types.service import ListCertificatesResponse +from .types.service import ListReusableConfigsRequest +from .types.service import ListReusableConfigsResponse +from .types.service import OperationMetadata +from .types.service import RestoreCertificateAuthorityRequest +from .types.service import RevokeCertificateRequest +from .types.service import ScheduleDeleteCertificateAuthorityRequest +from .types.service import UpdateCertificateAuthorityRequest +from .types.service import UpdateCertificateRequest +from .types.service import UpdateCertificateRevocationListRequest + +__all__ = ( + 'CertificateAuthorityServiceAsyncClient', +'ActivateCertificateAuthorityRequest', +'Certificate', +'CertificateAuthority', +'CertificateAuthorityServiceClient', +'CertificateConfig', +'CertificateDescription', +'CertificateRevocationList', +'CreateCertificateAuthorityRequest', +'CreateCertificateRequest', +'DisableCertificateAuthorityRequest', +'EnableCertificateAuthorityRequest', +'FetchCertificateAuthorityCsrRequest', +'FetchCertificateAuthorityCsrResponse', +'GetCertificateAuthorityRequest', +'GetCertificateRequest', +'GetCertificateRevocationListRequest', +'GetReusableConfigRequest', +'KeyUsage', +'ListCertificateAuthoritiesRequest', +'ListCertificateAuthoritiesResponse', +'ListCertificateRevocationListsRequest', +'ListCertificateRevocationListsResponse', +'ListCertificatesRequest', +'ListCertificatesResponse', +'ListReusableConfigsRequest', +'ListReusableConfigsResponse', +'ObjectId', +'OperationMetadata', +'PublicKey', +'RestoreCertificateAuthorityRequest', +'ReusableConfig', +'ReusableConfigValues', +'ReusableConfigWrapper', +'RevocationReason', +'RevokeCertificateRequest', +'ScheduleDeleteCertificateAuthorityRequest', +'Subject', +'SubjectAltNames', +'SubordinateConfig', +'UpdateCertificateAuthorityRequest', +'UpdateCertificateRequest', +'UpdateCertificateRevocationListRequest', +'X509Extension', +) diff --git a/owl-bot-staging/v1beta1/google/cloud/security/privateca_v1beta1/gapic_metadata.json b/owl-bot-staging/v1beta1/google/cloud/security/privateca_v1beta1/gapic_metadata.json new file mode 100644 index 0000000..3406d51 --- /dev/null +++ b/owl-bot-staging/v1beta1/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/owl-bot-staging/v1beta1/google/cloud/security/privateca_v1beta1/gapic_version.py b/owl-bot-staging/v1beta1/google/cloud/security/privateca_v1beta1/gapic_version.py new file mode 100644 index 0000000..405b1ce --- /dev/null +++ b/owl-bot-staging/v1beta1/google/cloud/security/privateca_v1beta1/gapic_version.py @@ -0,0 +1,16 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +__version__ = "0.1.0" # {x-release-please-version} diff --git a/owl-bot-staging/v1beta1/google/cloud/security/privateca_v1beta1/py.typed b/owl-bot-staging/v1beta1/google/cloud/security/privateca_v1beta1/py.typed new file mode 100644 index 0000000..2803606 --- /dev/null +++ b/owl-bot-staging/v1beta1/google/cloud/security/privateca_v1beta1/py.typed @@ -0,0 +1,2 @@ +# Marker file for PEP 561. +# The google-cloud-private-ca package uses inline types. diff --git a/owl-bot-staging/v1beta1/google/cloud/security/privateca_v1beta1/services/__init__.py b/owl-bot-staging/v1beta1/google/cloud/security/privateca_v1beta1/services/__init__.py new file mode 100644 index 0000000..e8e1c38 --- /dev/null +++ b/owl-bot-staging/v1beta1/google/cloud/security/privateca_v1beta1/services/__init__.py @@ -0,0 +1,15 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# diff --git a/owl-bot-staging/v1beta1/google/cloud/security/privateca_v1beta1/services/certificate_authority_service/__init__.py b/owl-bot-staging/v1beta1/google/cloud/security/privateca_v1beta1/services/certificate_authority_service/__init__.py new file mode 100644 index 0000000..713bfd9 --- /dev/null +++ b/owl-bot-staging/v1beta1/google/cloud/security/privateca_v1beta1/services/certificate_authority_service/__init__.py @@ -0,0 +1,22 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +from .client import CertificateAuthorityServiceClient +from .async_client import CertificateAuthorityServiceAsyncClient + +__all__ = ( + 'CertificateAuthorityServiceClient', + 'CertificateAuthorityServiceAsyncClient', +) diff --git a/owl-bot-staging/v1beta1/google/cloud/security/privateca_v1beta1/services/certificate_authority_service/async_client.py b/owl-bot-staging/v1beta1/google/cloud/security/privateca_v1beta1/services/certificate_authority_service/async_client.py new file mode 100644 index 0000000..b7ef08b --- /dev/null +++ b/owl-bot-staging/v1beta1/google/cloud/security/privateca_v1beta1/services/certificate_authority_service/async_client.py @@ -0,0 +1,2618 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +from collections import OrderedDict +import functools +import re +from typing import Dict, Mapping, MutableMapping, MutableSequence, Optional, Sequence, Tuple, Type, Union + +from google.cloud.security.privateca_v1beta1 import gapic_version as package_version + +from google.api_core.client_options import ClientOptions +from google.api_core import exceptions as core_exceptions +from google.api_core import gapic_v1 +from google.api_core import retry as retries +from google.auth import credentials as ga_credentials # type: ignore +from google.oauth2 import service_account # type: ignore + +try: + OptionalRetry = Union[retries.Retry, gapic_v1.method._MethodDefault] +except AttributeError: # pragma: NO COVER + OptionalRetry = Union[retries.Retry, object] # type: ignore + +from google.api_core import operation # type: ignore +from google.api_core import operation_async # type: ignore +from google.cloud.security.privateca_v1beta1.services.certificate_authority_service import pagers +from google.cloud.security.privateca_v1beta1.types import resources +from google.cloud.security.privateca_v1beta1.types import service +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 + + +class CertificateAuthorityServiceAsyncClient: + """[Certificate Authority + Service][google.cloud.security.privateca.v1beta1.CertificateAuthorityService] + manages private certificate authorities and issued certificates. + """ + + _client: CertificateAuthorityServiceClient + + DEFAULT_ENDPOINT = CertificateAuthorityServiceClient.DEFAULT_ENDPOINT + DEFAULT_MTLS_ENDPOINT = CertificateAuthorityServiceClient.DEFAULT_MTLS_ENDPOINT + + certificate_path = staticmethod(CertificateAuthorityServiceClient.certificate_path) + parse_certificate_path = staticmethod(CertificateAuthorityServiceClient.parse_certificate_path) + certificate_authority_path = staticmethod(CertificateAuthorityServiceClient.certificate_authority_path) + parse_certificate_authority_path = staticmethod(CertificateAuthorityServiceClient.parse_certificate_authority_path) + certificate_revocation_list_path = staticmethod(CertificateAuthorityServiceClient.certificate_revocation_list_path) + parse_certificate_revocation_list_path = staticmethod(CertificateAuthorityServiceClient.parse_certificate_revocation_list_path) + reusable_config_path = staticmethod(CertificateAuthorityServiceClient.reusable_config_path) + 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) + parse_common_location_path = staticmethod(CertificateAuthorityServiceClient.parse_common_location_path) + + @classmethod + def from_service_account_info(cls, info: dict, *args, **kwargs): + """Creates an instance of this client using the provided credentials + info. + + Args: + info (dict): The service account private key info. + args: Additional arguments to pass to the constructor. + kwargs: Additional arguments to pass to the constructor. + + Returns: + CertificateAuthorityServiceAsyncClient: The constructed client. + """ + return CertificateAuthorityServiceClient.from_service_account_info.__func__(CertificateAuthorityServiceAsyncClient, info, *args, **kwargs) # type: ignore + + @classmethod + def from_service_account_file(cls, filename: str, *args, **kwargs): + """Creates an instance of this client using the provided credentials + file. + + Args: + filename (str): The path to the service account private key json + file. + args: Additional arguments to pass to the constructor. + kwargs: Additional arguments to pass to the constructor. + + Returns: + CertificateAuthorityServiceAsyncClient: The constructed client. + """ + return CertificateAuthorityServiceClient.from_service_account_file.__func__(CertificateAuthorityServiceAsyncClient, filename, *args, **kwargs) # type: ignore + + from_service_account_json = from_service_account_file + + @classmethod + def get_mtls_endpoint_and_cert_source(cls, client_options: Optional[ClientOptions] = None): + """Return the API endpoint and client cert source for mutual TLS. + + The client cert source is determined in the following order: + (1) if `GOOGLE_API_USE_CLIENT_CERTIFICATE` environment variable is not "true", the + client cert source is None. + (2) if `client_options.client_cert_source` is provided, use the provided one; if the + default client cert source exists, use the default one; otherwise the client cert + source is None. + + The API endpoint is determined in the following order: + (1) if `client_options.api_endpoint` if provided, use the provided one. + (2) if `GOOGLE_API_USE_CLIENT_CERTIFICATE` environment variable is "always", use the + default mTLS endpoint; if the environment variable is "never", use the default API + endpoint; otherwise if client cert source exists, use the default mTLS endpoint, otherwise + use the default API endpoint. + + More details can be found at https://google.aip.dev/auth/4114. + + Args: + client_options (google.api_core.client_options.ClientOptions): Custom options for the + client. Only the `api_endpoint` and `client_cert_source` properties may be used + in this method. + + Returns: + Tuple[str, Callable[[], Tuple[bytes, bytes]]]: returns the API endpoint and the + client cert source to use. + + Raises: + google.auth.exceptions.MutualTLSChannelError: If any errors happen. + """ + return CertificateAuthorityServiceClient.get_mtls_endpoint_and_cert_source(client_options) # type: ignore + + @property + def transport(self) -> CertificateAuthorityServiceTransport: + """Returns the transport used by the client instance. + + Returns: + CertificateAuthorityServiceTransport: The transport used by the client instance. + """ + return self._client.transport + + get_transport_class = functools.partial(type(CertificateAuthorityServiceClient).get_transport_class, type(CertificateAuthorityServiceClient)) + + def __init__(self, *, + credentials: Optional[ga_credentials.Credentials] = None, + transport: Union[str, CertificateAuthorityServiceTransport] = "grpc_asyncio", + client_options: Optional[ClientOptions] = None, + client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, + ) -> None: + """Instantiates the certificate authority service client. + + Args: + credentials (Optional[google.auth.credentials.Credentials]): The + authorization credentials to attach to requests. These + credentials identify the application to the service; if none + are specified, the client will attempt to ascertain the + credentials from the environment. + transport (Union[str, ~.CertificateAuthorityServiceTransport]): The + transport to use. If set to None, a transport is chosen + automatically. + client_options (ClientOptions): Custom options for the client. It + won't take effect if a ``transport`` instance is provided. + (1) The ``api_endpoint`` property can be used to override the + default endpoint provided by the client. GOOGLE_API_USE_MTLS_ENDPOINT + environment variable can also be used to override the endpoint: + "always" (always use the default mTLS endpoint), "never" (always + use the default regular endpoint) and "auto" (auto switch to the + default mTLS endpoint if client certificate is present, this is + the default value). However, the ``api_endpoint`` property takes + precedence if provided. + (2) If GOOGLE_API_USE_CLIENT_CERTIFICATE environment variable + is "true", then the ``client_cert_source`` property can be used + to provide client certificate for mutual TLS transport. If + not provided, the default SSL client certificate will be used if + present. If GOOGLE_API_USE_CLIENT_CERTIFICATE is "false" or not + set, no client certificate will be used. + + Raises: + google.auth.exceptions.MutualTlsChannelError: If mutual TLS transport + creation failed for any reason. + """ + self._client = CertificateAuthorityServiceClient( + credentials=credentials, + transport=transport, + client_options=client_options, + client_info=client_info, + + ) + + async def create_certificate(self, + request: Optional[Union[service.CreateCertificateRequest, dict]] = None, + *, + parent: Optional[str] = None, + certificate: Optional[resources.Certificate] = None, + certificate_id: Optional[str] = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, str]] = (), + ) -> resources.Certificate: + r"""Create a new + [Certificate][google.cloud.security.privateca.v1beta1.Certificate] + in a given Project, Location from a particular + [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority]. + + .. code-block:: python + + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html + from google.cloud.security import privateca_v1beta1 + + async def sample_create_certificate(): + # Create a client + client = privateca_v1beta1.CertificateAuthorityServiceAsyncClient() + + # Initialize request argument(s) + certificate = privateca_v1beta1.Certificate() + certificate.pem_csr = "pem_csr_value" + + request = privateca_v1beta1.CreateCertificateRequest( + parent="parent_value", + certificate=certificate, + ) + + # Make the request + response = await client.create_certificate(request=request) + + # Handle the response + print(response) + + Args: + request (Optional[Union[google.cloud.security.privateca_v1beta1.types.CreateCertificateRequest, dict]]): + The request object. Request message for + [CertificateAuthorityService.CreateCertificate][google.cloud.security.privateca.v1beta1.CertificateAuthorityService.CreateCertificate]. + parent (:class:`str`): + Required. The resource name of the location and + [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority] + associated with the + [Certificate][google.cloud.security.privateca.v1beta1.Certificate], + in the format + ``projects/*/locations/*/certificateAuthorities/*``. + + This corresponds to the ``parent`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + certificate (:class:`google.cloud.security.privateca_v1beta1.types.Certificate`): + Required. A + [Certificate][google.cloud.security.privateca.v1beta1.Certificate] + with initial field values. + + This corresponds to the ``certificate`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + certificate_id (:class:`str`): + Optional. It must be unique within a location and match + the regular expression ``[a-zA-Z0-9_-]{1,63}``. This + field is required when using a + [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority] + in the Enterprise + [CertificateAuthority.Tier][google.cloud.security.privateca.v1beta1.CertificateAuthority.Tier], + but is optional and its value is ignored otherwise. + + 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. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.cloud.security.privateca_v1beta1.types.Certificate: + A [Certificate][google.cloud.security.privateca.v1beta1.Certificate] corresponds to a signed X.509 certificate issued by a + [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority]. + + """ + # Create or coerce a protobuf request object. + # Quick check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([parent, certificate, certificate_id]) + if request is not None and has_flattened_params: + raise ValueError("If the `request` argument is set, then none of " + "the individual field arguments should be set.") + + 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: + request.certificate = certificate + if certificate_id is not None: + request.certificate_id = certificate_id + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method_async.wrap_method( + self._client._transport.create_certificate, + default_timeout=None, + client_info=DEFAULT_CLIENT_INFO, + ) + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata(( + ("parent", request.parent), + )), + ) + + # Send the request. + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Done; return the response. + return response + + async def get_certificate(self, + request: Optional[Union[service.GetCertificateRequest, dict]] = None, + *, + name: Optional[str] = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, str]] = (), + ) -> resources.Certificate: + r"""Returns a + [Certificate][google.cloud.security.privateca.v1beta1.Certificate]. + + .. code-block:: python + + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html + from google.cloud.security import privateca_v1beta1 + + async def sample_get_certificate(): + # Create a client + client = privateca_v1beta1.CertificateAuthorityServiceAsyncClient() + + # Initialize request argument(s) + request = privateca_v1beta1.GetCertificateRequest( + name="name_value", + ) + + # Make the request + response = await client.get_certificate(request=request) + + # Handle the response + print(response) + + Args: + request (Optional[Union[google.cloud.security.privateca_v1beta1.types.GetCertificateRequest, dict]]): + The request object. Request message for + [CertificateAuthorityService.GetCertificate][google.cloud.security.privateca.v1beta1.CertificateAuthorityService.GetCertificate]. + name (:class:`str`): + Required. The + [name][google.cloud.security.privateca.v1beta1.Certificate.name] + of the + [Certificate][google.cloud.security.privateca.v1beta1.Certificate] + to get. + + 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. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.cloud.security.privateca_v1beta1.types.Certificate: + A [Certificate][google.cloud.security.privateca.v1beta1.Certificate] corresponds to a signed X.509 certificate issued by a + [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority]. + + """ + # Create or coerce a protobuf request object. + # Quick check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([name]) + if request is not None and has_flattened_params: + raise ValueError("If the `request` argument is set, then none of " + "the individual field arguments should be set.") + + 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 + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method_async.wrap_method( + self._client._transport.get_certificate, + default_timeout=None, + client_info=DEFAULT_CLIENT_INFO, + ) + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata(( + ("name", request.name), + )), + ) + + # Send the request. + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Done; return the response. + return response + + async def list_certificates(self, + request: Optional[Union[service.ListCertificatesRequest, dict]] = None, + *, + parent: Optional[str] = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, str]] = (), + ) -> pagers.ListCertificatesAsyncPager: + r"""Lists + [Certificates][google.cloud.security.privateca.v1beta1.Certificate]. + + .. code-block:: python + + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html + from google.cloud.security import privateca_v1beta1 + + async def sample_list_certificates(): + # Create a client + client = privateca_v1beta1.CertificateAuthorityServiceAsyncClient() + + # Initialize request argument(s) + request = privateca_v1beta1.ListCertificatesRequest( + parent="parent_value", + ) + + # Make the request + page_result = client.list_certificates(request=request) + + # Handle the response + async for response in page_result: + print(response) + + Args: + request (Optional[Union[google.cloud.security.privateca_v1beta1.types.ListCertificatesRequest, dict]]): + The request object. Request message for + [CertificateAuthorityService.ListCertificates][google.cloud.security.privateca.v1beta1.CertificateAuthorityService.ListCertificates]. + parent (:class:`str`): + Required. The resource name of the location associated + with the + [Certificates][google.cloud.security.privateca.v1beta1.Certificate], + in the format + ``projects/*/locations/*/certificateauthorities/*``. + + 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. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.cloud.security.privateca_v1beta1.services.certificate_authority_service.pagers.ListCertificatesAsyncPager: + Response message for + [CertificateAuthorityService.ListCertificates][google.cloud.security.privateca.v1beta1.CertificateAuthorityService.ListCertificates]. + + Iterating over this object will yield results and + resolve additional pages automatically. + + """ + # Create or coerce a protobuf request object. + # Quick check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([parent]) + if request is not None and has_flattened_params: + raise ValueError("If the `request` argument is set, then none of " + "the individual field arguments should be set.") + + 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 + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method_async.wrap_method( + self._client._transport.list_certificates, + default_timeout=None, + client_info=DEFAULT_CLIENT_INFO, + ) + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata(( + ("parent", request.parent), + )), + ) + + # Send the request. + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # This method is paged; wrap the response in a pager, which provides + # an `__aiter__` convenience method. + response = pagers.ListCertificatesAsyncPager( + method=rpc, + request=request, + response=response, + metadata=metadata, + ) + + # Done; return the response. + return response + + async def revoke_certificate(self, + request: Optional[Union[service.RevokeCertificateRequest, dict]] = None, + *, + name: Optional[str] = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, str]] = (), + ) -> resources.Certificate: + r"""Revoke a + [Certificate][google.cloud.security.privateca.v1beta1.Certificate]. + + .. code-block:: python + + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html + from google.cloud.security import privateca_v1beta1 + + async def sample_revoke_certificate(): + # Create a client + client = privateca_v1beta1.CertificateAuthorityServiceAsyncClient() + + # Initialize request argument(s) + request = privateca_v1beta1.RevokeCertificateRequest( + name="name_value", + reason="ATTRIBUTE_AUTHORITY_COMPROMISE", + ) + + # Make the request + response = await client.revoke_certificate(request=request) + + # Handle the response + print(response) + + Args: + request (Optional[Union[google.cloud.security.privateca_v1beta1.types.RevokeCertificateRequest, dict]]): + The request object. Request message for + [CertificateAuthorityService.RevokeCertificate][google.cloud.security.privateca.v1beta1.CertificateAuthorityService.RevokeCertificate]. + name (:class:`str`): + Required. The resource name for this + [Certificate][google.cloud.security.privateca.v1beta1.Certificate] + in the format + ``projects/*/locations/*/certificateAuthorities/*/certificates/*``. + + 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. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.cloud.security.privateca_v1beta1.types.Certificate: + A [Certificate][google.cloud.security.privateca.v1beta1.Certificate] corresponds to a signed X.509 certificate issued by a + [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority]. + + """ + # Create or coerce a protobuf request object. + # Quick check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([name]) + if request is not None and has_flattened_params: + raise ValueError("If the `request` argument is set, then none of " + "the individual field arguments should be set.") + + 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 + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method_async.wrap_method( + self._client._transport.revoke_certificate, + default_timeout=None, + client_info=DEFAULT_CLIENT_INFO, + ) + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata(( + ("name", request.name), + )), + ) + + # Send the request. + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Done; return the response. + return response + + async def update_certificate(self, + request: Optional[Union[service.UpdateCertificateRequest, dict]] = None, + *, + certificate: Optional[resources.Certificate] = None, + update_mask: Optional[field_mask_pb2.FieldMask] = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, str]] = (), + ) -> resources.Certificate: + r"""Update a + [Certificate][google.cloud.security.privateca.v1beta1.Certificate]. + Currently, the only field you can update is the + [labels][google.cloud.security.privateca.v1beta1.Certificate.labels] + field. + + .. code-block:: python + + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html + from google.cloud.security import privateca_v1beta1 + + async def sample_update_certificate(): + # Create a client + client = privateca_v1beta1.CertificateAuthorityServiceAsyncClient() + + # Initialize request argument(s) + certificate = privateca_v1beta1.Certificate() + certificate.pem_csr = "pem_csr_value" + + request = privateca_v1beta1.UpdateCertificateRequest( + certificate=certificate, + ) + + # Make the request + response = await client.update_certificate(request=request) + + # Handle the response + print(response) + + Args: + request (Optional[Union[google.cloud.security.privateca_v1beta1.types.UpdateCertificateRequest, dict]]): + The request object. Request message for + [CertificateAuthorityService.UpdateCertificate][google.cloud.security.privateca.v1beta1.CertificateAuthorityService.UpdateCertificate]. + certificate (:class:`google.cloud.security.privateca_v1beta1.types.Certificate`): + Required. + [Certificate][google.cloud.security.privateca.v1beta1.Certificate] + with updated values. + + This corresponds to the ``certificate`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + update_mask (:class:`google.protobuf.field_mask_pb2.FieldMask`): + Required. A list of fields to be + updated in this request. + + 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. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.cloud.security.privateca_v1beta1.types.Certificate: + A [Certificate][google.cloud.security.privateca.v1beta1.Certificate] corresponds to a signed X.509 certificate issued by a + [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority]. + + """ + # Create or coerce a protobuf request object. + # Quick check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([certificate, update_mask]) + if request is not None and has_flattened_params: + raise ValueError("If the `request` argument is set, then none of " + "the individual field arguments should be set.") + + 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: + request.update_mask = update_mask + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method_async.wrap_method( + self._client._transport.update_certificate, + default_timeout=None, + client_info=DEFAULT_CLIENT_INFO, + ) + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata(( + ("certificate.name", request.certificate.name), + )), + ) + + # Send the request. + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Done; return the response. + return response + + async def activate_certificate_authority(self, + request: Optional[Union[service.ActivateCertificateAuthorityRequest, dict]] = None, + *, + name: Optional[str] = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, str]] = (), + ) -> operation_async.AsyncOperation: + r"""Activate a + [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority] + that is in state + [PENDING_ACTIVATION][google.cloud.security.privateca.v1beta1.CertificateAuthority.State.PENDING_ACTIVATION] + and is of type + [SUBORDINATE][google.cloud.security.privateca.v1beta1.CertificateAuthority.Type.SUBORDINATE]. + After the parent Certificate Authority signs a certificate + signing request from + [FetchCertificateAuthorityCsr][google.cloud.security.privateca.v1beta1.CertificateAuthorityService.FetchCertificateAuthorityCsr], + this method can complete the activation process. + + .. code-block:: python + + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html + from google.cloud.security import privateca_v1beta1 + + async def sample_activate_certificate_authority(): + # Create a client + client = privateca_v1beta1.CertificateAuthorityServiceAsyncClient() + + # Initialize request argument(s) + subordinate_config = privateca_v1beta1.SubordinateConfig() + subordinate_config.certificate_authority = "certificate_authority_value" + + request = privateca_v1beta1.ActivateCertificateAuthorityRequest( + name="name_value", + pem_ca_certificate="pem_ca_certificate_value", + subordinate_config=subordinate_config, + ) + + # Make the request + operation = client.activate_certificate_authority(request=request) + + print("Waiting for operation to complete...") + + response = (await operation).result() + + # Handle the response + print(response) + + Args: + request (Optional[Union[google.cloud.security.privateca_v1beta1.types.ActivateCertificateAuthorityRequest, dict]]): + The request object. Request message for + [CertificateAuthorityService.ActivateCertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthorityService.ActivateCertificateAuthority]. + name (:class:`str`): + Required. The resource name for this + [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority] + in the format + ``projects/*/locations/*/certificateAuthorities/*``. + + 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. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.api_core.operation_async.AsyncOperation: + An object representing a long-running operation. + + The result type for the operation will be :class:`google.cloud.security.privateca_v1beta1.types.CertificateAuthority` A [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority] represents an individual Certificate Authority. + A + [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority] + can be used to create + [Certificates][google.cloud.security.privateca.v1beta1.Certificate]. + + """ + # Create or coerce a protobuf request object. + # Quick check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([name]) + if request is not None and has_flattened_params: + raise ValueError("If the `request` argument is set, then none of " + "the individual field arguments should be set.") + + 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 + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method_async.wrap_method( + self._client._transport.activate_certificate_authority, + default_timeout=None, + client_info=DEFAULT_CLIENT_INFO, + ) + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata(( + ("name", request.name), + )), + ) + + # Send the request. + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Wrap the response in an operation future. + response = operation_async.from_gapic( + response, + self._client._transport.operations_client, + resources.CertificateAuthority, + metadata_type=service.OperationMetadata, + ) + + # Done; return the response. + return response + + async def create_certificate_authority(self, + request: Optional[Union[service.CreateCertificateAuthorityRequest, dict]] = None, + *, + parent: Optional[str] = None, + certificate_authority: Optional[resources.CertificateAuthority] = None, + certificate_authority_id: Optional[str] = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, str]] = (), + ) -> operation_async.AsyncOperation: + r"""Create a new + [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority] + in a given Project and Location. + + .. code-block:: python + + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html + from google.cloud.security import privateca_v1beta1 + + async def sample_create_certificate_authority(): + # Create a client + client = privateca_v1beta1.CertificateAuthorityServiceAsyncClient() + + # Initialize request argument(s) + certificate_authority = privateca_v1beta1.CertificateAuthority() + certificate_authority.type_ = "SUBORDINATE" + certificate_authority.tier = "DEVOPS" + certificate_authority.config.reusable_config.reusable_config = "reusable_config_value" + certificate_authority.key_spec.cloud_kms_key_version = "cloud_kms_key_version_value" + + request = privateca_v1beta1.CreateCertificateAuthorityRequest( + parent="parent_value", + certificate_authority_id="certificate_authority_id_value", + certificate_authority=certificate_authority, + ) + + # Make the request + operation = client.create_certificate_authority(request=request) + + print("Waiting for operation to complete...") + + response = (await operation).result() + + # Handle the response + print(response) + + Args: + request (Optional[Union[google.cloud.security.privateca_v1beta1.types.CreateCertificateAuthorityRequest, dict]]): + The request object. Request message for + [CertificateAuthorityService.CreateCertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthorityService.CreateCertificateAuthority]. + parent (:class:`str`): + Required. The resource name of the location associated + with the + [CertificateAuthorities][google.cloud.security.privateca.v1beta1.CertificateAuthority], + in the format ``projects/*/locations/*``. + + This corresponds to the ``parent`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + certificate_authority (:class:`google.cloud.security.privateca_v1beta1.types.CertificateAuthority`): + Required. A + [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority] + with initial field values. + + This corresponds to the ``certificate_authority`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + certificate_authority_id (:class:`str`): + Required. It must be unique within a location and match + the regular expression ``[a-zA-Z0-9_-]{1,63}`` + + 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. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.api_core.operation_async.AsyncOperation: + An object representing a long-running operation. + + The result type for the operation will be :class:`google.cloud.security.privateca_v1beta1.types.CertificateAuthority` A [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority] represents an individual Certificate Authority. + A + [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority] + can be used to create + [Certificates][google.cloud.security.privateca.v1beta1.Certificate]. + + """ + # Create or coerce a protobuf request object. + # Quick check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([parent, certificate_authority, certificate_authority_id]) + if request is not None and has_flattened_params: + raise ValueError("If the `request` argument is set, then none of " + "the individual field arguments should be set.") + + 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: + request.certificate_authority = certificate_authority + if certificate_authority_id is not None: + request.certificate_authority_id = certificate_authority_id + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method_async.wrap_method( + self._client._transport.create_certificate_authority, + default_timeout=None, + client_info=DEFAULT_CLIENT_INFO, + ) + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata(( + ("parent", request.parent), + )), + ) + + # Send the request. + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Wrap the response in an operation future. + response = operation_async.from_gapic( + response, + self._client._transport.operations_client, + resources.CertificateAuthority, + metadata_type=service.OperationMetadata, + ) + + # Done; return the response. + return response + + async def disable_certificate_authority(self, + request: Optional[Union[service.DisableCertificateAuthorityRequest, dict]] = None, + *, + name: Optional[str] = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, str]] = (), + ) -> operation_async.AsyncOperation: + r"""Disable a + [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority]. + + .. code-block:: python + + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html + from google.cloud.security import privateca_v1beta1 + + async def sample_disable_certificate_authority(): + # Create a client + client = privateca_v1beta1.CertificateAuthorityServiceAsyncClient() + + # Initialize request argument(s) + request = privateca_v1beta1.DisableCertificateAuthorityRequest( + name="name_value", + ) + + # Make the request + operation = client.disable_certificate_authority(request=request) + + print("Waiting for operation to complete...") + + response = (await operation).result() + + # Handle the response + print(response) + + Args: + request (Optional[Union[google.cloud.security.privateca_v1beta1.types.DisableCertificateAuthorityRequest, dict]]): + The request object. Request message for + [CertificateAuthorityService.DisableCertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthorityService.DisableCertificateAuthority]. + name (:class:`str`): + Required. The resource name for this + [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority] + in the format + ``projects/*/locations/*/certificateAuthorities/*``. + + 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. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.api_core.operation_async.AsyncOperation: + An object representing a long-running operation. + + The result type for the operation will be :class:`google.cloud.security.privateca_v1beta1.types.CertificateAuthority` A [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority] represents an individual Certificate Authority. + A + [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority] + can be used to create + [Certificates][google.cloud.security.privateca.v1beta1.Certificate]. + + """ + # Create or coerce a protobuf request object. + # Quick check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([name]) + if request is not None and has_flattened_params: + raise ValueError("If the `request` argument is set, then none of " + "the individual field arguments should be set.") + + 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 + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method_async.wrap_method( + self._client._transport.disable_certificate_authority, + default_timeout=None, + client_info=DEFAULT_CLIENT_INFO, + ) + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata(( + ("name", request.name), + )), + ) + + # Send the request. + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Wrap the response in an operation future. + response = operation_async.from_gapic( + response, + self._client._transport.operations_client, + resources.CertificateAuthority, + metadata_type=service.OperationMetadata, + ) + + # Done; return the response. + return response + + async def enable_certificate_authority(self, + request: Optional[Union[service.EnableCertificateAuthorityRequest, dict]] = None, + *, + name: Optional[str] = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, str]] = (), + ) -> operation_async.AsyncOperation: + r"""Enable a + [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority]. + + .. code-block:: python + + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html + from google.cloud.security import privateca_v1beta1 + + async def sample_enable_certificate_authority(): + # Create a client + client = privateca_v1beta1.CertificateAuthorityServiceAsyncClient() + + # Initialize request argument(s) + request = privateca_v1beta1.EnableCertificateAuthorityRequest( + name="name_value", + ) + + # Make the request + operation = client.enable_certificate_authority(request=request) + + print("Waiting for operation to complete...") + + response = (await operation).result() + + # Handle the response + print(response) + + Args: + request (Optional[Union[google.cloud.security.privateca_v1beta1.types.EnableCertificateAuthorityRequest, dict]]): + The request object. Request message for + [CertificateAuthorityService.EnableCertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthorityService.EnableCertificateAuthority]. + name (:class:`str`): + Required. The resource name for this + [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority] + in the format + ``projects/*/locations/*/certificateAuthorities/*``. + + 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. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.api_core.operation_async.AsyncOperation: + An object representing a long-running operation. + + The result type for the operation will be :class:`google.cloud.security.privateca_v1beta1.types.CertificateAuthority` A [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority] represents an individual Certificate Authority. + A + [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority] + can be used to create + [Certificates][google.cloud.security.privateca.v1beta1.Certificate]. + + """ + # Create or coerce a protobuf request object. + # Quick check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([name]) + if request is not None and has_flattened_params: + raise ValueError("If the `request` argument is set, then none of " + "the individual field arguments should be set.") + + 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 + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method_async.wrap_method( + self._client._transport.enable_certificate_authority, + default_timeout=None, + client_info=DEFAULT_CLIENT_INFO, + ) + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata(( + ("name", request.name), + )), + ) + + # Send the request. + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Wrap the response in an operation future. + response = operation_async.from_gapic( + response, + self._client._transport.operations_client, + resources.CertificateAuthority, + metadata_type=service.OperationMetadata, + ) + + # Done; return the response. + return response + + async def fetch_certificate_authority_csr(self, + request: Optional[Union[service.FetchCertificateAuthorityCsrRequest, dict]] = None, + *, + name: Optional[str] = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, str]] = (), + ) -> service.FetchCertificateAuthorityCsrResponse: + r"""Fetch a certificate signing request (CSR) from a + [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority] + that is in state + [PENDING_ACTIVATION][google.cloud.security.privateca.v1beta1.CertificateAuthority.State.PENDING_ACTIVATION] + and is of type + [SUBORDINATE][google.cloud.security.privateca.v1beta1.CertificateAuthority.Type.SUBORDINATE]. + The CSR must then be signed by the desired parent Certificate + Authority, which could be another + [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority] + resource, or could be an on-prem certificate authority. See also + [ActivateCertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthorityService.ActivateCertificateAuthority]. + + .. code-block:: python + + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html + from google.cloud.security import privateca_v1beta1 + + async def sample_fetch_certificate_authority_csr(): + # Create a client + client = privateca_v1beta1.CertificateAuthorityServiceAsyncClient() + + # Initialize request argument(s) + request = privateca_v1beta1.FetchCertificateAuthorityCsrRequest( + name="name_value", + ) + + # Make the request + response = await client.fetch_certificate_authority_csr(request=request) + + # Handle the response + print(response) + + Args: + request (Optional[Union[google.cloud.security.privateca_v1beta1.types.FetchCertificateAuthorityCsrRequest, dict]]): + The request object. Request message for + [CertificateAuthorityService.FetchCertificateAuthorityCsr][google.cloud.security.privateca.v1beta1.CertificateAuthorityService.FetchCertificateAuthorityCsr]. + name (:class:`str`): + Required. The resource name for this + [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority] + in the format + ``projects/*/locations/*/certificateAuthorities/*``. + + 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. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.cloud.security.privateca_v1beta1.types.FetchCertificateAuthorityCsrResponse: + Response message for + [CertificateAuthorityService.FetchCertificateAuthorityCsr][google.cloud.security.privateca.v1beta1.CertificateAuthorityService.FetchCertificateAuthorityCsr]. + + """ + # Create or coerce a protobuf request object. + # Quick check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([name]) + if request is not None and has_flattened_params: + raise ValueError("If the `request` argument is set, then none of " + "the individual field arguments should be set.") + + 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 + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method_async.wrap_method( + self._client._transport.fetch_certificate_authority_csr, + default_timeout=None, + client_info=DEFAULT_CLIENT_INFO, + ) + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata(( + ("name", request.name), + )), + ) + + # Send the request. + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Done; return the response. + return response + + async def get_certificate_authority(self, + request: Optional[Union[service.GetCertificateAuthorityRequest, dict]] = None, + *, + name: Optional[str] = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, str]] = (), + ) -> resources.CertificateAuthority: + r"""Returns a + [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority]. + + .. code-block:: python + + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html + from google.cloud.security import privateca_v1beta1 + + async def sample_get_certificate_authority(): + # Create a client + client = privateca_v1beta1.CertificateAuthorityServiceAsyncClient() + + # Initialize request argument(s) + request = privateca_v1beta1.GetCertificateAuthorityRequest( + name="name_value", + ) + + # Make the request + response = await client.get_certificate_authority(request=request) + + # Handle the response + print(response) + + Args: + request (Optional[Union[google.cloud.security.privateca_v1beta1.types.GetCertificateAuthorityRequest, dict]]): + The request object. Request message for + [CertificateAuthorityService.GetCertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthorityService.GetCertificateAuthority]. + name (:class:`str`): + Required. The + [name][google.cloud.security.privateca.v1beta1.CertificateAuthority.name] + of the + [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority] + to get. + + 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. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.cloud.security.privateca_v1beta1.types.CertificateAuthority: + A [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority] represents an individual Certificate Authority. + A + [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority] + can be used to create + [Certificates][google.cloud.security.privateca.v1beta1.Certificate]. + + """ + # Create or coerce a protobuf request object. + # Quick check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([name]) + if request is not None and has_flattened_params: + raise ValueError("If the `request` argument is set, then none of " + "the individual field arguments should be set.") + + 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 + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method_async.wrap_method( + self._client._transport.get_certificate_authority, + default_timeout=None, + client_info=DEFAULT_CLIENT_INFO, + ) + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata(( + ("name", request.name), + )), + ) + + # Send the request. + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Done; return the response. + return response + + async def list_certificate_authorities(self, + request: Optional[Union[service.ListCertificateAuthoritiesRequest, dict]] = None, + *, + parent: Optional[str] = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, str]] = (), + ) -> pagers.ListCertificateAuthoritiesAsyncPager: + r"""Lists + [CertificateAuthorities][google.cloud.security.privateca.v1beta1.CertificateAuthority]. + + .. code-block:: python + + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html + from google.cloud.security import privateca_v1beta1 + + async def sample_list_certificate_authorities(): + # Create a client + client = privateca_v1beta1.CertificateAuthorityServiceAsyncClient() + + # Initialize request argument(s) + request = privateca_v1beta1.ListCertificateAuthoritiesRequest( + parent="parent_value", + ) + + # Make the request + page_result = client.list_certificate_authorities(request=request) + + # Handle the response + async for response in page_result: + print(response) + + Args: + request (Optional[Union[google.cloud.security.privateca_v1beta1.types.ListCertificateAuthoritiesRequest, dict]]): + The request object. Request message for + [CertificateAuthorityService.ListCertificateAuthorities][google.cloud.security.privateca.v1beta1.CertificateAuthorityService.ListCertificateAuthorities]. + parent (:class:`str`): + Required. The resource name of the location associated + with the + [CertificateAuthorities][google.cloud.security.privateca.v1beta1.CertificateAuthority], + in the format ``projects/*/locations/*``. + + 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. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.cloud.security.privateca_v1beta1.services.certificate_authority_service.pagers.ListCertificateAuthoritiesAsyncPager: + Response message for + [CertificateAuthorityService.ListCertificateAuthorities][google.cloud.security.privateca.v1beta1.CertificateAuthorityService.ListCertificateAuthorities]. + + Iterating over this object will yield results and + resolve additional pages automatically. + + """ + # Create or coerce a protobuf request object. + # Quick check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([parent]) + if request is not None and has_flattened_params: + raise ValueError("If the `request` argument is set, then none of " + "the individual field arguments should be set.") + + 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 + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method_async.wrap_method( + self._client._transport.list_certificate_authorities, + default_timeout=None, + client_info=DEFAULT_CLIENT_INFO, + ) + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata(( + ("parent", request.parent), + )), + ) + + # Send the request. + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # This method is paged; wrap the response in a pager, which provides + # an `__aiter__` convenience method. + response = pagers.ListCertificateAuthoritiesAsyncPager( + method=rpc, + request=request, + response=response, + metadata=metadata, + ) + + # Done; return the response. + return response + + async def restore_certificate_authority(self, + request: Optional[Union[service.RestoreCertificateAuthorityRequest, dict]] = None, + *, + name: Optional[str] = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, str]] = (), + ) -> operation_async.AsyncOperation: + r"""Restore a + [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority] + that is scheduled for deletion. + + .. code-block:: python + + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html + from google.cloud.security import privateca_v1beta1 + + async def sample_restore_certificate_authority(): + # Create a client + client = privateca_v1beta1.CertificateAuthorityServiceAsyncClient() + + # Initialize request argument(s) + request = privateca_v1beta1.RestoreCertificateAuthorityRequest( + name="name_value", + ) + + # Make the request + operation = client.restore_certificate_authority(request=request) + + print("Waiting for operation to complete...") + + response = (await operation).result() + + # Handle the response + print(response) + + Args: + request (Optional[Union[google.cloud.security.privateca_v1beta1.types.RestoreCertificateAuthorityRequest, dict]]): + The request object. Request message for + [CertificateAuthorityService.RestoreCertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthorityService.RestoreCertificateAuthority]. + name (:class:`str`): + Required. The resource name for this + [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority] + in the format + ``projects/*/locations/*/certificateAuthorities/*``. + + 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. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.api_core.operation_async.AsyncOperation: + An object representing a long-running operation. + + The result type for the operation will be :class:`google.cloud.security.privateca_v1beta1.types.CertificateAuthority` A [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority] represents an individual Certificate Authority. + A + [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority] + can be used to create + [Certificates][google.cloud.security.privateca.v1beta1.Certificate]. + + """ + # Create or coerce a protobuf request object. + # Quick check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([name]) + if request is not None and has_flattened_params: + raise ValueError("If the `request` argument is set, then none of " + "the individual field arguments should be set.") + + 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 + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method_async.wrap_method( + self._client._transport.restore_certificate_authority, + default_timeout=None, + client_info=DEFAULT_CLIENT_INFO, + ) + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata(( + ("name", request.name), + )), + ) + + # Send the request. + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Wrap the response in an operation future. + response = operation_async.from_gapic( + response, + self._client._transport.operations_client, + resources.CertificateAuthority, + metadata_type=service.OperationMetadata, + ) + + # Done; return the response. + return response + + async def schedule_delete_certificate_authority(self, + request: Optional[Union[service.ScheduleDeleteCertificateAuthorityRequest, dict]] = None, + *, + name: Optional[str] = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, str]] = (), + ) -> operation_async.AsyncOperation: + r"""Schedule a + [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority] + for deletion. + + .. code-block:: python + + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html + from google.cloud.security import privateca_v1beta1 + + async def sample_schedule_delete_certificate_authority(): + # Create a client + client = privateca_v1beta1.CertificateAuthorityServiceAsyncClient() + + # Initialize request argument(s) + request = privateca_v1beta1.ScheduleDeleteCertificateAuthorityRequest( + name="name_value", + ) + + # Make the request + operation = client.schedule_delete_certificate_authority(request=request) + + print("Waiting for operation to complete...") + + response = (await operation).result() + + # Handle the response + print(response) + + Args: + request (Optional[Union[google.cloud.security.privateca_v1beta1.types.ScheduleDeleteCertificateAuthorityRequest, dict]]): + The request object. Request message for + [CertificateAuthorityService.ScheduleDeleteCertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthorityService.ScheduleDeleteCertificateAuthority]. + name (:class:`str`): + Required. The resource name for this + [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority] + in the format + ``projects/*/locations/*/certificateAuthorities/*``. + + 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. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.api_core.operation_async.AsyncOperation: + An object representing a long-running operation. + + The result type for the operation will be :class:`google.cloud.security.privateca_v1beta1.types.CertificateAuthority` A [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority] represents an individual Certificate Authority. + A + [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority] + can be used to create + [Certificates][google.cloud.security.privateca.v1beta1.Certificate]. + + """ + # Create or coerce a protobuf request object. + # Quick check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([name]) + if request is not None and has_flattened_params: + raise ValueError("If the `request` argument is set, then none of " + "the individual field arguments should be set.") + + 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 + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method_async.wrap_method( + self._client._transport.schedule_delete_certificate_authority, + default_timeout=None, + client_info=DEFAULT_CLIENT_INFO, + ) + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata(( + ("name", request.name), + )), + ) + + # Send the request. + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Wrap the response in an operation future. + response = operation_async.from_gapic( + response, + self._client._transport.operations_client, + resources.CertificateAuthority, + metadata_type=service.OperationMetadata, + ) + + # Done; return the response. + return response + + async def update_certificate_authority(self, + request: Optional[Union[service.UpdateCertificateAuthorityRequest, dict]] = None, + *, + certificate_authority: Optional[resources.CertificateAuthority] = None, + update_mask: Optional[field_mask_pb2.FieldMask] = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, str]] = (), + ) -> operation_async.AsyncOperation: + r"""Update a + [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority]. + + .. code-block:: python + + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html + from google.cloud.security import privateca_v1beta1 + + async def sample_update_certificate_authority(): + # Create a client + client = privateca_v1beta1.CertificateAuthorityServiceAsyncClient() + + # Initialize request argument(s) + certificate_authority = privateca_v1beta1.CertificateAuthority() + certificate_authority.type_ = "SUBORDINATE" + certificate_authority.tier = "DEVOPS" + certificate_authority.config.reusable_config.reusable_config = "reusable_config_value" + certificate_authority.key_spec.cloud_kms_key_version = "cloud_kms_key_version_value" + + request = privateca_v1beta1.UpdateCertificateAuthorityRequest( + certificate_authority=certificate_authority, + ) + + # Make the request + operation = client.update_certificate_authority(request=request) + + print("Waiting for operation to complete...") + + response = (await operation).result() + + # Handle the response + print(response) + + Args: + request (Optional[Union[google.cloud.security.privateca_v1beta1.types.UpdateCertificateAuthorityRequest, dict]]): + The request object. Request message for + [CertificateAuthorityService.UpdateCertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthorityService.UpdateCertificateAuthority]. + certificate_authority (:class:`google.cloud.security.privateca_v1beta1.types.CertificateAuthority`): + Required. + [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority] + with updated values. + + This corresponds to the ``certificate_authority`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + update_mask (:class:`google.protobuf.field_mask_pb2.FieldMask`): + Required. A list of fields to be + updated in this request. + + 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. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.api_core.operation_async.AsyncOperation: + An object representing a long-running operation. + + The result type for the operation will be :class:`google.cloud.security.privateca_v1beta1.types.CertificateAuthority` A [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority] represents an individual Certificate Authority. + A + [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority] + can be used to create + [Certificates][google.cloud.security.privateca.v1beta1.Certificate]. + + """ + # Create or coerce a protobuf request object. + # Quick check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([certificate_authority, update_mask]) + if request is not None and has_flattened_params: + raise ValueError("If the `request` argument is set, then none of " + "the individual field arguments should be set.") + + 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: + request.update_mask = update_mask + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method_async.wrap_method( + self._client._transport.update_certificate_authority, + default_timeout=None, + client_info=DEFAULT_CLIENT_INFO, + ) + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata(( + ("certificate_authority.name", request.certificate_authority.name), + )), + ) + + # Send the request. + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Wrap the response in an operation future. + response = operation_async.from_gapic( + response, + self._client._transport.operations_client, + resources.CertificateAuthority, + metadata_type=service.OperationMetadata, + ) + + # Done; return the response. + return response + + async def get_certificate_revocation_list(self, + request: Optional[Union[service.GetCertificateRevocationListRequest, dict]] = None, + *, + name: Optional[str] = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, str]] = (), + ) -> resources.CertificateRevocationList: + r"""Returns a + [CertificateRevocationList][google.cloud.security.privateca.v1beta1.CertificateRevocationList]. + + .. code-block:: python + + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html + from google.cloud.security import privateca_v1beta1 + + async def sample_get_certificate_revocation_list(): + # Create a client + client = privateca_v1beta1.CertificateAuthorityServiceAsyncClient() + + # Initialize request argument(s) + request = privateca_v1beta1.GetCertificateRevocationListRequest( + name="name_value", + ) + + # Make the request + response = await client.get_certificate_revocation_list(request=request) + + # Handle the response + print(response) + + Args: + request (Optional[Union[google.cloud.security.privateca_v1beta1.types.GetCertificateRevocationListRequest, dict]]): + The request object. Request message for + [CertificateAuthorityService.GetCertificateRevocationList][google.cloud.security.privateca.v1beta1.CertificateAuthorityService.GetCertificateRevocationList]. + name (:class:`str`): + Required. The + [name][google.cloud.security.privateca.v1beta1.CertificateRevocationList.name] + of the + [CertificateRevocationList][google.cloud.security.privateca.v1beta1.CertificateRevocationList] + to get. + + 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. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.cloud.security.privateca_v1beta1.types.CertificateRevocationList: + A [CertificateRevocationList][google.cloud.security.privateca.v1beta1.CertificateRevocationList] corresponds to a signed X.509 certificate + Revocation List (CRL). A CRL contains the serial + numbers of certificates that should no longer be + trusted. + + """ + # Create or coerce a protobuf request object. + # Quick check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([name]) + if request is not None and has_flattened_params: + raise ValueError("If the `request` argument is set, then none of " + "the individual field arguments should be set.") + + 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 + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method_async.wrap_method( + self._client._transport.get_certificate_revocation_list, + default_timeout=None, + client_info=DEFAULT_CLIENT_INFO, + ) + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata(( + ("name", request.name), + )), + ) + + # Send the request. + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Done; return the response. + return response + + async def list_certificate_revocation_lists(self, + request: Optional[Union[service.ListCertificateRevocationListsRequest, dict]] = None, + *, + parent: Optional[str] = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, str]] = (), + ) -> pagers.ListCertificateRevocationListsAsyncPager: + r"""Lists + [CertificateRevocationLists][google.cloud.security.privateca.v1beta1.CertificateRevocationList]. + + .. code-block:: python + + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html + from google.cloud.security import privateca_v1beta1 + + async def sample_list_certificate_revocation_lists(): + # Create a client + client = privateca_v1beta1.CertificateAuthorityServiceAsyncClient() + + # Initialize request argument(s) + request = privateca_v1beta1.ListCertificateRevocationListsRequest( + parent="parent_value", + ) + + # Make the request + page_result = client.list_certificate_revocation_lists(request=request) + + # Handle the response + async for response in page_result: + print(response) + + Args: + request (Optional[Union[google.cloud.security.privateca_v1beta1.types.ListCertificateRevocationListsRequest, dict]]): + The request object. Request message for + [CertificateAuthorityService.ListCertificateRevocationLists][google.cloud.security.privateca.v1beta1.CertificateAuthorityService.ListCertificateRevocationLists]. + parent (:class:`str`): + Required. The resource name of the location associated + with the + [CertificateRevocationLists][google.cloud.security.privateca.v1beta1.CertificateRevocationList], + in the format + ``projects/*/locations/*/certificateauthorities/*``. + + 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. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.cloud.security.privateca_v1beta1.services.certificate_authority_service.pagers.ListCertificateRevocationListsAsyncPager: + Response message for + [CertificateAuthorityService.ListCertificateRevocationLists][google.cloud.security.privateca.v1beta1.CertificateAuthorityService.ListCertificateRevocationLists]. + + Iterating over this object will yield results and + resolve additional pages automatically. + + """ + # Create or coerce a protobuf request object. + # Quick check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([parent]) + if request is not None and has_flattened_params: + raise ValueError("If the `request` argument is set, then none of " + "the individual field arguments should be set.") + + 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 + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method_async.wrap_method( + self._client._transport.list_certificate_revocation_lists, + default_timeout=None, + client_info=DEFAULT_CLIENT_INFO, + ) + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata(( + ("parent", request.parent), + )), + ) + + # Send the request. + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # This method is paged; wrap the response in a pager, which provides + # an `__aiter__` convenience method. + response = pagers.ListCertificateRevocationListsAsyncPager( + method=rpc, + request=request, + response=response, + metadata=metadata, + ) + + # Done; return the response. + return response + + async def update_certificate_revocation_list(self, + request: Optional[Union[service.UpdateCertificateRevocationListRequest, dict]] = None, + *, + certificate_revocation_list: Optional[resources.CertificateRevocationList] = None, + update_mask: Optional[field_mask_pb2.FieldMask] = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, str]] = (), + ) -> operation_async.AsyncOperation: + r"""Update a + [CertificateRevocationList][google.cloud.security.privateca.v1beta1.CertificateRevocationList]. + + .. code-block:: python + + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html + from google.cloud.security import privateca_v1beta1 + + async def sample_update_certificate_revocation_list(): + # Create a client + client = privateca_v1beta1.CertificateAuthorityServiceAsyncClient() + + # Initialize request argument(s) + request = privateca_v1beta1.UpdateCertificateRevocationListRequest( + ) + + # Make the request + operation = client.update_certificate_revocation_list(request=request) + + print("Waiting for operation to complete...") + + response = (await operation).result() + + # Handle the response + print(response) + + Args: + request (Optional[Union[google.cloud.security.privateca_v1beta1.types.UpdateCertificateRevocationListRequest, dict]]): + The request object. Request message for + [CertificateAuthorityService.UpdateCertificateRevocationList][google.cloud.security.privateca.v1beta1.CertificateAuthorityService.UpdateCertificateRevocationList]. + certificate_revocation_list (:class:`google.cloud.security.privateca_v1beta1.types.CertificateRevocationList`): + Required. + [CertificateRevocationList][google.cloud.security.privateca.v1beta1.CertificateRevocationList] + with updated values. + + This corresponds to the ``certificate_revocation_list`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + update_mask (:class:`google.protobuf.field_mask_pb2.FieldMask`): + Required. A list of fields to be + updated in this request. + + 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. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.api_core.operation_async.AsyncOperation: + An object representing a long-running operation. + + The result type for the operation will be :class:`google.cloud.security.privateca_v1beta1.types.CertificateRevocationList` A [CertificateRevocationList][google.cloud.security.privateca.v1beta1.CertificateRevocationList] corresponds to a signed X.509 certificate + Revocation List (CRL). A CRL contains the serial + numbers of certificates that should no longer be + trusted. + + """ + # Create or coerce a protobuf request object. + # Quick check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([certificate_revocation_list, update_mask]) + if request is not None and has_flattened_params: + raise ValueError("If the `request` argument is set, then none of " + "the individual field arguments should be set.") + + 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: + request.update_mask = update_mask + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method_async.wrap_method( + self._client._transport.update_certificate_revocation_list, + default_timeout=None, + client_info=DEFAULT_CLIENT_INFO, + ) + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata(( + ("certificate_revocation_list.name", request.certificate_revocation_list.name), + )), + ) + + # Send the request. + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Wrap the response in an operation future. + response = operation_async.from_gapic( + response, + self._client._transport.operations_client, + resources.CertificateRevocationList, + metadata_type=service.OperationMetadata, + ) + + # Done; return the response. + return response + + async def get_reusable_config(self, + request: Optional[Union[service.GetReusableConfigRequest, dict]] = None, + *, + name: Optional[str] = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, str]] = (), + ) -> resources.ReusableConfig: + r"""Returns a + [ReusableConfig][google.cloud.security.privateca.v1beta1.ReusableConfig]. + + .. code-block:: python + + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html + from google.cloud.security import privateca_v1beta1 + + async def sample_get_reusable_config(): + # Create a client + client = privateca_v1beta1.CertificateAuthorityServiceAsyncClient() + + # Initialize request argument(s) + request = privateca_v1beta1.GetReusableConfigRequest( + name="name_value", + ) + + # Make the request + response = await client.get_reusable_config(request=request) + + # Handle the response + print(response) + + Args: + request (Optional[Union[google.cloud.security.privateca_v1beta1.types.GetReusableConfigRequest, dict]]): + The request object. Request message for + [CertificateAuthorityService.GetReusableConfig][google.cloud.security.privateca.v1beta1.CertificateAuthorityService.GetReusableConfig]. + name (:class:`str`): + Required. The [name][ReusableConfigs.name] of the + [ReusableConfigs][] to get. + + 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. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.cloud.security.privateca_v1beta1.types.ReusableConfig: + A [ReusableConfig][google.cloud.security.privateca.v1beta1.ReusableConfig] refers to a managed [ReusableConfigValues][google.cloud.security.privateca.v1beta1.ReusableConfigValues]. Those, in + turn, are used to describe certain fields of an X.509 + certificate, such as the key usage fields, fields + specific to CA certificates, certificate policy + extensions and custom extensions. + + """ + # Create or coerce a protobuf request object. + # Quick check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([name]) + if request is not None and has_flattened_params: + raise ValueError("If the `request` argument is set, then none of " + "the individual field arguments should be set.") + + 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 + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method_async.wrap_method( + self._client._transport.get_reusable_config, + default_timeout=None, + client_info=DEFAULT_CLIENT_INFO, + ) + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata(( + ("name", request.name), + )), + ) + + # Send the request. + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Done; return the response. + return response + + async def list_reusable_configs(self, + request: Optional[Union[service.ListReusableConfigsRequest, dict]] = None, + *, + parent: Optional[str] = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, str]] = (), + ) -> pagers.ListReusableConfigsAsyncPager: + r"""Lists + [ReusableConfigs][google.cloud.security.privateca.v1beta1.ReusableConfig]. + + .. code-block:: python + + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html + from google.cloud.security import privateca_v1beta1 + + async def sample_list_reusable_configs(): + # Create a client + client = privateca_v1beta1.CertificateAuthorityServiceAsyncClient() + + # Initialize request argument(s) + request = privateca_v1beta1.ListReusableConfigsRequest( + parent="parent_value", + ) + + # Make the request + page_result = client.list_reusable_configs(request=request) + + # Handle the response + async for response in page_result: + print(response) + + Args: + request (Optional[Union[google.cloud.security.privateca_v1beta1.types.ListReusableConfigsRequest, dict]]): + The request object. Request message for + [CertificateAuthorityService.ListReusableConfigs][google.cloud.security.privateca.v1beta1.CertificateAuthorityService.ListReusableConfigs]. + parent (:class:`str`): + Required. The resource name of the location associated + with the + [ReusableConfigs][google.cloud.security.privateca.v1beta1.ReusableConfig], + in the format ``projects/*/locations/*``. + + 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. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.cloud.security.privateca_v1beta1.services.certificate_authority_service.pagers.ListReusableConfigsAsyncPager: + Response message for + [CertificateAuthorityService.ListReusableConfigs][google.cloud.security.privateca.v1beta1.CertificateAuthorityService.ListReusableConfigs]. + + Iterating over this object will yield results and + resolve additional pages automatically. + + """ + # Create or coerce a protobuf request object. + # Quick check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([parent]) + if request is not None and has_flattened_params: + raise ValueError("If the `request` argument is set, then none of " + "the individual field arguments should be set.") + + 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 + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method_async.wrap_method( + self._client._transport.list_reusable_configs, + default_timeout=None, + client_info=DEFAULT_CLIENT_INFO, + ) + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata(( + ("parent", request.parent), + )), + ) + + # Send the request. + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # This method is paged; wrap the response in a pager, which provides + # an `__aiter__` convenience method. + response = pagers.ListReusableConfigsAsyncPager( + method=rpc, + request=request, + response=response, + metadata=metadata, + ) + + # Done; return the response. + return response + + async def __aenter__(self): + return self + + async def __aexit__(self, exc_type, exc, tb): + await self.transport.close() + +DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo(gapic_version=package_version.__version__) + + +__all__ = ( + "CertificateAuthorityServiceAsyncClient", +) diff --git a/owl-bot-staging/v1beta1/google/cloud/security/privateca_v1beta1/services/certificate_authority_service/client.py b/owl-bot-staging/v1beta1/google/cloud/security/privateca_v1beta1/services/certificate_authority_service/client.py new file mode 100644 index 0000000..71a1f2b --- /dev/null +++ b/owl-bot-staging/v1beta1/google/cloud/security/privateca_v1beta1/services/certificate_authority_service/client.py @@ -0,0 +1,2847 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +from collections import OrderedDict +import os +import re +from typing import Dict, Mapping, MutableMapping, MutableSequence, Optional, Sequence, Tuple, Type, Union, cast + +from google.cloud.security.privateca_v1beta1 import gapic_version as package_version + +from google.api_core import client_options as client_options_lib +from google.api_core import exceptions as core_exceptions +from google.api_core import gapic_v1 +from google.api_core import retry as retries +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 +from google.oauth2 import service_account # type: ignore + +try: + OptionalRetry = Union[retries.Retry, gapic_v1.method._MethodDefault] +except AttributeError: # pragma: NO COVER + OptionalRetry = Union[retries.Retry, object] # type: ignore + +from google.api_core import operation # type: ignore +from google.api_core import operation_async # type: ignore +from google.cloud.security.privateca_v1beta1.services.certificate_authority_service import pagers +from google.cloud.security.privateca_v1beta1.types import resources +from google.cloud.security.privateca_v1beta1.types import service +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 + + +class CertificateAuthorityServiceClientMeta(type): + """Metaclass for the CertificateAuthorityService client. + + This provides class-level methods for building and retrieving + support objects (e.g. transport) without polluting the client instance + objects. + """ + _transport_registry = OrderedDict() # type: Dict[str, Type[CertificateAuthorityServiceTransport]] + _transport_registry["grpc"] = CertificateAuthorityServiceGrpcTransport + _transport_registry["grpc_asyncio"] = CertificateAuthorityServiceGrpcAsyncIOTransport + + def get_transport_class(cls, + label: Optional[str] = None, + ) -> Type[CertificateAuthorityServiceTransport]: + """Returns an appropriate transport class. + + Args: + label: The name of the desired transport. If none is + provided, then the first transport in the registry is used. + + Returns: + The transport class to use. + """ + # If a specific transport is requested, return that one. + if label: + return cls._transport_registry[label] + + # No transport is requested; return the default (that is, the first one + # in the dictionary). + return next(iter(cls._transport_registry.values())) + + +class CertificateAuthorityServiceClient(metaclass=CertificateAuthorityServiceClientMeta): + """[Certificate Authority + Service][google.cloud.security.privateca.v1beta1.CertificateAuthorityService] + manages private certificate authorities and issued certificates. + """ + + @staticmethod + def _get_default_mtls_endpoint(api_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: + api_endpoint (Optional[str]): the api endpoint to convert. + Returns: + str: converted mTLS api endpoint. + """ + if not api_endpoint: + return api_endpoint + + mtls_endpoint_re = re.compile( + r"(?P[^.]+)(?P\.mtls)?(?P\.sandbox)?(?P\.googleapis\.com)?" + ) + + m = mtls_endpoint_re.match(api_endpoint) + name, mtls, sandbox, googledomain = m.groups() + if mtls or not googledomain: + return api_endpoint + + if sandbox: + return api_endpoint.replace( + "sandbox.googleapis.com", "mtls.sandbox.googleapis.com" + ) + + return api_endpoint.replace(".googleapis.com", ".mtls.googleapis.com") + + DEFAULT_ENDPOINT = "privateca.googleapis.com" + DEFAULT_MTLS_ENDPOINT = _get_default_mtls_endpoint.__func__( # type: ignore + DEFAULT_ENDPOINT + ) + + @classmethod + def from_service_account_info(cls, info: dict, *args, **kwargs): + """Creates an instance of this client using the provided credentials + info. + + Args: + info (dict): The service account private key info. + args: Additional arguments to pass to the constructor. + kwargs: Additional arguments to pass to the constructor. + + Returns: + CertificateAuthorityServiceClient: The constructed client. + """ + credentials = service_account.Credentials.from_service_account_info(info) + kwargs["credentials"] = credentials + return cls(*args, **kwargs) + + @classmethod + def from_service_account_file(cls, filename: str, *args, **kwargs): + """Creates an instance of this client using the provided credentials + file. + + Args: + filename (str): The path to the service account private key json + file. + args: Additional arguments to pass to the constructor. + kwargs: Additional arguments to pass to the constructor. + + Returns: + CertificateAuthorityServiceClient: The constructed client. + """ + credentials = service_account.Credentials.from_service_account_file( + filename) + kwargs["credentials"] = credentials + return cls(*args, **kwargs) + + from_service_account_json = from_service_account_file + + @property + def transport(self) -> CertificateAuthorityServiceTransport: + """Returns the transport used by the client instance. + + Returns: + CertificateAuthorityServiceTransport: The transport used by the client + instance. + """ + return self._transport + + @staticmethod + def certificate_path(project: str,location: str,certificate_authority: str,certificate: str,) -> str: + """Returns a fully-qualified certificate string.""" + return "projects/{project}/locations/{location}/certificateAuthorities/{certificate_authority}/certificates/{certificate}".format(project=project, location=location, certificate_authority=certificate_authority, certificate=certificate, ) + + @staticmethod + def parse_certificate_path(path: str) -> Dict[str,str]: + """Parses a certificate path into its component segments.""" + m = re.match(r"^projects/(?P.+?)/locations/(?P.+?)/certificateAuthorities/(?P.+?)/certificates/(?P.+?)$", path) + return m.groupdict() if m else {} + + @staticmethod + def certificate_authority_path(project: str,location: str,certificate_authority: str,) -> str: + """Returns a fully-qualified certificate_authority string.""" + return "projects/{project}/locations/{location}/certificateAuthorities/{certificate_authority}".format(project=project, location=location, certificate_authority=certificate_authority, ) + + @staticmethod + def parse_certificate_authority_path(path: str) -> Dict[str,str]: + """Parses a certificate_authority path into its component segments.""" + m = re.match(r"^projects/(?P.+?)/locations/(?P.+?)/certificateAuthorities/(?P.+?)$", path) + return m.groupdict() if m else {} + + @staticmethod + def certificate_revocation_list_path(project: str,location: str,certificate_authority: str,certificate_revocation_list: str,) -> str: + """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, certificate_authority=certificate_authority, certificate_revocation_list=certificate_revocation_list, ) + + @staticmethod + def parse_certificate_revocation_list_path(path: str) -> Dict[str,str]: + """Parses a certificate_revocation_list path into its component segments.""" + m = re.match(r"^projects/(?P.+?)/locations/(?P.+?)/certificateAuthorities/(?P.+?)/certificateRevocationLists/(?P.+?)$", path) + return m.groupdict() if m else {} + + @staticmethod + def reusable_config_path(project: str,location: str,reusable_config: str,) -> str: + """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]: + """Parses a reusable_config path into its component segments.""" + m = re.match(r"^projects/(?P.+?)/locations/(?P.+?)/reusableConfigs/(?P.+?)$", path) + return m.groupdict() if m else {} + + @staticmethod + def common_billing_account_path(billing_account: str, ) -> str: + """Returns a fully-qualified billing_account string.""" + return "billingAccounts/{billing_account}".format(billing_account=billing_account, ) + + @staticmethod + def parse_common_billing_account_path(path: str) -> Dict[str,str]: + """Parse a billing_account path into its component segments.""" + m = re.match(r"^billingAccounts/(?P.+?)$", path) + return m.groupdict() if m else {} + + @staticmethod + def common_folder_path(folder: str, ) -> str: + """Returns a fully-qualified folder string.""" + return "folders/{folder}".format(folder=folder, ) + + @staticmethod + def parse_common_folder_path(path: str) -> Dict[str,str]: + """Parse a folder path into its component segments.""" + m = re.match(r"^folders/(?P.+?)$", path) + return m.groupdict() if m else {} + + @staticmethod + def common_organization_path(organization: str, ) -> str: + """Returns a fully-qualified organization string.""" + return "organizations/{organization}".format(organization=organization, ) + + @staticmethod + def parse_common_organization_path(path: str) -> Dict[str,str]: + """Parse a organization path into its component segments.""" + m = re.match(r"^organizations/(?P.+?)$", path) + return m.groupdict() if m else {} + + @staticmethod + def common_project_path(project: str, ) -> str: + """Returns a fully-qualified project string.""" + return "projects/{project}".format(project=project, ) + + @staticmethod + def parse_common_project_path(path: str) -> Dict[str,str]: + """Parse a project path into its component segments.""" + m = re.match(r"^projects/(?P.+?)$", path) + return m.groupdict() if m else {} + + @staticmethod + def common_location_path(project: str, location: str, ) -> str: + """Returns a fully-qualified location string.""" + return "projects/{project}/locations/{location}".format(project=project, location=location, ) + + @staticmethod + def parse_common_location_path(path: str) -> Dict[str,str]: + """Parse a location path into its component segments.""" + m = re.match(r"^projects/(?P.+?)/locations/(?P.+?)$", path) + return m.groupdict() if m else {} + + @classmethod + def get_mtls_endpoint_and_cert_source(cls, client_options: Optional[client_options_lib.ClientOptions] = None): + """Return the API endpoint and client cert source for mutual TLS. + + The client cert source is determined in the following order: + (1) if `GOOGLE_API_USE_CLIENT_CERTIFICATE` environment variable is not "true", the + client cert source is None. + (2) if `client_options.client_cert_source` is provided, use the provided one; if the + default client cert source exists, use the default one; otherwise the client cert + source is None. + + The API endpoint is determined in the following order: + (1) if `client_options.api_endpoint` if provided, use the provided one. + (2) if `GOOGLE_API_USE_CLIENT_CERTIFICATE` environment variable is "always", use the + default mTLS endpoint; if the environment variable is "never", use the default API + endpoint; otherwise if client cert source exists, use the default mTLS endpoint, otherwise + use the default API endpoint. + + More details can be found at https://google.aip.dev/auth/4114. + + Args: + client_options (google.api_core.client_options.ClientOptions): Custom options for the + client. Only the `api_endpoint` and `client_cert_source` properties may be used + in this method. + + Returns: + Tuple[str, Callable[[], Tuple[bytes, bytes]]]: returns the API endpoint and the + client cert source to use. + + Raises: + google.auth.exceptions.MutualTLSChannelError: If any errors happen. + """ + if client_options is None: + client_options = client_options_lib.ClientOptions() + use_client_cert = os.getenv("GOOGLE_API_USE_CLIENT_CERTIFICATE", "false") + use_mtls_endpoint = os.getenv("GOOGLE_API_USE_MTLS_ENDPOINT", "auto") + if use_client_cert not in ("true", "false"): + raise ValueError("Environment variable `GOOGLE_API_USE_CLIENT_CERTIFICATE` must be either `true` or `false`") + if use_mtls_endpoint not in ("auto", "never", "always"): + raise MutualTLSChannelError("Environment variable `GOOGLE_API_USE_MTLS_ENDPOINT` must be `never`, `auto` or `always`") + + # Figure out the client cert source to use. + client_cert_source = None + if use_client_cert == "true": + if client_options.client_cert_source: + client_cert_source = client_options.client_cert_source + elif mtls.has_default_client_cert_source(): + client_cert_source = mtls.default_client_cert_source() + + # Figure out which api endpoint to use. + if client_options.api_endpoint is not None: + api_endpoint = client_options.api_endpoint + elif use_mtls_endpoint == "always" or (use_mtls_endpoint == "auto" and client_cert_source): + api_endpoint = cls.DEFAULT_MTLS_ENDPOINT + else: + api_endpoint = cls.DEFAULT_ENDPOINT + + return api_endpoint, client_cert_source + + def __init__(self, *, + credentials: Optional[ga_credentials.Credentials] = None, + transport: Optional[Union[str, CertificateAuthorityServiceTransport]] = None, + client_options: Optional[Union[client_options_lib.ClientOptions, dict]] = None, + client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, + ) -> None: + """Instantiates the certificate authority service client. + + Args: + credentials (Optional[google.auth.credentials.Credentials]): The + authorization credentials to attach to requests. These + credentials identify the application to the service; if none + are specified, the client will attempt to ascertain the + credentials from the environment. + transport (Union[str, CertificateAuthorityServiceTransport]): The + transport to use. If set to None, a transport is chosen + automatically. + client_options (Optional[Union[google.api_core.client_options.ClientOptions, dict]]): Custom options for the + client. It won't take effect if a ``transport`` instance is provided. + (1) The ``api_endpoint`` property can be used to override the + default endpoint provided by the client. GOOGLE_API_USE_MTLS_ENDPOINT + environment variable can also be used to override the endpoint: + "always" (always use the default mTLS endpoint), "never" (always + use the default regular endpoint) and "auto" (auto switch to the + default mTLS endpoint if client certificate is present, this is + the default value). However, the ``api_endpoint`` property takes + precedence if provided. + (2) If GOOGLE_API_USE_CLIENT_CERTIFICATE environment variable + is "true", then the ``client_cert_source`` property can be used + to provide client certificate for mutual TLS transport. If + not provided, the default SSL client certificate will be used if + present. If GOOGLE_API_USE_CLIENT_CERTIFICATE is "false" or not + set, no client certificate will be used. + client_info (google.api_core.gapic_v1.client_info.ClientInfo): + The client info used to send a user-agent string along with + API requests. If ``None``, then default info will be used. + Generally, you only need to set this if you're developing + your own client library. + + Raises: + google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport + creation failed for any reason. + """ + if isinstance(client_options, dict): + client_options = client_options_lib.from_dict(client_options) + if client_options is None: + client_options = client_options_lib.ClientOptions() + client_options = cast(client_options_lib.ClientOptions, client_options) + + api_endpoint, client_cert_source_func = self.get_mtls_endpoint_and_cert_source(client_options) + + api_key_value = getattr(client_options, "api_key", None) + if api_key_value and credentials: + raise ValueError("client_options.api_key and credentials are mutually exclusive") + + # Save or instantiate the transport. + # Ordinarily, we provide the transport, but allowing a custom transport + # instance provides an extensibility point for unusual situations. + if isinstance(transport, CertificateAuthorityServiceTransport): + # transport is a CertificateAuthorityServiceTransport instance. + if credentials or client_options.credentials_file or api_key_value: + raise ValueError("When providing a transport instance, " + "provide its credentials directly.") + if client_options.scopes: + raise ValueError( + "When providing a transport instance, provide its scopes " + "directly." + ) + self._transport = transport + else: + import google.auth._default # type: ignore + + if api_key_value and hasattr(google.auth._default, "get_api_key_credentials"): + credentials = google.auth._default.get_api_key_credentials(api_key_value) + + Transport = type(self).get_transport_class(transport) + self._transport = Transport( + credentials=credentials, + credentials_file=client_options.credentials_file, + host=api_endpoint, + scopes=client_options.scopes, + client_cert_source_for_mtls=client_cert_source_func, + quota_project_id=client_options.quota_project_id, + client_info=client_info, + always_use_jwt_access=True, + api_audience=client_options.api_audience, + ) + + def create_certificate(self, + request: Optional[Union[service.CreateCertificateRequest, dict]] = None, + *, + parent: Optional[str] = None, + certificate: Optional[resources.Certificate] = None, + certificate_id: Optional[str] = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, str]] = (), + ) -> resources.Certificate: + r"""Create a new + [Certificate][google.cloud.security.privateca.v1beta1.Certificate] + in a given Project, Location from a particular + [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority]. + + .. code-block:: python + + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html + from google.cloud.security import privateca_v1beta1 + + def sample_create_certificate(): + # Create a client + client = privateca_v1beta1.CertificateAuthorityServiceClient() + + # Initialize request argument(s) + certificate = privateca_v1beta1.Certificate() + certificate.pem_csr = "pem_csr_value" + + request = privateca_v1beta1.CreateCertificateRequest( + parent="parent_value", + certificate=certificate, + ) + + # Make the request + response = client.create_certificate(request=request) + + # Handle the response + print(response) + + Args: + request (Union[google.cloud.security.privateca_v1beta1.types.CreateCertificateRequest, dict]): + The request object. Request message for + [CertificateAuthorityService.CreateCertificate][google.cloud.security.privateca.v1beta1.CertificateAuthorityService.CreateCertificate]. + parent (str): + Required. The resource name of the location and + [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority] + associated with the + [Certificate][google.cloud.security.privateca.v1beta1.Certificate], + in the format + ``projects/*/locations/*/certificateAuthorities/*``. + + This corresponds to the ``parent`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + certificate (google.cloud.security.privateca_v1beta1.types.Certificate): + Required. A + [Certificate][google.cloud.security.privateca.v1beta1.Certificate] + with initial field values. + + This corresponds to the ``certificate`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + certificate_id (str): + Optional. It must be unique within a location and match + the regular expression ``[a-zA-Z0-9_-]{1,63}``. This + field is required when using a + [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority] + in the Enterprise + [CertificateAuthority.Tier][google.cloud.security.privateca.v1beta1.CertificateAuthority.Tier], + but is optional and its value is ignored otherwise. + + 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. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.cloud.security.privateca_v1beta1.types.Certificate: + A [Certificate][google.cloud.security.privateca.v1beta1.Certificate] corresponds to a signed X.509 certificate issued by a + [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority]. + + """ + # Create or coerce a protobuf request object. + # Quick check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([parent, certificate, certificate_id]) + if request is not None and has_flattened_params: + raise ValueError('If the `request` argument is set, then none of ' + 'the individual field arguments should be set.') + + # Minor optimization to avoid making a copy if the user passes + # in a service.CreateCertificateRequest. + # There's no risk of modifying the input as we've already verified + # 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: + request.certificate = certificate + if certificate_id is not None: + request.certificate_id = certificate_id + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.create_certificate] + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata(( + ("parent", request.parent), + )), + ) + + # Send the request. + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Done; return the response. + return response + + def get_certificate(self, + request: Optional[Union[service.GetCertificateRequest, dict]] = None, + *, + name: Optional[str] = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, str]] = (), + ) -> resources.Certificate: + r"""Returns a + [Certificate][google.cloud.security.privateca.v1beta1.Certificate]. + + .. code-block:: python + + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html + from google.cloud.security import privateca_v1beta1 + + def sample_get_certificate(): + # Create a client + client = privateca_v1beta1.CertificateAuthorityServiceClient() + + # Initialize request argument(s) + request = privateca_v1beta1.GetCertificateRequest( + name="name_value", + ) + + # Make the request + response = client.get_certificate(request=request) + + # Handle the response + print(response) + + Args: + request (Union[google.cloud.security.privateca_v1beta1.types.GetCertificateRequest, dict]): + The request object. Request message for + [CertificateAuthorityService.GetCertificate][google.cloud.security.privateca.v1beta1.CertificateAuthorityService.GetCertificate]. + name (str): + Required. The + [name][google.cloud.security.privateca.v1beta1.Certificate.name] + of the + [Certificate][google.cloud.security.privateca.v1beta1.Certificate] + to get. + + 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. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.cloud.security.privateca_v1beta1.types.Certificate: + A [Certificate][google.cloud.security.privateca.v1beta1.Certificate] corresponds to a signed X.509 certificate issued by a + [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority]. + + """ + # Create or coerce a protobuf request object. + # Quick check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([name]) + if request is not None and has_flattened_params: + raise ValueError('If the `request` argument is set, then none of ' + 'the individual field arguments should be set.') + + # Minor optimization to avoid making a copy if the user passes + # in a service.GetCertificateRequest. + # There's no risk of modifying the input as we've already verified + # 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 + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.get_certificate] + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata(( + ("name", request.name), + )), + ) + + # Send the request. + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Done; return the response. + return response + + def list_certificates(self, + request: Optional[Union[service.ListCertificatesRequest, dict]] = None, + *, + parent: Optional[str] = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, str]] = (), + ) -> pagers.ListCertificatesPager: + r"""Lists + [Certificates][google.cloud.security.privateca.v1beta1.Certificate]. + + .. code-block:: python + + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html + from google.cloud.security import privateca_v1beta1 + + def sample_list_certificates(): + # Create a client + client = privateca_v1beta1.CertificateAuthorityServiceClient() + + # Initialize request argument(s) + request = privateca_v1beta1.ListCertificatesRequest( + parent="parent_value", + ) + + # Make the request + page_result = client.list_certificates(request=request) + + # Handle the response + for response in page_result: + print(response) + + Args: + request (Union[google.cloud.security.privateca_v1beta1.types.ListCertificatesRequest, dict]): + The request object. Request message for + [CertificateAuthorityService.ListCertificates][google.cloud.security.privateca.v1beta1.CertificateAuthorityService.ListCertificates]. + parent (str): + Required. The resource name of the location associated + with the + [Certificates][google.cloud.security.privateca.v1beta1.Certificate], + in the format + ``projects/*/locations/*/certificateauthorities/*``. + + 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. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.cloud.security.privateca_v1beta1.services.certificate_authority_service.pagers.ListCertificatesPager: + Response message for + [CertificateAuthorityService.ListCertificates][google.cloud.security.privateca.v1beta1.CertificateAuthorityService.ListCertificates]. + + Iterating over this object will yield results and + resolve additional pages automatically. + + """ + # Create or coerce a protobuf request object. + # Quick check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([parent]) + if request is not None and has_flattened_params: + raise ValueError('If the `request` argument is set, then none of ' + 'the individual field arguments should be set.') + + # Minor optimization to avoid making a copy if the user passes + # in a service.ListCertificatesRequest. + # There's no risk of modifying the input as we've already verified + # 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 + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.list_certificates] + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata(( + ("parent", request.parent), + )), + ) + + # Send the request. + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # This method is paged; wrap the response in a pager, which provides + # an `__iter__` convenience method. + response = pagers.ListCertificatesPager( + method=rpc, + request=request, + response=response, + metadata=metadata, + ) + + # Done; return the response. + return response + + def revoke_certificate(self, + request: Optional[Union[service.RevokeCertificateRequest, dict]] = None, + *, + name: Optional[str] = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, str]] = (), + ) -> resources.Certificate: + r"""Revoke a + [Certificate][google.cloud.security.privateca.v1beta1.Certificate]. + + .. code-block:: python + + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html + from google.cloud.security import privateca_v1beta1 + + def sample_revoke_certificate(): + # Create a client + client = privateca_v1beta1.CertificateAuthorityServiceClient() + + # Initialize request argument(s) + request = privateca_v1beta1.RevokeCertificateRequest( + name="name_value", + reason="ATTRIBUTE_AUTHORITY_COMPROMISE", + ) + + # Make the request + response = client.revoke_certificate(request=request) + + # Handle the response + print(response) + + Args: + request (Union[google.cloud.security.privateca_v1beta1.types.RevokeCertificateRequest, dict]): + The request object. Request message for + [CertificateAuthorityService.RevokeCertificate][google.cloud.security.privateca.v1beta1.CertificateAuthorityService.RevokeCertificate]. + name (str): + Required. The resource name for this + [Certificate][google.cloud.security.privateca.v1beta1.Certificate] + in the format + ``projects/*/locations/*/certificateAuthorities/*/certificates/*``. + + 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. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.cloud.security.privateca_v1beta1.types.Certificate: + A [Certificate][google.cloud.security.privateca.v1beta1.Certificate] corresponds to a signed X.509 certificate issued by a + [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority]. + + """ + # Create or coerce a protobuf request object. + # Quick check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([name]) + if request is not None and has_flattened_params: + raise ValueError('If the `request` argument is set, then none of ' + 'the individual field arguments should be set.') + + # Minor optimization to avoid making a copy if the user passes + # in a service.RevokeCertificateRequest. + # There's no risk of modifying the input as we've already verified + # 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 + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.revoke_certificate] + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata(( + ("name", request.name), + )), + ) + + # Send the request. + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Done; return the response. + return response + + def update_certificate(self, + request: Optional[Union[service.UpdateCertificateRequest, dict]] = None, + *, + certificate: Optional[resources.Certificate] = None, + update_mask: Optional[field_mask_pb2.FieldMask] = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, str]] = (), + ) -> resources.Certificate: + r"""Update a + [Certificate][google.cloud.security.privateca.v1beta1.Certificate]. + Currently, the only field you can update is the + [labels][google.cloud.security.privateca.v1beta1.Certificate.labels] + field. + + .. code-block:: python + + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html + from google.cloud.security import privateca_v1beta1 + + def sample_update_certificate(): + # Create a client + client = privateca_v1beta1.CertificateAuthorityServiceClient() + + # Initialize request argument(s) + certificate = privateca_v1beta1.Certificate() + certificate.pem_csr = "pem_csr_value" + + request = privateca_v1beta1.UpdateCertificateRequest( + certificate=certificate, + ) + + # Make the request + response = client.update_certificate(request=request) + + # Handle the response + print(response) + + Args: + request (Union[google.cloud.security.privateca_v1beta1.types.UpdateCertificateRequest, dict]): + The request object. Request message for + [CertificateAuthorityService.UpdateCertificate][google.cloud.security.privateca.v1beta1.CertificateAuthorityService.UpdateCertificate]. + certificate (google.cloud.security.privateca_v1beta1.types.Certificate): + Required. + [Certificate][google.cloud.security.privateca.v1beta1.Certificate] + with updated values. + + This corresponds to the ``certificate`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + update_mask (google.protobuf.field_mask_pb2.FieldMask): + Required. A list of fields to be + updated in this request. + + 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. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.cloud.security.privateca_v1beta1.types.Certificate: + A [Certificate][google.cloud.security.privateca.v1beta1.Certificate] corresponds to a signed X.509 certificate issued by a + [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority]. + + """ + # Create or coerce a protobuf request object. + # Quick check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([certificate, update_mask]) + if request is not None and has_flattened_params: + raise ValueError('If the `request` argument is set, then none of ' + 'the individual field arguments should be set.') + + # Minor optimization to avoid making a copy if the user passes + # in a service.UpdateCertificateRequest. + # There's no risk of modifying the input as we've already verified + # 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: + request.update_mask = update_mask + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.update_certificate] + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata(( + ("certificate.name", request.certificate.name), + )), + ) + + # Send the request. + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Done; return the response. + return response + + def activate_certificate_authority(self, + request: Optional[Union[service.ActivateCertificateAuthorityRequest, dict]] = None, + *, + name: Optional[str] = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, str]] = (), + ) -> operation.Operation: + r"""Activate a + [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority] + that is in state + [PENDING_ACTIVATION][google.cloud.security.privateca.v1beta1.CertificateAuthority.State.PENDING_ACTIVATION] + and is of type + [SUBORDINATE][google.cloud.security.privateca.v1beta1.CertificateAuthority.Type.SUBORDINATE]. + After the parent Certificate Authority signs a certificate + signing request from + [FetchCertificateAuthorityCsr][google.cloud.security.privateca.v1beta1.CertificateAuthorityService.FetchCertificateAuthorityCsr], + this method can complete the activation process. + + .. code-block:: python + + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html + from google.cloud.security import privateca_v1beta1 + + def sample_activate_certificate_authority(): + # Create a client + client = privateca_v1beta1.CertificateAuthorityServiceClient() + + # Initialize request argument(s) + subordinate_config = privateca_v1beta1.SubordinateConfig() + subordinate_config.certificate_authority = "certificate_authority_value" + + request = privateca_v1beta1.ActivateCertificateAuthorityRequest( + name="name_value", + pem_ca_certificate="pem_ca_certificate_value", + subordinate_config=subordinate_config, + ) + + # Make the request + operation = client.activate_certificate_authority(request=request) + + print("Waiting for operation to complete...") + + response = operation.result() + + # Handle the response + print(response) + + Args: + request (Union[google.cloud.security.privateca_v1beta1.types.ActivateCertificateAuthorityRequest, dict]): + The request object. Request message for + [CertificateAuthorityService.ActivateCertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthorityService.ActivateCertificateAuthority]. + name (str): + Required. The resource name for this + [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority] + in the format + ``projects/*/locations/*/certificateAuthorities/*``. + + 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. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.api_core.operation.Operation: + An object representing a long-running operation. + + The result type for the operation will be :class:`google.cloud.security.privateca_v1beta1.types.CertificateAuthority` A [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority] represents an individual Certificate Authority. + A + [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority] + can be used to create + [Certificates][google.cloud.security.privateca.v1beta1.Certificate]. + + """ + # Create or coerce a protobuf request object. + # Quick check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([name]) + if request is not None and has_flattened_params: + raise ValueError('If the `request` argument is set, then none of ' + 'the individual field arguments should be set.') + + # Minor optimization to avoid making a copy if the user passes + # in a service.ActivateCertificateAuthorityRequest. + # There's no risk of modifying the input as we've already verified + # 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 + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.activate_certificate_authority] + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata(( + ("name", request.name), + )), + ) + + # Send the request. + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Wrap the response in an operation future. + response = operation.from_gapic( + response, + self._transport.operations_client, + resources.CertificateAuthority, + metadata_type=service.OperationMetadata, + ) + + # Done; return the response. + return response + + def create_certificate_authority(self, + request: Optional[Union[service.CreateCertificateAuthorityRequest, dict]] = None, + *, + parent: Optional[str] = None, + certificate_authority: Optional[resources.CertificateAuthority] = None, + certificate_authority_id: Optional[str] = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, str]] = (), + ) -> operation.Operation: + r"""Create a new + [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority] + in a given Project and Location. + + .. code-block:: python + + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html + from google.cloud.security import privateca_v1beta1 + + def sample_create_certificate_authority(): + # Create a client + client = privateca_v1beta1.CertificateAuthorityServiceClient() + + # Initialize request argument(s) + certificate_authority = privateca_v1beta1.CertificateAuthority() + certificate_authority.type_ = "SUBORDINATE" + certificate_authority.tier = "DEVOPS" + certificate_authority.config.reusable_config.reusable_config = "reusable_config_value" + certificate_authority.key_spec.cloud_kms_key_version = "cloud_kms_key_version_value" + + request = privateca_v1beta1.CreateCertificateAuthorityRequest( + parent="parent_value", + certificate_authority_id="certificate_authority_id_value", + certificate_authority=certificate_authority, + ) + + # Make the request + operation = client.create_certificate_authority(request=request) + + print("Waiting for operation to complete...") + + response = operation.result() + + # Handle the response + print(response) + + Args: + request (Union[google.cloud.security.privateca_v1beta1.types.CreateCertificateAuthorityRequest, dict]): + The request object. Request message for + [CertificateAuthorityService.CreateCertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthorityService.CreateCertificateAuthority]. + parent (str): + Required. The resource name of the location associated + with the + [CertificateAuthorities][google.cloud.security.privateca.v1beta1.CertificateAuthority], + in the format ``projects/*/locations/*``. + + This corresponds to the ``parent`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + certificate_authority (google.cloud.security.privateca_v1beta1.types.CertificateAuthority): + Required. A + [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority] + with initial field values. + + This corresponds to the ``certificate_authority`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + certificate_authority_id (str): + Required. It must be unique within a location and match + the regular expression ``[a-zA-Z0-9_-]{1,63}`` + + 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. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.api_core.operation.Operation: + An object representing a long-running operation. + + The result type for the operation will be :class:`google.cloud.security.privateca_v1beta1.types.CertificateAuthority` A [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority] represents an individual Certificate Authority. + A + [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority] + can be used to create + [Certificates][google.cloud.security.privateca.v1beta1.Certificate]. + + """ + # Create or coerce a protobuf request object. + # Quick check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([parent, certificate_authority, certificate_authority_id]) + if request is not None and has_flattened_params: + raise ValueError('If the `request` argument is set, then none of ' + 'the individual field arguments should be set.') + + # Minor optimization to avoid making a copy if the user passes + # in a service.CreateCertificateAuthorityRequest. + # There's no risk of modifying the input as we've already verified + # 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: + request.certificate_authority = certificate_authority + if certificate_authority_id is not None: + request.certificate_authority_id = certificate_authority_id + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.create_certificate_authority] + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata(( + ("parent", request.parent), + )), + ) + + # Send the request. + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Wrap the response in an operation future. + response = operation.from_gapic( + response, + self._transport.operations_client, + resources.CertificateAuthority, + metadata_type=service.OperationMetadata, + ) + + # Done; return the response. + return response + + def disable_certificate_authority(self, + request: Optional[Union[service.DisableCertificateAuthorityRequest, dict]] = None, + *, + name: Optional[str] = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, str]] = (), + ) -> operation.Operation: + r"""Disable a + [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority]. + + .. code-block:: python + + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html + from google.cloud.security import privateca_v1beta1 + + def sample_disable_certificate_authority(): + # Create a client + client = privateca_v1beta1.CertificateAuthorityServiceClient() + + # Initialize request argument(s) + request = privateca_v1beta1.DisableCertificateAuthorityRequest( + name="name_value", + ) + + # Make the request + operation = client.disable_certificate_authority(request=request) + + print("Waiting for operation to complete...") + + response = operation.result() + + # Handle the response + print(response) + + Args: + request (Union[google.cloud.security.privateca_v1beta1.types.DisableCertificateAuthorityRequest, dict]): + The request object. Request message for + [CertificateAuthorityService.DisableCertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthorityService.DisableCertificateAuthority]. + name (str): + Required. The resource name for this + [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority] + in the format + ``projects/*/locations/*/certificateAuthorities/*``. + + 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. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.api_core.operation.Operation: + An object representing a long-running operation. + + The result type for the operation will be :class:`google.cloud.security.privateca_v1beta1.types.CertificateAuthority` A [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority] represents an individual Certificate Authority. + A + [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority] + can be used to create + [Certificates][google.cloud.security.privateca.v1beta1.Certificate]. + + """ + # Create or coerce a protobuf request object. + # Quick check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([name]) + if request is not None and has_flattened_params: + raise ValueError('If the `request` argument is set, then none of ' + 'the individual field arguments should be set.') + + # Minor optimization to avoid making a copy if the user passes + # in a service.DisableCertificateAuthorityRequest. + # There's no risk of modifying the input as we've already verified + # 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 + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.disable_certificate_authority] + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata(( + ("name", request.name), + )), + ) + + # Send the request. + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Wrap the response in an operation future. + response = operation.from_gapic( + response, + self._transport.operations_client, + resources.CertificateAuthority, + metadata_type=service.OperationMetadata, + ) + + # Done; return the response. + return response + + def enable_certificate_authority(self, + request: Optional[Union[service.EnableCertificateAuthorityRequest, dict]] = None, + *, + name: Optional[str] = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, str]] = (), + ) -> operation.Operation: + r"""Enable a + [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority]. + + .. code-block:: python + + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html + from google.cloud.security import privateca_v1beta1 + + def sample_enable_certificate_authority(): + # Create a client + client = privateca_v1beta1.CertificateAuthorityServiceClient() + + # Initialize request argument(s) + request = privateca_v1beta1.EnableCertificateAuthorityRequest( + name="name_value", + ) + + # Make the request + operation = client.enable_certificate_authority(request=request) + + print("Waiting for operation to complete...") + + response = operation.result() + + # Handle the response + print(response) + + Args: + request (Union[google.cloud.security.privateca_v1beta1.types.EnableCertificateAuthorityRequest, dict]): + The request object. Request message for + [CertificateAuthorityService.EnableCertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthorityService.EnableCertificateAuthority]. + name (str): + Required. The resource name for this + [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority] + in the format + ``projects/*/locations/*/certificateAuthorities/*``. + + 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. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.api_core.operation.Operation: + An object representing a long-running operation. + + The result type for the operation will be :class:`google.cloud.security.privateca_v1beta1.types.CertificateAuthority` A [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority] represents an individual Certificate Authority. + A + [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority] + can be used to create + [Certificates][google.cloud.security.privateca.v1beta1.Certificate]. + + """ + # Create or coerce a protobuf request object. + # Quick check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([name]) + if request is not None and has_flattened_params: + raise ValueError('If the `request` argument is set, then none of ' + 'the individual field arguments should be set.') + + # Minor optimization to avoid making a copy if the user passes + # in a service.EnableCertificateAuthorityRequest. + # There's no risk of modifying the input as we've already verified + # 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 + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.enable_certificate_authority] + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata(( + ("name", request.name), + )), + ) + + # Send the request. + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Wrap the response in an operation future. + response = operation.from_gapic( + response, + self._transport.operations_client, + resources.CertificateAuthority, + metadata_type=service.OperationMetadata, + ) + + # Done; return the response. + return response + + def fetch_certificate_authority_csr(self, + request: Optional[Union[service.FetchCertificateAuthorityCsrRequest, dict]] = None, + *, + name: Optional[str] = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, str]] = (), + ) -> service.FetchCertificateAuthorityCsrResponse: + r"""Fetch a certificate signing request (CSR) from a + [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority] + that is in state + [PENDING_ACTIVATION][google.cloud.security.privateca.v1beta1.CertificateAuthority.State.PENDING_ACTIVATION] + and is of type + [SUBORDINATE][google.cloud.security.privateca.v1beta1.CertificateAuthority.Type.SUBORDINATE]. + The CSR must then be signed by the desired parent Certificate + Authority, which could be another + [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority] + resource, or could be an on-prem certificate authority. See also + [ActivateCertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthorityService.ActivateCertificateAuthority]. + + .. code-block:: python + + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html + from google.cloud.security import privateca_v1beta1 + + def sample_fetch_certificate_authority_csr(): + # Create a client + client = privateca_v1beta1.CertificateAuthorityServiceClient() + + # Initialize request argument(s) + request = privateca_v1beta1.FetchCertificateAuthorityCsrRequest( + name="name_value", + ) + + # Make the request + response = client.fetch_certificate_authority_csr(request=request) + + # Handle the response + print(response) + + Args: + request (Union[google.cloud.security.privateca_v1beta1.types.FetchCertificateAuthorityCsrRequest, dict]): + The request object. Request message for + [CertificateAuthorityService.FetchCertificateAuthorityCsr][google.cloud.security.privateca.v1beta1.CertificateAuthorityService.FetchCertificateAuthorityCsr]. + name (str): + Required. The resource name for this + [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority] + in the format + ``projects/*/locations/*/certificateAuthorities/*``. + + 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. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.cloud.security.privateca_v1beta1.types.FetchCertificateAuthorityCsrResponse: + Response message for + [CertificateAuthorityService.FetchCertificateAuthorityCsr][google.cloud.security.privateca.v1beta1.CertificateAuthorityService.FetchCertificateAuthorityCsr]. + + """ + # Create or coerce a protobuf request object. + # Quick check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([name]) + if request is not None and has_flattened_params: + raise ValueError('If the `request` argument is set, then none of ' + 'the individual field arguments should be set.') + + # Minor optimization to avoid making a copy if the user passes + # in a service.FetchCertificateAuthorityCsrRequest. + # There's no risk of modifying the input as we've already verified + # 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 + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.fetch_certificate_authority_csr] + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata(( + ("name", request.name), + )), + ) + + # Send the request. + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Done; return the response. + return response + + def get_certificate_authority(self, + request: Optional[Union[service.GetCertificateAuthorityRequest, dict]] = None, + *, + name: Optional[str] = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, str]] = (), + ) -> resources.CertificateAuthority: + r"""Returns a + [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority]. + + .. code-block:: python + + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html + from google.cloud.security import privateca_v1beta1 + + def sample_get_certificate_authority(): + # Create a client + client = privateca_v1beta1.CertificateAuthorityServiceClient() + + # Initialize request argument(s) + request = privateca_v1beta1.GetCertificateAuthorityRequest( + name="name_value", + ) + + # Make the request + response = client.get_certificate_authority(request=request) + + # Handle the response + print(response) + + Args: + request (Union[google.cloud.security.privateca_v1beta1.types.GetCertificateAuthorityRequest, dict]): + The request object. Request message for + [CertificateAuthorityService.GetCertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthorityService.GetCertificateAuthority]. + name (str): + Required. The + [name][google.cloud.security.privateca.v1beta1.CertificateAuthority.name] + of the + [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority] + to get. + + 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. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.cloud.security.privateca_v1beta1.types.CertificateAuthority: + A [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority] represents an individual Certificate Authority. + A + [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority] + can be used to create + [Certificates][google.cloud.security.privateca.v1beta1.Certificate]. + + """ + # Create or coerce a protobuf request object. + # Quick check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([name]) + if request is not None and has_flattened_params: + raise ValueError('If the `request` argument is set, then none of ' + 'the individual field arguments should be set.') + + # Minor optimization to avoid making a copy if the user passes + # in a service.GetCertificateAuthorityRequest. + # There's no risk of modifying the input as we've already verified + # 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 + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.get_certificate_authority] + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata(( + ("name", request.name), + )), + ) + + # Send the request. + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Done; return the response. + return response + + def list_certificate_authorities(self, + request: Optional[Union[service.ListCertificateAuthoritiesRequest, dict]] = None, + *, + parent: Optional[str] = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, str]] = (), + ) -> pagers.ListCertificateAuthoritiesPager: + r"""Lists + [CertificateAuthorities][google.cloud.security.privateca.v1beta1.CertificateAuthority]. + + .. code-block:: python + + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html + from google.cloud.security import privateca_v1beta1 + + def sample_list_certificate_authorities(): + # Create a client + client = privateca_v1beta1.CertificateAuthorityServiceClient() + + # Initialize request argument(s) + request = privateca_v1beta1.ListCertificateAuthoritiesRequest( + parent="parent_value", + ) + + # Make the request + page_result = client.list_certificate_authorities(request=request) + + # Handle the response + for response in page_result: + print(response) + + Args: + request (Union[google.cloud.security.privateca_v1beta1.types.ListCertificateAuthoritiesRequest, dict]): + The request object. Request message for + [CertificateAuthorityService.ListCertificateAuthorities][google.cloud.security.privateca.v1beta1.CertificateAuthorityService.ListCertificateAuthorities]. + parent (str): + Required. The resource name of the location associated + with the + [CertificateAuthorities][google.cloud.security.privateca.v1beta1.CertificateAuthority], + in the format ``projects/*/locations/*``. + + 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. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.cloud.security.privateca_v1beta1.services.certificate_authority_service.pagers.ListCertificateAuthoritiesPager: + Response message for + [CertificateAuthorityService.ListCertificateAuthorities][google.cloud.security.privateca.v1beta1.CertificateAuthorityService.ListCertificateAuthorities]. + + Iterating over this object will yield results and + resolve additional pages automatically. + + """ + # Create or coerce a protobuf request object. + # Quick check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([parent]) + if request is not None and has_flattened_params: + raise ValueError('If the `request` argument is set, then none of ' + 'the individual field arguments should be set.') + + # Minor optimization to avoid making a copy if the user passes + # in a service.ListCertificateAuthoritiesRequest. + # There's no risk of modifying the input as we've already verified + # 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 + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.list_certificate_authorities] + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata(( + ("parent", request.parent), + )), + ) + + # Send the request. + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # This method is paged; wrap the response in a pager, which provides + # an `__iter__` convenience method. + response = pagers.ListCertificateAuthoritiesPager( + method=rpc, + request=request, + response=response, + metadata=metadata, + ) + + # Done; return the response. + return response + + def restore_certificate_authority(self, + request: Optional[Union[service.RestoreCertificateAuthorityRequest, dict]] = None, + *, + name: Optional[str] = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, str]] = (), + ) -> operation.Operation: + r"""Restore a + [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority] + that is scheduled for deletion. + + .. code-block:: python + + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html + from google.cloud.security import privateca_v1beta1 + + def sample_restore_certificate_authority(): + # Create a client + client = privateca_v1beta1.CertificateAuthorityServiceClient() + + # Initialize request argument(s) + request = privateca_v1beta1.RestoreCertificateAuthorityRequest( + name="name_value", + ) + + # Make the request + operation = client.restore_certificate_authority(request=request) + + print("Waiting for operation to complete...") + + response = operation.result() + + # Handle the response + print(response) + + Args: + request (Union[google.cloud.security.privateca_v1beta1.types.RestoreCertificateAuthorityRequest, dict]): + The request object. Request message for + [CertificateAuthorityService.RestoreCertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthorityService.RestoreCertificateAuthority]. + name (str): + Required. The resource name for this + [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority] + in the format + ``projects/*/locations/*/certificateAuthorities/*``. + + 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. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.api_core.operation.Operation: + An object representing a long-running operation. + + The result type for the operation will be :class:`google.cloud.security.privateca_v1beta1.types.CertificateAuthority` A [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority] represents an individual Certificate Authority. + A + [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority] + can be used to create + [Certificates][google.cloud.security.privateca.v1beta1.Certificate]. + + """ + # Create or coerce a protobuf request object. + # Quick check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([name]) + if request is not None and has_flattened_params: + raise ValueError('If the `request` argument is set, then none of ' + 'the individual field arguments should be set.') + + # Minor optimization to avoid making a copy if the user passes + # in a service.RestoreCertificateAuthorityRequest. + # There's no risk of modifying the input as we've already verified + # 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 + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.restore_certificate_authority] + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata(( + ("name", request.name), + )), + ) + + # Send the request. + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Wrap the response in an operation future. + response = operation.from_gapic( + response, + self._transport.operations_client, + resources.CertificateAuthority, + metadata_type=service.OperationMetadata, + ) + + # Done; return the response. + return response + + def schedule_delete_certificate_authority(self, + request: Optional[Union[service.ScheduleDeleteCertificateAuthorityRequest, dict]] = None, + *, + name: Optional[str] = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, str]] = (), + ) -> operation.Operation: + r"""Schedule a + [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority] + for deletion. + + .. code-block:: python + + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html + from google.cloud.security import privateca_v1beta1 + + def sample_schedule_delete_certificate_authority(): + # Create a client + client = privateca_v1beta1.CertificateAuthorityServiceClient() + + # Initialize request argument(s) + request = privateca_v1beta1.ScheduleDeleteCertificateAuthorityRequest( + name="name_value", + ) + + # Make the request + operation = client.schedule_delete_certificate_authority(request=request) + + print("Waiting for operation to complete...") + + response = operation.result() + + # Handle the response + print(response) + + Args: + request (Union[google.cloud.security.privateca_v1beta1.types.ScheduleDeleteCertificateAuthorityRequest, dict]): + The request object. Request message for + [CertificateAuthorityService.ScheduleDeleteCertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthorityService.ScheduleDeleteCertificateAuthority]. + name (str): + Required. The resource name for this + [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority] + in the format + ``projects/*/locations/*/certificateAuthorities/*``. + + 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. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.api_core.operation.Operation: + An object representing a long-running operation. + + The result type for the operation will be :class:`google.cloud.security.privateca_v1beta1.types.CertificateAuthority` A [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority] represents an individual Certificate Authority. + A + [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority] + can be used to create + [Certificates][google.cloud.security.privateca.v1beta1.Certificate]. + + """ + # Create or coerce a protobuf request object. + # Quick check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([name]) + if request is not None and has_flattened_params: + raise ValueError('If the `request` argument is set, then none of ' + 'the individual field arguments should be set.') + + # Minor optimization to avoid making a copy if the user passes + # in a service.ScheduleDeleteCertificateAuthorityRequest. + # There's no risk of modifying the input as we've already verified + # 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 + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.schedule_delete_certificate_authority] + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata(( + ("name", request.name), + )), + ) + + # Send the request. + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Wrap the response in an operation future. + response = operation.from_gapic( + response, + self._transport.operations_client, + resources.CertificateAuthority, + metadata_type=service.OperationMetadata, + ) + + # Done; return the response. + return response + + def update_certificate_authority(self, + request: Optional[Union[service.UpdateCertificateAuthorityRequest, dict]] = None, + *, + certificate_authority: Optional[resources.CertificateAuthority] = None, + update_mask: Optional[field_mask_pb2.FieldMask] = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, str]] = (), + ) -> operation.Operation: + r"""Update a + [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority]. + + .. code-block:: python + + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html + from google.cloud.security import privateca_v1beta1 + + def sample_update_certificate_authority(): + # Create a client + client = privateca_v1beta1.CertificateAuthorityServiceClient() + + # Initialize request argument(s) + certificate_authority = privateca_v1beta1.CertificateAuthority() + certificate_authority.type_ = "SUBORDINATE" + certificate_authority.tier = "DEVOPS" + certificate_authority.config.reusable_config.reusable_config = "reusable_config_value" + certificate_authority.key_spec.cloud_kms_key_version = "cloud_kms_key_version_value" + + request = privateca_v1beta1.UpdateCertificateAuthorityRequest( + certificate_authority=certificate_authority, + ) + + # Make the request + operation = client.update_certificate_authority(request=request) + + print("Waiting for operation to complete...") + + response = operation.result() + + # Handle the response + print(response) + + Args: + request (Union[google.cloud.security.privateca_v1beta1.types.UpdateCertificateAuthorityRequest, dict]): + The request object. Request message for + [CertificateAuthorityService.UpdateCertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthorityService.UpdateCertificateAuthority]. + certificate_authority (google.cloud.security.privateca_v1beta1.types.CertificateAuthority): + Required. + [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority] + with updated values. + + This corresponds to the ``certificate_authority`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + update_mask (google.protobuf.field_mask_pb2.FieldMask): + Required. A list of fields to be + updated in this request. + + 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. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.api_core.operation.Operation: + An object representing a long-running operation. + + The result type for the operation will be :class:`google.cloud.security.privateca_v1beta1.types.CertificateAuthority` A [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority] represents an individual Certificate Authority. + A + [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority] + can be used to create + [Certificates][google.cloud.security.privateca.v1beta1.Certificate]. + + """ + # Create or coerce a protobuf request object. + # Quick check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([certificate_authority, update_mask]) + if request is not None and has_flattened_params: + raise ValueError('If the `request` argument is set, then none of ' + 'the individual field arguments should be set.') + + # Minor optimization to avoid making a copy if the user passes + # in a service.UpdateCertificateAuthorityRequest. + # There's no risk of modifying the input as we've already verified + # 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: + request.update_mask = update_mask + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.update_certificate_authority] + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata(( + ("certificate_authority.name", request.certificate_authority.name), + )), + ) + + # Send the request. + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Wrap the response in an operation future. + response = operation.from_gapic( + response, + self._transport.operations_client, + resources.CertificateAuthority, + metadata_type=service.OperationMetadata, + ) + + # Done; return the response. + return response + + def get_certificate_revocation_list(self, + request: Optional[Union[service.GetCertificateRevocationListRequest, dict]] = None, + *, + name: Optional[str] = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, str]] = (), + ) -> resources.CertificateRevocationList: + r"""Returns a + [CertificateRevocationList][google.cloud.security.privateca.v1beta1.CertificateRevocationList]. + + .. code-block:: python + + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html + from google.cloud.security import privateca_v1beta1 + + def sample_get_certificate_revocation_list(): + # Create a client + client = privateca_v1beta1.CertificateAuthorityServiceClient() + + # Initialize request argument(s) + request = privateca_v1beta1.GetCertificateRevocationListRequest( + name="name_value", + ) + + # Make the request + response = client.get_certificate_revocation_list(request=request) + + # Handle the response + print(response) + + Args: + request (Union[google.cloud.security.privateca_v1beta1.types.GetCertificateRevocationListRequest, dict]): + The request object. Request message for + [CertificateAuthorityService.GetCertificateRevocationList][google.cloud.security.privateca.v1beta1.CertificateAuthorityService.GetCertificateRevocationList]. + name (str): + Required. The + [name][google.cloud.security.privateca.v1beta1.CertificateRevocationList.name] + of the + [CertificateRevocationList][google.cloud.security.privateca.v1beta1.CertificateRevocationList] + to get. + + 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. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.cloud.security.privateca_v1beta1.types.CertificateRevocationList: + A [CertificateRevocationList][google.cloud.security.privateca.v1beta1.CertificateRevocationList] corresponds to a signed X.509 certificate + Revocation List (CRL). A CRL contains the serial + numbers of certificates that should no longer be + trusted. + + """ + # Create or coerce a protobuf request object. + # Quick check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([name]) + if request is not None and has_flattened_params: + raise ValueError('If the `request` argument is set, then none of ' + 'the individual field arguments should be set.') + + # Minor optimization to avoid making a copy if the user passes + # in a service.GetCertificateRevocationListRequest. + # There's no risk of modifying the input as we've already verified + # 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 + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.get_certificate_revocation_list] + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata(( + ("name", request.name), + )), + ) + + # Send the request. + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Done; return the response. + return response + + def list_certificate_revocation_lists(self, + request: Optional[Union[service.ListCertificateRevocationListsRequest, dict]] = None, + *, + parent: Optional[str] = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, str]] = (), + ) -> pagers.ListCertificateRevocationListsPager: + r"""Lists + [CertificateRevocationLists][google.cloud.security.privateca.v1beta1.CertificateRevocationList]. + + .. code-block:: python + + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html + from google.cloud.security import privateca_v1beta1 + + def sample_list_certificate_revocation_lists(): + # Create a client + client = privateca_v1beta1.CertificateAuthorityServiceClient() + + # Initialize request argument(s) + request = privateca_v1beta1.ListCertificateRevocationListsRequest( + parent="parent_value", + ) + + # Make the request + page_result = client.list_certificate_revocation_lists(request=request) + + # Handle the response + for response in page_result: + print(response) + + Args: + request (Union[google.cloud.security.privateca_v1beta1.types.ListCertificateRevocationListsRequest, dict]): + The request object. Request message for + [CertificateAuthorityService.ListCertificateRevocationLists][google.cloud.security.privateca.v1beta1.CertificateAuthorityService.ListCertificateRevocationLists]. + parent (str): + Required. The resource name of the location associated + with the + [CertificateRevocationLists][google.cloud.security.privateca.v1beta1.CertificateRevocationList], + in the format + ``projects/*/locations/*/certificateauthorities/*``. + + 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. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.cloud.security.privateca_v1beta1.services.certificate_authority_service.pagers.ListCertificateRevocationListsPager: + Response message for + [CertificateAuthorityService.ListCertificateRevocationLists][google.cloud.security.privateca.v1beta1.CertificateAuthorityService.ListCertificateRevocationLists]. + + Iterating over this object will yield results and + resolve additional pages automatically. + + """ + # Create or coerce a protobuf request object. + # Quick check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([parent]) + if request is not None and has_flattened_params: + raise ValueError('If the `request` argument is set, then none of ' + 'the individual field arguments should be set.') + + # Minor optimization to avoid making a copy if the user passes + # in a service.ListCertificateRevocationListsRequest. + # There's no risk of modifying the input as we've already verified + # 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 + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.list_certificate_revocation_lists] + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata(( + ("parent", request.parent), + )), + ) + + # Send the request. + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # This method is paged; wrap the response in a pager, which provides + # an `__iter__` convenience method. + response = pagers.ListCertificateRevocationListsPager( + method=rpc, + request=request, + response=response, + metadata=metadata, + ) + + # Done; return the response. + return response + + def update_certificate_revocation_list(self, + request: Optional[Union[service.UpdateCertificateRevocationListRequest, dict]] = None, + *, + certificate_revocation_list: Optional[resources.CertificateRevocationList] = None, + update_mask: Optional[field_mask_pb2.FieldMask] = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, str]] = (), + ) -> operation.Operation: + r"""Update a + [CertificateRevocationList][google.cloud.security.privateca.v1beta1.CertificateRevocationList]. + + .. code-block:: python + + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html + from google.cloud.security import privateca_v1beta1 + + def sample_update_certificate_revocation_list(): + # Create a client + client = privateca_v1beta1.CertificateAuthorityServiceClient() + + # Initialize request argument(s) + request = privateca_v1beta1.UpdateCertificateRevocationListRequest( + ) + + # Make the request + operation = client.update_certificate_revocation_list(request=request) + + print("Waiting for operation to complete...") + + response = operation.result() + + # Handle the response + print(response) + + Args: + request (Union[google.cloud.security.privateca_v1beta1.types.UpdateCertificateRevocationListRequest, dict]): + The request object. Request message for + [CertificateAuthorityService.UpdateCertificateRevocationList][google.cloud.security.privateca.v1beta1.CertificateAuthorityService.UpdateCertificateRevocationList]. + certificate_revocation_list (google.cloud.security.privateca_v1beta1.types.CertificateRevocationList): + Required. + [CertificateRevocationList][google.cloud.security.privateca.v1beta1.CertificateRevocationList] + with updated values. + + This corresponds to the ``certificate_revocation_list`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + update_mask (google.protobuf.field_mask_pb2.FieldMask): + Required. A list of fields to be + updated in this request. + + 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. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.api_core.operation.Operation: + An object representing a long-running operation. + + The result type for the operation will be :class:`google.cloud.security.privateca_v1beta1.types.CertificateRevocationList` A [CertificateRevocationList][google.cloud.security.privateca.v1beta1.CertificateRevocationList] corresponds to a signed X.509 certificate + Revocation List (CRL). A CRL contains the serial + numbers of certificates that should no longer be + trusted. + + """ + # Create or coerce a protobuf request object. + # Quick check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([certificate_revocation_list, update_mask]) + if request is not None and has_flattened_params: + raise ValueError('If the `request` argument is set, then none of ' + 'the individual field arguments should be set.') + + # Minor optimization to avoid making a copy if the user passes + # in a service.UpdateCertificateRevocationListRequest. + # There's no risk of modifying the input as we've already verified + # 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: + request.update_mask = update_mask + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.update_certificate_revocation_list] + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata(( + ("certificate_revocation_list.name", request.certificate_revocation_list.name), + )), + ) + + # Send the request. + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Wrap the response in an operation future. + response = operation.from_gapic( + response, + self._transport.operations_client, + resources.CertificateRevocationList, + metadata_type=service.OperationMetadata, + ) + + # Done; return the response. + return response + + def get_reusable_config(self, + request: Optional[Union[service.GetReusableConfigRequest, dict]] = None, + *, + name: Optional[str] = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, str]] = (), + ) -> resources.ReusableConfig: + r"""Returns a + [ReusableConfig][google.cloud.security.privateca.v1beta1.ReusableConfig]. + + .. code-block:: python + + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html + from google.cloud.security import privateca_v1beta1 + + def sample_get_reusable_config(): + # Create a client + client = privateca_v1beta1.CertificateAuthorityServiceClient() + + # Initialize request argument(s) + request = privateca_v1beta1.GetReusableConfigRequest( + name="name_value", + ) + + # Make the request + response = client.get_reusable_config(request=request) + + # Handle the response + print(response) + + Args: + request (Union[google.cloud.security.privateca_v1beta1.types.GetReusableConfigRequest, dict]): + The request object. Request message for + [CertificateAuthorityService.GetReusableConfig][google.cloud.security.privateca.v1beta1.CertificateAuthorityService.GetReusableConfig]. + name (str): + Required. The [name][ReusableConfigs.name] of the + [ReusableConfigs][] to get. + + 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. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.cloud.security.privateca_v1beta1.types.ReusableConfig: + A [ReusableConfig][google.cloud.security.privateca.v1beta1.ReusableConfig] refers to a managed [ReusableConfigValues][google.cloud.security.privateca.v1beta1.ReusableConfigValues]. Those, in + turn, are used to describe certain fields of an X.509 + certificate, such as the key usage fields, fields + specific to CA certificates, certificate policy + extensions and custom extensions. + + """ + # Create or coerce a protobuf request object. + # Quick check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([name]) + if request is not None and has_flattened_params: + raise ValueError('If the `request` argument is set, then none of ' + 'the individual field arguments should be set.') + + # Minor optimization to avoid making a copy if the user passes + # in a service.GetReusableConfigRequest. + # There's no risk of modifying the input as we've already verified + # 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 + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.get_reusable_config] + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata(( + ("name", request.name), + )), + ) + + # Send the request. + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Done; return the response. + return response + + def list_reusable_configs(self, + request: Optional[Union[service.ListReusableConfigsRequest, dict]] = None, + *, + parent: Optional[str] = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, str]] = (), + ) -> pagers.ListReusableConfigsPager: + r"""Lists + [ReusableConfigs][google.cloud.security.privateca.v1beta1.ReusableConfig]. + + .. code-block:: python + + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html + from google.cloud.security import privateca_v1beta1 + + def sample_list_reusable_configs(): + # Create a client + client = privateca_v1beta1.CertificateAuthorityServiceClient() + + # Initialize request argument(s) + request = privateca_v1beta1.ListReusableConfigsRequest( + parent="parent_value", + ) + + # Make the request + page_result = client.list_reusable_configs(request=request) + + # Handle the response + for response in page_result: + print(response) + + Args: + request (Union[google.cloud.security.privateca_v1beta1.types.ListReusableConfigsRequest, dict]): + The request object. Request message for + [CertificateAuthorityService.ListReusableConfigs][google.cloud.security.privateca.v1beta1.CertificateAuthorityService.ListReusableConfigs]. + parent (str): + Required. The resource name of the location associated + with the + [ReusableConfigs][google.cloud.security.privateca.v1beta1.ReusableConfig], + in the format ``projects/*/locations/*``. + + 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. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.cloud.security.privateca_v1beta1.services.certificate_authority_service.pagers.ListReusableConfigsPager: + Response message for + [CertificateAuthorityService.ListReusableConfigs][google.cloud.security.privateca.v1beta1.CertificateAuthorityService.ListReusableConfigs]. + + Iterating over this object will yield results and + resolve additional pages automatically. + + """ + # Create or coerce a protobuf request object. + # Quick check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([parent]) + if request is not None and has_flattened_params: + raise ValueError('If the `request` argument is set, then none of ' + 'the individual field arguments should be set.') + + # Minor optimization to avoid making a copy if the user passes + # in a service.ListReusableConfigsRequest. + # There's no risk of modifying the input as we've already verified + # 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 + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.list_reusable_configs] + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata(( + ("parent", request.parent), + )), + ) + + # Send the request. + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # This method is paged; wrap the response in a pager, which provides + # an `__iter__` convenience method. + response = pagers.ListReusableConfigsPager( + method=rpc, + request=request, + response=response, + metadata=metadata, + ) + + # Done; return the response. + return response + + def __enter__(self) -> "CertificateAuthorityServiceClient": + return self + + def __exit__(self, type, value, traceback): + """Releases underlying transport's resources. + + .. warning:: + ONLY use as a context manager if the transport is NOT shared + with other clients! Exiting the with block will CLOSE the transport + and may cause errors in other clients! + """ + self.transport.close() + + + + + + + +DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo(gapic_version=package_version.__version__) + + +__all__ = ( + "CertificateAuthorityServiceClient", +) diff --git a/owl-bot-staging/v1beta1/google/cloud/security/privateca_v1beta1/services/certificate_authority_service/pagers.py b/owl-bot-staging/v1beta1/google/cloud/security/privateca_v1beta1/services/certificate_authority_service/pagers.py new file mode 100644 index 0000000..3ec66c3 --- /dev/null +++ b/owl-bot-staging/v1beta1/google/cloud/security/privateca_v1beta1/services/certificate_authority_service/pagers.py @@ -0,0 +1,503 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +from typing import Any, AsyncIterator, Awaitable, Callable, Sequence, Tuple, Optional, Iterator + +from google.cloud.security.privateca_v1beta1.types import resources +from google.cloud.security.privateca_v1beta1.types import service + + +class ListCertificatesPager: + """A pager for iterating through ``list_certificates`` requests. + + This class thinly wraps an initial + :class:`google.cloud.security.privateca_v1beta1.types.ListCertificatesResponse` object, and + provides an ``__iter__`` method to iterate through its + ``certificates`` field. + + If there are more pages, the ``__iter__`` method will make additional + ``ListCertificates`` requests and continue to iterate + through the ``certificates`` field on the + corresponding responses. + + All the usual :class:`google.cloud.security.privateca_v1beta1.types.ListCertificatesResponse` + attributes are available on the pager. If multiple requests are made, only + the most recent response is retained, and thus used for attribute lookup. + """ + def __init__(self, + method: Callable[..., service.ListCertificatesResponse], + request: service.ListCertificatesRequest, + response: service.ListCertificatesResponse, + *, + metadata: Sequence[Tuple[str, str]] = ()): + """Instantiate the pager. + + Args: + method (Callable): The method that was originally called, and + which instantiated this pager. + request (google.cloud.security.privateca_v1beta1.types.ListCertificatesRequest): + The initial request object. + response (google.cloud.security.privateca_v1beta1.types.ListCertificatesResponse): + The initial response object. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + """ + self._method = method + self._request = service.ListCertificatesRequest(request) + self._response = response + self._metadata = metadata + + def __getattr__(self, name: str) -> Any: + return getattr(self._response, name) + + @property + def pages(self) -> Iterator[service.ListCertificatesResponse]: + yield self._response + while self._response.next_page_token: + self._request.page_token = self._response.next_page_token + self._response = self._method(self._request, metadata=self._metadata) + yield self._response + + def __iter__(self) -> Iterator[resources.Certificate]: + for page in self.pages: + yield from page.certificates + + def __repr__(self) -> str: + return '{0}<{1!r}>'.format(self.__class__.__name__, self._response) + + +class ListCertificatesAsyncPager: + """A pager for iterating through ``list_certificates`` requests. + + This class thinly wraps an initial + :class:`google.cloud.security.privateca_v1beta1.types.ListCertificatesResponse` object, and + provides an ``__aiter__`` method to iterate through its + ``certificates`` field. + + If there are more pages, the ``__aiter__`` method will make additional + ``ListCertificates`` requests and continue to iterate + through the ``certificates`` field on the + corresponding responses. + + All the usual :class:`google.cloud.security.privateca_v1beta1.types.ListCertificatesResponse` + attributes are available on the pager. If multiple requests are made, only + the most recent response is retained, and thus used for attribute lookup. + """ + def __init__(self, + method: Callable[..., Awaitable[service.ListCertificatesResponse]], + request: service.ListCertificatesRequest, + response: service.ListCertificatesResponse, + *, + metadata: Sequence[Tuple[str, str]] = ()): + """Instantiates the pager. + + Args: + method (Callable): The method that was originally called, and + which instantiated this pager. + request (google.cloud.security.privateca_v1beta1.types.ListCertificatesRequest): + The initial request object. + response (google.cloud.security.privateca_v1beta1.types.ListCertificatesResponse): + The initial response object. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + """ + self._method = method + self._request = service.ListCertificatesRequest(request) + self._response = response + self._metadata = metadata + + def __getattr__(self, name: str) -> Any: + return getattr(self._response, name) + + @property + async def pages(self) -> AsyncIterator[service.ListCertificatesResponse]: + yield self._response + while self._response.next_page_token: + self._request.page_token = self._response.next_page_token + self._response = await self._method(self._request, metadata=self._metadata) + yield self._response + def __aiter__(self) -> AsyncIterator[resources.Certificate]: + async def async_generator(): + async for page in self.pages: + for response in page.certificates: + yield response + + return async_generator() + + def __repr__(self) -> str: + return '{0}<{1!r}>'.format(self.__class__.__name__, self._response) + + +class ListCertificateAuthoritiesPager: + """A pager for iterating through ``list_certificate_authorities`` requests. + + This class thinly wraps an initial + :class:`google.cloud.security.privateca_v1beta1.types.ListCertificateAuthoritiesResponse` object, and + provides an ``__iter__`` method to iterate through its + ``certificate_authorities`` field. + + If there are more pages, the ``__iter__`` method will make additional + ``ListCertificateAuthorities`` requests and continue to iterate + through the ``certificate_authorities`` field on the + corresponding responses. + + All the usual :class:`google.cloud.security.privateca_v1beta1.types.ListCertificateAuthoritiesResponse` + attributes are available on the pager. If multiple requests are made, only + the most recent response is retained, and thus used for attribute lookup. + """ + def __init__(self, + method: Callable[..., service.ListCertificateAuthoritiesResponse], + request: service.ListCertificateAuthoritiesRequest, + response: service.ListCertificateAuthoritiesResponse, + *, + metadata: Sequence[Tuple[str, str]] = ()): + """Instantiate the pager. + + Args: + method (Callable): The method that was originally called, and + which instantiated this pager. + request (google.cloud.security.privateca_v1beta1.types.ListCertificateAuthoritiesRequest): + The initial request object. + response (google.cloud.security.privateca_v1beta1.types.ListCertificateAuthoritiesResponse): + The initial response object. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + """ + self._method = method + self._request = service.ListCertificateAuthoritiesRequest(request) + self._response = response + self._metadata = metadata + + def __getattr__(self, name: str) -> Any: + return getattr(self._response, name) + + @property + def pages(self) -> Iterator[service.ListCertificateAuthoritiesResponse]: + yield self._response + while self._response.next_page_token: + self._request.page_token = self._response.next_page_token + self._response = self._method(self._request, metadata=self._metadata) + yield self._response + + def __iter__(self) -> Iterator[resources.CertificateAuthority]: + for page in self.pages: + yield from page.certificate_authorities + + def __repr__(self) -> str: + return '{0}<{1!r}>'.format(self.__class__.__name__, self._response) + + +class ListCertificateAuthoritiesAsyncPager: + """A pager for iterating through ``list_certificate_authorities`` requests. + + This class thinly wraps an initial + :class:`google.cloud.security.privateca_v1beta1.types.ListCertificateAuthoritiesResponse` object, and + provides an ``__aiter__`` method to iterate through its + ``certificate_authorities`` field. + + If there are more pages, the ``__aiter__`` method will make additional + ``ListCertificateAuthorities`` requests and continue to iterate + through the ``certificate_authorities`` field on the + corresponding responses. + + All the usual :class:`google.cloud.security.privateca_v1beta1.types.ListCertificateAuthoritiesResponse` + attributes are available on the pager. If multiple requests are made, only + the most recent response is retained, and thus used for attribute lookup. + """ + def __init__(self, + method: Callable[..., Awaitable[service.ListCertificateAuthoritiesResponse]], + request: service.ListCertificateAuthoritiesRequest, + response: service.ListCertificateAuthoritiesResponse, + *, + metadata: Sequence[Tuple[str, str]] = ()): + """Instantiates the pager. + + Args: + method (Callable): The method that was originally called, and + which instantiated this pager. + request (google.cloud.security.privateca_v1beta1.types.ListCertificateAuthoritiesRequest): + The initial request object. + response (google.cloud.security.privateca_v1beta1.types.ListCertificateAuthoritiesResponse): + The initial response object. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + """ + self._method = method + self._request = service.ListCertificateAuthoritiesRequest(request) + self._response = response + self._metadata = metadata + + def __getattr__(self, name: str) -> Any: + return getattr(self._response, name) + + @property + async def pages(self) -> AsyncIterator[service.ListCertificateAuthoritiesResponse]: + yield self._response + while self._response.next_page_token: + self._request.page_token = self._response.next_page_token + self._response = await self._method(self._request, metadata=self._metadata) + yield self._response + def __aiter__(self) -> AsyncIterator[resources.CertificateAuthority]: + async def async_generator(): + async for page in self.pages: + for response in page.certificate_authorities: + yield response + + return async_generator() + + def __repr__(self) -> str: + return '{0}<{1!r}>'.format(self.__class__.__name__, self._response) + + +class ListCertificateRevocationListsPager: + """A pager for iterating through ``list_certificate_revocation_lists`` requests. + + This class thinly wraps an initial + :class:`google.cloud.security.privateca_v1beta1.types.ListCertificateRevocationListsResponse` object, and + provides an ``__iter__`` method to iterate through its + ``certificate_revocation_lists`` field. + + If there are more pages, the ``__iter__`` method will make additional + ``ListCertificateRevocationLists`` requests and continue to iterate + through the ``certificate_revocation_lists`` field on the + corresponding responses. + + All the usual :class:`google.cloud.security.privateca_v1beta1.types.ListCertificateRevocationListsResponse` + attributes are available on the pager. If multiple requests are made, only + the most recent response is retained, and thus used for attribute lookup. + """ + def __init__(self, + method: Callable[..., service.ListCertificateRevocationListsResponse], + request: service.ListCertificateRevocationListsRequest, + response: service.ListCertificateRevocationListsResponse, + *, + metadata: Sequence[Tuple[str, str]] = ()): + """Instantiate the pager. + + Args: + method (Callable): The method that was originally called, and + which instantiated this pager. + request (google.cloud.security.privateca_v1beta1.types.ListCertificateRevocationListsRequest): + The initial request object. + response (google.cloud.security.privateca_v1beta1.types.ListCertificateRevocationListsResponse): + The initial response object. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + """ + self._method = method + self._request = service.ListCertificateRevocationListsRequest(request) + self._response = response + self._metadata = metadata + + def __getattr__(self, name: str) -> Any: + return getattr(self._response, name) + + @property + def pages(self) -> Iterator[service.ListCertificateRevocationListsResponse]: + yield self._response + while self._response.next_page_token: + self._request.page_token = self._response.next_page_token + self._response = self._method(self._request, metadata=self._metadata) + yield self._response + + def __iter__(self) -> Iterator[resources.CertificateRevocationList]: + for page in self.pages: + yield from page.certificate_revocation_lists + + def __repr__(self) -> str: + return '{0}<{1!r}>'.format(self.__class__.__name__, self._response) + + +class ListCertificateRevocationListsAsyncPager: + """A pager for iterating through ``list_certificate_revocation_lists`` requests. + + This class thinly wraps an initial + :class:`google.cloud.security.privateca_v1beta1.types.ListCertificateRevocationListsResponse` object, and + provides an ``__aiter__`` method to iterate through its + ``certificate_revocation_lists`` field. + + If there are more pages, the ``__aiter__`` method will make additional + ``ListCertificateRevocationLists`` requests and continue to iterate + through the ``certificate_revocation_lists`` field on the + corresponding responses. + + All the usual :class:`google.cloud.security.privateca_v1beta1.types.ListCertificateRevocationListsResponse` + attributes are available on the pager. If multiple requests are made, only + the most recent response is retained, and thus used for attribute lookup. + """ + def __init__(self, + method: Callable[..., Awaitable[service.ListCertificateRevocationListsResponse]], + request: service.ListCertificateRevocationListsRequest, + response: service.ListCertificateRevocationListsResponse, + *, + metadata: Sequence[Tuple[str, str]] = ()): + """Instantiates the pager. + + Args: + method (Callable): The method that was originally called, and + which instantiated this pager. + request (google.cloud.security.privateca_v1beta1.types.ListCertificateRevocationListsRequest): + The initial request object. + response (google.cloud.security.privateca_v1beta1.types.ListCertificateRevocationListsResponse): + The initial response object. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + """ + self._method = method + self._request = service.ListCertificateRevocationListsRequest(request) + self._response = response + self._metadata = metadata + + def __getattr__(self, name: str) -> Any: + return getattr(self._response, name) + + @property + async def pages(self) -> AsyncIterator[service.ListCertificateRevocationListsResponse]: + yield self._response + while self._response.next_page_token: + self._request.page_token = self._response.next_page_token + self._response = await self._method(self._request, metadata=self._metadata) + yield self._response + def __aiter__(self) -> AsyncIterator[resources.CertificateRevocationList]: + async def async_generator(): + async for page in self.pages: + for response in page.certificate_revocation_lists: + yield response + + return async_generator() + + def __repr__(self) -> str: + return '{0}<{1!r}>'.format(self.__class__.__name__, self._response) + + +class ListReusableConfigsPager: + """A pager for iterating through ``list_reusable_configs`` requests. + + This class thinly wraps an initial + :class:`google.cloud.security.privateca_v1beta1.types.ListReusableConfigsResponse` object, and + provides an ``__iter__`` method to iterate through its + ``reusable_configs`` field. + + If there are more pages, the ``__iter__`` method will make additional + ``ListReusableConfigs`` requests and continue to iterate + through the ``reusable_configs`` field on the + corresponding responses. + + All the usual :class:`google.cloud.security.privateca_v1beta1.types.ListReusableConfigsResponse` + attributes are available on the pager. If multiple requests are made, only + the most recent response is retained, and thus used for attribute lookup. + """ + def __init__(self, + method: Callable[..., service.ListReusableConfigsResponse], + request: service.ListReusableConfigsRequest, + response: service.ListReusableConfigsResponse, + *, + metadata: Sequence[Tuple[str, str]] = ()): + """Instantiate the pager. + + Args: + method (Callable): The method that was originally called, and + which instantiated this pager. + request (google.cloud.security.privateca_v1beta1.types.ListReusableConfigsRequest): + The initial request object. + response (google.cloud.security.privateca_v1beta1.types.ListReusableConfigsResponse): + The initial response object. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + """ + self._method = method + self._request = service.ListReusableConfigsRequest(request) + self._response = response + self._metadata = metadata + + def __getattr__(self, name: str) -> Any: + return getattr(self._response, name) + + @property + def pages(self) -> Iterator[service.ListReusableConfigsResponse]: + yield self._response + while self._response.next_page_token: + self._request.page_token = self._response.next_page_token + self._response = self._method(self._request, metadata=self._metadata) + yield self._response + + def __iter__(self) -> Iterator[resources.ReusableConfig]: + for page in self.pages: + yield from page.reusable_configs + + def __repr__(self) -> str: + return '{0}<{1!r}>'.format(self.__class__.__name__, self._response) + + +class ListReusableConfigsAsyncPager: + """A pager for iterating through ``list_reusable_configs`` requests. + + This class thinly wraps an initial + :class:`google.cloud.security.privateca_v1beta1.types.ListReusableConfigsResponse` object, and + provides an ``__aiter__`` method to iterate through its + ``reusable_configs`` field. + + If there are more pages, the ``__aiter__`` method will make additional + ``ListReusableConfigs`` requests and continue to iterate + through the ``reusable_configs`` field on the + corresponding responses. + + All the usual :class:`google.cloud.security.privateca_v1beta1.types.ListReusableConfigsResponse` + attributes are available on the pager. If multiple requests are made, only + the most recent response is retained, and thus used for attribute lookup. + """ + def __init__(self, + method: Callable[..., Awaitable[service.ListReusableConfigsResponse]], + request: service.ListReusableConfigsRequest, + response: service.ListReusableConfigsResponse, + *, + metadata: Sequence[Tuple[str, str]] = ()): + """Instantiates the pager. + + Args: + method (Callable): The method that was originally called, and + which instantiated this pager. + request (google.cloud.security.privateca_v1beta1.types.ListReusableConfigsRequest): + The initial request object. + response (google.cloud.security.privateca_v1beta1.types.ListReusableConfigsResponse): + The initial response object. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + """ + self._method = method + self._request = service.ListReusableConfigsRequest(request) + self._response = response + self._metadata = metadata + + def __getattr__(self, name: str) -> Any: + return getattr(self._response, name) + + @property + async def pages(self) -> AsyncIterator[service.ListReusableConfigsResponse]: + yield self._response + while self._response.next_page_token: + self._request.page_token = self._response.next_page_token + self._response = await self._method(self._request, metadata=self._metadata) + yield self._response + def __aiter__(self) -> AsyncIterator[resources.ReusableConfig]: + async def async_generator(): + async for page in self.pages: + for response in page.reusable_configs: + yield response + + return async_generator() + + def __repr__(self) -> str: + return '{0}<{1!r}>'.format(self.__class__.__name__, self._response) diff --git a/owl-bot-staging/v1beta1/google/cloud/security/privateca_v1beta1/services/certificate_authority_service/transports/__init__.py b/owl-bot-staging/v1beta1/google/cloud/security/privateca_v1beta1/services/certificate_authority_service/transports/__init__.py new file mode 100644 index 0000000..9564748 --- /dev/null +++ b/owl-bot-staging/v1beta1/google/cloud/security/privateca_v1beta1/services/certificate_authority_service/transports/__init__.py @@ -0,0 +1,33 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +from collections import OrderedDict +from typing import Dict, Type + +from .base import CertificateAuthorityServiceTransport +from .grpc import CertificateAuthorityServiceGrpcTransport +from .grpc_asyncio import CertificateAuthorityServiceGrpcAsyncIOTransport + + +# Compile a registry of transports. +_transport_registry = OrderedDict() # type: Dict[str, Type[CertificateAuthorityServiceTransport]] +_transport_registry['grpc'] = CertificateAuthorityServiceGrpcTransport +_transport_registry['grpc_asyncio'] = CertificateAuthorityServiceGrpcAsyncIOTransport + +__all__ = ( + 'CertificateAuthorityServiceTransport', + 'CertificateAuthorityServiceGrpcTransport', + 'CertificateAuthorityServiceGrpcAsyncIOTransport', +) diff --git a/owl-bot-staging/v1beta1/google/cloud/security/privateca_v1beta1/services/certificate_authority_service/transports/base.py b/owl-bot-staging/v1beta1/google/cloud/security/privateca_v1beta1/services/certificate_authority_service/transports/base.py new file mode 100644 index 0000000..a1f05ab --- /dev/null +++ b/owl-bot-staging/v1beta1/google/cloud/security/privateca_v1beta1/services/certificate_authority_service/transports/base.py @@ -0,0 +1,422 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +import abc +from typing import Awaitable, Callable, Dict, Optional, Sequence, Union + +from google.cloud.security.privateca_v1beta1 import gapic_version as package_version + +import google.auth # type: ignore +import google.api_core +from google.api_core import exceptions as core_exceptions +from google.api_core import gapic_v1 +from google.api_core import retry as retries +from google.api_core import operations_v1 +from google.auth import credentials as ga_credentials # type: ignore +from google.oauth2 import service_account # 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 # type: ignore + +DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo(gapic_version=package_version.__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 = DEFAULT_HOST, + credentials: Optional[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, + always_use_jwt_access: Optional[bool] = False, + api_audience: Optional[str] = None, + **kwargs, + ) -> None: + """Instantiate the transport. + + Args: + 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 + are specified, the client will attempt to ascertain the + credentials from the environment. + 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. + 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): + The client info used to send a user-agent string along with + API requests. If ``None``, then default info will be used. + Generally, you only need to set this if you're developing + your own client library. + always_use_jwt_access (Optional[bool]): Whether self signed JWT should + be used for service account credentials. + """ + + scopes_kwargs = {"scopes": scopes, "default_scopes": self.AUTH_SCOPES} + + # Save the scopes. + self._scopes = scopes + + # If no credentials are provided, then determine the appropriate + # defaults. + if credentials and credentials_file: + raise core_exceptions.DuplicateCredentialArgs("'credentials_file' and 'credentials' are mutually exclusive") + + if credentials_file is not None: + credentials, _ = google.auth.load_credentials_from_file( + credentials_file, + **scopes_kwargs, + quota_project_id=quota_project_id + ) + elif credentials is None: + credentials, _ = google.auth.default(**scopes_kwargs, quota_project_id=quota_project_id) + # Don't apply audience if the credentials file passed from user. + if hasattr(credentials, "with_gdch_audience"): + credentials = credentials.with_gdch_audience(api_audience if api_audience else host) + + # If the credentials are service account credentials, then always try to use self signed JWT. + if always_use_jwt_access and isinstance(credentials, service_account.Credentials) and hasattr(service_account.Credentials, "with_always_use_jwt_access"): + credentials = credentials.with_always_use_jwt_access(True) + + # Save the credentials. + self._credentials = credentials + + # Save the hostname. Default to port 443 (HTTPS) if none is specified. + if ':' not in host: + host += ':443' + self._host = host + + def _prep_wrapped_messages(self, client_info): + # Precompute the wrapped methods. + self._wrapped_methods = { + self.create_certificate: gapic_v1.method.wrap_method( + self.create_certificate, + default_timeout=None, + client_info=client_info, + ), + self.get_certificate: gapic_v1.method.wrap_method( + self.get_certificate, + default_timeout=None, + client_info=client_info, + ), + self.list_certificates: gapic_v1.method.wrap_method( + self.list_certificates, + default_timeout=None, + client_info=client_info, + ), + self.revoke_certificate: gapic_v1.method.wrap_method( + self.revoke_certificate, + default_timeout=None, + client_info=client_info, + ), + self.update_certificate: gapic_v1.method.wrap_method( + self.update_certificate, + default_timeout=None, + client_info=client_info, + ), + self.activate_certificate_authority: gapic_v1.method.wrap_method( + self.activate_certificate_authority, + default_timeout=None, + client_info=client_info, + ), + self.create_certificate_authority: gapic_v1.method.wrap_method( + self.create_certificate_authority, + default_timeout=None, + client_info=client_info, + ), + self.disable_certificate_authority: gapic_v1.method.wrap_method( + self.disable_certificate_authority, + default_timeout=None, + client_info=client_info, + ), + self.enable_certificate_authority: gapic_v1.method.wrap_method( + self.enable_certificate_authority, + default_timeout=None, + client_info=client_info, + ), + self.fetch_certificate_authority_csr: gapic_v1.method.wrap_method( + self.fetch_certificate_authority_csr, + default_timeout=None, + client_info=client_info, + ), + self.get_certificate_authority: gapic_v1.method.wrap_method( + self.get_certificate_authority, + default_timeout=None, + client_info=client_info, + ), + self.list_certificate_authorities: gapic_v1.method.wrap_method( + self.list_certificate_authorities, + default_timeout=None, + client_info=client_info, + ), + self.restore_certificate_authority: gapic_v1.method.wrap_method( + self.restore_certificate_authority, + default_timeout=None, + client_info=client_info, + ), + self.schedule_delete_certificate_authority: gapic_v1.method.wrap_method( + self.schedule_delete_certificate_authority, + default_timeout=None, + client_info=client_info, + ), + self.update_certificate_authority: gapic_v1.method.wrap_method( + self.update_certificate_authority, + default_timeout=None, + client_info=client_info, + ), + self.get_certificate_revocation_list: gapic_v1.method.wrap_method( + self.get_certificate_revocation_list, + default_timeout=None, + client_info=client_info, + ), + self.list_certificate_revocation_lists: gapic_v1.method.wrap_method( + self.list_certificate_revocation_lists, + default_timeout=None, + client_info=client_info, + ), + self.update_certificate_revocation_list: gapic_v1.method.wrap_method( + self.update_certificate_revocation_list, + default_timeout=None, + client_info=client_info, + ), + self.get_reusable_config: gapic_v1.method.wrap_method( + self.get_reusable_config, + default_timeout=None, + client_info=client_info, + ), + self.list_reusable_configs: gapic_v1.method.wrap_method( + self.list_reusable_configs, + default_timeout=None, + client_info=client_info, + ), + } + + def close(self): + """Closes resources associated with the transport. + + .. warning:: + Only call this method if the transport is NOT shared + with other clients - this may cause errors in other clients! + """ + raise NotImplementedError() + + @property + def operations_client(self): + """Return the client designed to process long-running operations.""" + raise NotImplementedError() + + @property + def create_certificate(self) -> Callable[ + [service.CreateCertificateRequest], + Union[ + resources.Certificate, + Awaitable[resources.Certificate] + ]]: + raise NotImplementedError() + + @property + def get_certificate(self) -> Callable[ + [service.GetCertificateRequest], + Union[ + resources.Certificate, + Awaitable[resources.Certificate] + ]]: + raise NotImplementedError() + + @property + def list_certificates(self) -> Callable[ + [service.ListCertificatesRequest], + Union[ + service.ListCertificatesResponse, + Awaitable[service.ListCertificatesResponse] + ]]: + raise NotImplementedError() + + @property + def revoke_certificate(self) -> Callable[ + [service.RevokeCertificateRequest], + Union[ + resources.Certificate, + Awaitable[resources.Certificate] + ]]: + raise NotImplementedError() + + @property + def update_certificate(self) -> Callable[ + [service.UpdateCertificateRequest], + Union[ + resources.Certificate, + Awaitable[resources.Certificate] + ]]: + raise NotImplementedError() + + @property + def activate_certificate_authority(self) -> Callable[ + [service.ActivateCertificateAuthorityRequest], + Union[ + operations_pb2.Operation, + Awaitable[operations_pb2.Operation] + ]]: + raise NotImplementedError() + + @property + def create_certificate_authority(self) -> Callable[ + [service.CreateCertificateAuthorityRequest], + Union[ + operations_pb2.Operation, + Awaitable[operations_pb2.Operation] + ]]: + raise NotImplementedError() + + @property + def disable_certificate_authority(self) -> Callable[ + [service.DisableCertificateAuthorityRequest], + Union[ + operations_pb2.Operation, + Awaitable[operations_pb2.Operation] + ]]: + raise NotImplementedError() + + @property + def enable_certificate_authority(self) -> Callable[ + [service.EnableCertificateAuthorityRequest], + Union[ + operations_pb2.Operation, + Awaitable[operations_pb2.Operation] + ]]: + raise NotImplementedError() + + @property + def fetch_certificate_authority_csr(self) -> Callable[ + [service.FetchCertificateAuthorityCsrRequest], + Union[ + service.FetchCertificateAuthorityCsrResponse, + Awaitable[service.FetchCertificateAuthorityCsrResponse] + ]]: + raise NotImplementedError() + + @property + def get_certificate_authority(self) -> Callable[ + [service.GetCertificateAuthorityRequest], + Union[ + resources.CertificateAuthority, + Awaitable[resources.CertificateAuthority] + ]]: + raise NotImplementedError() + + @property + def list_certificate_authorities(self) -> Callable[ + [service.ListCertificateAuthoritiesRequest], + Union[ + service.ListCertificateAuthoritiesResponse, + Awaitable[service.ListCertificateAuthoritiesResponse] + ]]: + raise NotImplementedError() + + @property + def restore_certificate_authority(self) -> Callable[ + [service.RestoreCertificateAuthorityRequest], + Union[ + operations_pb2.Operation, + Awaitable[operations_pb2.Operation] + ]]: + raise NotImplementedError() + + @property + def schedule_delete_certificate_authority(self) -> Callable[ + [service.ScheduleDeleteCertificateAuthorityRequest], + Union[ + operations_pb2.Operation, + Awaitable[operations_pb2.Operation] + ]]: + raise NotImplementedError() + + @property + def update_certificate_authority(self) -> Callable[ + [service.UpdateCertificateAuthorityRequest], + Union[ + operations_pb2.Operation, + Awaitable[operations_pb2.Operation] + ]]: + raise NotImplementedError() + + @property + def get_certificate_revocation_list(self) -> Callable[ + [service.GetCertificateRevocationListRequest], + Union[ + resources.CertificateRevocationList, + Awaitable[resources.CertificateRevocationList] + ]]: + raise NotImplementedError() + + @property + def list_certificate_revocation_lists(self) -> Callable[ + [service.ListCertificateRevocationListsRequest], + Union[ + service.ListCertificateRevocationListsResponse, + Awaitable[service.ListCertificateRevocationListsResponse] + ]]: + raise NotImplementedError() + + @property + def update_certificate_revocation_list(self) -> Callable[ + [service.UpdateCertificateRevocationListRequest], + Union[ + operations_pb2.Operation, + Awaitable[operations_pb2.Operation] + ]]: + raise NotImplementedError() + + @property + def get_reusable_config(self) -> Callable[ + [service.GetReusableConfigRequest], + Union[ + resources.ReusableConfig, + Awaitable[resources.ReusableConfig] + ]]: + raise NotImplementedError() + + @property + def list_reusable_configs(self) -> Callable[ + [service.ListReusableConfigsRequest], + Union[ + service.ListReusableConfigsResponse, + Awaitable[service.ListReusableConfigsResponse] + ]]: + raise NotImplementedError() + + @property + def kind(self) -> str: + raise NotImplementedError() + + +__all__ = ( + 'CertificateAuthorityServiceTransport', +) diff --git a/owl-bot-staging/v1beta1/google/cloud/security/privateca_v1beta1/services/certificate_authority_service/transports/grpc.py b/owl-bot-staging/v1beta1/google/cloud/security/privateca_v1beta1/services/certificate_authority_service/transports/grpc.py new file mode 100644 index 0000000..33cbca8 --- /dev/null +++ b/owl-bot-staging/v1beta1/google/cloud/security/privateca_v1beta1/services/certificate_authority_service/transports/grpc.py @@ -0,0 +1,830 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +import warnings +from typing import Callable, Dict, Optional, Sequence, Tuple, Union + +from google.api_core import grpc_helpers +from google.api_core import operations_v1 +from google.api_core import gapic_v1 +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 # type: ignore +from .base import CertificateAuthorityServiceTransport, DEFAULT_CLIENT_INFO + + +class CertificateAuthorityServiceGrpcTransport(CertificateAuthorityServiceTransport): + """gRPC backend transport for CertificateAuthorityService. + + [Certificate Authority + Service][google.cloud.security.privateca.v1beta1.CertificateAuthorityService] + manages private certificate authorities and issued certificates. + + This class defines the same methods as the primary client, so the + primary client can load the underlying transport implementation + and call it. + + It sends protocol buffers over the wire using gRPC (which is built on + top of HTTP/2); the ``grpcio`` package must be installed. + """ + _stubs: Dict[str, Callable] + + def __init__(self, *, + host: str = 'privateca.googleapis.com', + credentials: Optional[ga_credentials.Credentials] = None, + credentials_file: Optional[str] = None, + scopes: Optional[Sequence[str]] = None, + channel: Optional[grpc.Channel] = None, + api_mtls_endpoint: Optional[str] = None, + client_cert_source: Optional[Callable[[], Tuple[bytes, bytes]]] = None, + ssl_channel_credentials: Optional[grpc.ChannelCredentials] = None, + client_cert_source_for_mtls: Optional[Callable[[], Tuple[bytes, bytes]]] = None, + quota_project_id: Optional[str] = None, + client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, + always_use_jwt_access: Optional[bool] = False, + api_audience: Optional[str] = None, + ) -> None: + """Instantiate the transport. + + Args: + 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 + are specified, the client will attempt to ascertain the + credentials from the environment. + This argument is ignored if ``channel`` is provided. + credentials_file (Optional[str]): A file with credentials that can + be loaded with :func:`google.auth.load_credentials_from_file`. + This argument is ignored if ``channel`` is provided. + scopes (Optional(Sequence[str])): A list of scopes. This argument is + ignored if ``channel`` is provided. + channel (Optional[grpc.Channel]): A ``Channel`` instance through + which to make calls. + api_mtls_endpoint (Optional[str]): Deprecated. The mutual TLS endpoint. + If provided, it overrides the ``host`` argument and tries to create + a mutual TLS channel with client SSL credentials from + ``client_cert_source`` or application default SSL credentials. + client_cert_source (Optional[Callable[[], Tuple[bytes, bytes]]]): + Deprecated. A callback to provide client SSL certificate bytes and + private key bytes, both in PEM format. It is ignored if + ``api_mtls_endpoint`` is None. + ssl_channel_credentials (grpc.ChannelCredentials): SSL credentials + for the grpc channel. It is ignored if ``channel`` is provided. + client_cert_source_for_mtls (Optional[Callable[[], Tuple[bytes, bytes]]]): + A callback to provide client certificate bytes and private key bytes, + both in PEM format. It is used to configure a mutual TLS channel. It is + ignored if ``channel`` or ``ssl_channel_credentials`` is provided. + quota_project_id (Optional[str]): An optional project to use for billing + and quota. + client_info (google.api_core.gapic_v1.client_info.ClientInfo): + The client info used to send a user-agent string along with + API requests. If ``None``, then default info will be used. + Generally, you only need to set this if you're developing + your own client library. + always_use_jwt_access (Optional[bool]): Whether self signed JWT should + be used for service account credentials. + + Raises: + google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport + creation failed for any reason. + google.api_core.exceptions.DuplicateCredentialArgs: If both ``credentials`` + and ``credentials_file`` are passed. + """ + self._grpc_channel = None + self._ssl_channel_credentials = ssl_channel_credentials + self._stubs: Dict[str, Callable] = {} + self._operations_client: Optional[operations_v1.OperationsClient] = None + + if api_mtls_endpoint: + warnings.warn("api_mtls_endpoint is deprecated", DeprecationWarning) + if client_cert_source: + warnings.warn("client_cert_source is deprecated", DeprecationWarning) + + if channel: + # Ignore credentials if a channel was passed. + credentials = False + # 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 + + # Create SSL credentials with client_cert_source or application + # default SSL credentials. + if client_cert_source: + cert, key = client_cert_source() + self._ssl_channel_credentials = grpc.ssl_channel_credentials( + certificate_chain=cert, private_key=key + ) + else: + self._ssl_channel_credentials = SslCredentials().ssl_credentials + + else: + if client_cert_source_for_mtls and not ssl_channel_credentials: + cert, key = client_cert_source_for_mtls() + self._ssl_channel_credentials = grpc.ssl_channel_credentials( + certificate_chain=cert, private_key=key + ) + + # The base transport sets the host, credentials and scopes + super().__init__( + host=host, + credentials=credentials, + credentials_file=credentials_file, + scopes=scopes, + quota_project_id=quota_project_id, + client_info=client_info, + always_use_jwt_access=always_use_jwt_access, + api_audience=api_audience, + ) + + if not self._grpc_channel: + self._grpc_channel = type(self).create_channel( + self._host, + # use the credentials which are saved + credentials=self._credentials, + # Set ``credentials_file`` to ``None`` here as + # the credentials that we saved earlier should be used. + credentials_file=None, + scopes=self._scopes, + ssl_credentials=self._ssl_channel_credentials, + quota_project_id=quota_project_id, + options=[ + ("grpc.max_send_message_length", -1), + ("grpc.max_receive_message_length", -1), + ], + ) + + # Wrap messages. This must be done after self._grpc_channel exists + self._prep_wrapped_messages(client_info) + + @classmethod + def create_channel(cls, + host: str = 'privateca.googleapis.com', + credentials: Optional[ga_credentials.Credentials] = None, + credentials_file: Optional[str] = None, + scopes: Optional[Sequence[str]] = None, + quota_project_id: Optional[str] = None, + **kwargs) -> grpc.Channel: + """Create and return a gRPC channel object. + Args: + host (Optional[str]): The host for the channel to use. + credentials (Optional[~.Credentials]): The + authorization credentials to attach to requests. These + credentials identify this application to the service. If + none are specified, the client will attempt to ascertain + the credentials from the environment. + 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. + scopes (Optional[Sequence[str]]): A optional list of scopes needed for this + service. These are only used when credentials are not specified and + are passed to :func:`google.auth.default`. + quota_project_id (Optional[str]): An optional project to use for billing + and quota. + kwargs (Optional[dict]): Keyword arguments, which are passed to the + channel creation. + Returns: + grpc.Channel: A gRPC channel object. + + Raises: + google.api_core.exceptions.DuplicateCredentialArgs: If both ``credentials`` + and ``credentials_file`` are passed. + """ + + return grpc_helpers.create_channel( + host, + credentials=credentials, + credentials_file=credentials_file, + quota_project_id=quota_project_id, + default_scopes=cls.AUTH_SCOPES, + scopes=scopes, + default_host=cls.DEFAULT_HOST, + **kwargs + ) + + @property + def grpc_channel(self) -> grpc.Channel: + """Return the channel designed to connect to this service. + """ + return self._grpc_channel + + @property + def operations_client(self) -> operations_v1.OperationsClient: + """Create the client designed to process long-running operations. + + This property caches on the instance; repeated calls return the same + client. + """ + # Quick check: Only create a new client if we do not already have one. + if self._operations_client is None: + self._operations_client = operations_v1.OperationsClient( + self.grpc_channel + ) + + # Return the client from cache. + return self._operations_client + + @property + def create_certificate(self) -> Callable[ + [service.CreateCertificateRequest], + resources.Certificate]: + r"""Return a callable for the create certificate method over gRPC. + + Create a new + [Certificate][google.cloud.security.privateca.v1beta1.Certificate] + in a given Project, Location from a particular + [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority]. + + Returns: + Callable[[~.CreateCertificateRequest], + ~.Certificate]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if 'create_certificate' not in self._stubs: + self._stubs['create_certificate'] = self.grpc_channel.unary_unary( + '/google.cloud.security.privateca.v1beta1.CertificateAuthorityService/CreateCertificate', + request_serializer=service.CreateCertificateRequest.serialize, + response_deserializer=resources.Certificate.deserialize, + ) + return self._stubs['create_certificate'] + + @property + def get_certificate(self) -> Callable[ + [service.GetCertificateRequest], + resources.Certificate]: + r"""Return a callable for the get certificate method over gRPC. + + Returns a + [Certificate][google.cloud.security.privateca.v1beta1.Certificate]. + + Returns: + Callable[[~.GetCertificateRequest], + ~.Certificate]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if 'get_certificate' not in self._stubs: + self._stubs['get_certificate'] = self.grpc_channel.unary_unary( + '/google.cloud.security.privateca.v1beta1.CertificateAuthorityService/GetCertificate', + request_serializer=service.GetCertificateRequest.serialize, + response_deserializer=resources.Certificate.deserialize, + ) + return self._stubs['get_certificate'] + + @property + def list_certificates(self) -> Callable[ + [service.ListCertificatesRequest], + service.ListCertificatesResponse]: + r"""Return a callable for the list certificates method over gRPC. + + Lists + [Certificates][google.cloud.security.privateca.v1beta1.Certificate]. + + Returns: + Callable[[~.ListCertificatesRequest], + ~.ListCertificatesResponse]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if 'list_certificates' not in self._stubs: + self._stubs['list_certificates'] = self.grpc_channel.unary_unary( + '/google.cloud.security.privateca.v1beta1.CertificateAuthorityService/ListCertificates', + request_serializer=service.ListCertificatesRequest.serialize, + response_deserializer=service.ListCertificatesResponse.deserialize, + ) + return self._stubs['list_certificates'] + + @property + def revoke_certificate(self) -> Callable[ + [service.RevokeCertificateRequest], + resources.Certificate]: + r"""Return a callable for the revoke certificate method over gRPC. + + Revoke a + [Certificate][google.cloud.security.privateca.v1beta1.Certificate]. + + Returns: + Callable[[~.RevokeCertificateRequest], + ~.Certificate]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if 'revoke_certificate' not in self._stubs: + self._stubs['revoke_certificate'] = self.grpc_channel.unary_unary( + '/google.cloud.security.privateca.v1beta1.CertificateAuthorityService/RevokeCertificate', + request_serializer=service.RevokeCertificateRequest.serialize, + response_deserializer=resources.Certificate.deserialize, + ) + return self._stubs['revoke_certificate'] + + @property + def update_certificate(self) -> Callable[ + [service.UpdateCertificateRequest], + resources.Certificate]: + r"""Return a callable for the update certificate method over gRPC. + + Update a + [Certificate][google.cloud.security.privateca.v1beta1.Certificate]. + Currently, the only field you can update is the + [labels][google.cloud.security.privateca.v1beta1.Certificate.labels] + field. + + Returns: + Callable[[~.UpdateCertificateRequest], + ~.Certificate]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if 'update_certificate' not in self._stubs: + self._stubs['update_certificate'] = self.grpc_channel.unary_unary( + '/google.cloud.security.privateca.v1beta1.CertificateAuthorityService/UpdateCertificate', + request_serializer=service.UpdateCertificateRequest.serialize, + response_deserializer=resources.Certificate.deserialize, + ) + return self._stubs['update_certificate'] + + @property + def activate_certificate_authority(self) -> Callable[ + [service.ActivateCertificateAuthorityRequest], + operations_pb2.Operation]: + r"""Return a callable for the activate certificate authority method over gRPC. + + Activate a + [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority] + that is in state + [PENDING_ACTIVATION][google.cloud.security.privateca.v1beta1.CertificateAuthority.State.PENDING_ACTIVATION] + and is of type + [SUBORDINATE][google.cloud.security.privateca.v1beta1.CertificateAuthority.Type.SUBORDINATE]. + After the parent Certificate Authority signs a certificate + signing request from + [FetchCertificateAuthorityCsr][google.cloud.security.privateca.v1beta1.CertificateAuthorityService.FetchCertificateAuthorityCsr], + this method can complete the activation process. + + Returns: + Callable[[~.ActivateCertificateAuthorityRequest], + ~.Operation]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if 'activate_certificate_authority' not in self._stubs: + self._stubs['activate_certificate_authority'] = self.grpc_channel.unary_unary( + '/google.cloud.security.privateca.v1beta1.CertificateAuthorityService/ActivateCertificateAuthority', + request_serializer=service.ActivateCertificateAuthorityRequest.serialize, + response_deserializer=operations_pb2.Operation.FromString, + ) + return self._stubs['activate_certificate_authority'] + + @property + def create_certificate_authority(self) -> Callable[ + [service.CreateCertificateAuthorityRequest], + operations_pb2.Operation]: + r"""Return a callable for the create certificate authority method over gRPC. + + Create a new + [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority] + in a given Project and Location. + + Returns: + Callable[[~.CreateCertificateAuthorityRequest], + ~.Operation]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if 'create_certificate_authority' not in self._stubs: + 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_pb2.Operation.FromString, + ) + return self._stubs['create_certificate_authority'] + + @property + def disable_certificate_authority(self) -> Callable[ + [service.DisableCertificateAuthorityRequest], + operations_pb2.Operation]: + r"""Return a callable for the disable certificate authority method over gRPC. + + Disable a + [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority]. + + Returns: + Callable[[~.DisableCertificateAuthorityRequest], + ~.Operation]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if 'disable_certificate_authority' not in self._stubs: + self._stubs['disable_certificate_authority'] = self.grpc_channel.unary_unary( + '/google.cloud.security.privateca.v1beta1.CertificateAuthorityService/DisableCertificateAuthority', + request_serializer=service.DisableCertificateAuthorityRequest.serialize, + response_deserializer=operations_pb2.Operation.FromString, + ) + return self._stubs['disable_certificate_authority'] + + @property + def enable_certificate_authority(self) -> Callable[ + [service.EnableCertificateAuthorityRequest], + operations_pb2.Operation]: + r"""Return a callable for the enable certificate authority method over gRPC. + + Enable a + [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority]. + + Returns: + Callable[[~.EnableCertificateAuthorityRequest], + ~.Operation]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if 'enable_certificate_authority' not in self._stubs: + 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_pb2.Operation.FromString, + ) + return self._stubs['enable_certificate_authority'] + + @property + def fetch_certificate_authority_csr(self) -> Callable[ + [service.FetchCertificateAuthorityCsrRequest], + service.FetchCertificateAuthorityCsrResponse]: + r"""Return a callable for the fetch certificate authority + csr method over gRPC. + + Fetch a certificate signing request (CSR) from a + [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority] + that is in state + [PENDING_ACTIVATION][google.cloud.security.privateca.v1beta1.CertificateAuthority.State.PENDING_ACTIVATION] + and is of type + [SUBORDINATE][google.cloud.security.privateca.v1beta1.CertificateAuthority.Type.SUBORDINATE]. + The CSR must then be signed by the desired parent Certificate + Authority, which could be another + [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority] + resource, or could be an on-prem certificate authority. See also + [ActivateCertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthorityService.ActivateCertificateAuthority]. + + Returns: + Callable[[~.FetchCertificateAuthorityCsrRequest], + ~.FetchCertificateAuthorityCsrResponse]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if 'fetch_certificate_authority_csr' not in self._stubs: + self._stubs['fetch_certificate_authority_csr'] = self.grpc_channel.unary_unary( + '/google.cloud.security.privateca.v1beta1.CertificateAuthorityService/FetchCertificateAuthorityCsr', + request_serializer=service.FetchCertificateAuthorityCsrRequest.serialize, + response_deserializer=service.FetchCertificateAuthorityCsrResponse.deserialize, + ) + return self._stubs['fetch_certificate_authority_csr'] + + @property + def get_certificate_authority(self) -> Callable[ + [service.GetCertificateAuthorityRequest], + resources.CertificateAuthority]: + r"""Return a callable for the get certificate authority method over gRPC. + + Returns a + [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority]. + + Returns: + Callable[[~.GetCertificateAuthorityRequest], + ~.CertificateAuthority]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if 'get_certificate_authority' not in self._stubs: + self._stubs['get_certificate_authority'] = self.grpc_channel.unary_unary( + '/google.cloud.security.privateca.v1beta1.CertificateAuthorityService/GetCertificateAuthority', + request_serializer=service.GetCertificateAuthorityRequest.serialize, + response_deserializer=resources.CertificateAuthority.deserialize, + ) + return self._stubs['get_certificate_authority'] + + @property + def list_certificate_authorities(self) -> Callable[ + [service.ListCertificateAuthoritiesRequest], + service.ListCertificateAuthoritiesResponse]: + r"""Return a callable for the list certificate authorities method over gRPC. + + Lists + [CertificateAuthorities][google.cloud.security.privateca.v1beta1.CertificateAuthority]. + + Returns: + Callable[[~.ListCertificateAuthoritiesRequest], + ~.ListCertificateAuthoritiesResponse]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if 'list_certificate_authorities' not in self._stubs: + self._stubs['list_certificate_authorities'] = self.grpc_channel.unary_unary( + '/google.cloud.security.privateca.v1beta1.CertificateAuthorityService/ListCertificateAuthorities', + request_serializer=service.ListCertificateAuthoritiesRequest.serialize, + response_deserializer=service.ListCertificateAuthoritiesResponse.deserialize, + ) + return self._stubs['list_certificate_authorities'] + + @property + def restore_certificate_authority(self) -> Callable[ + [service.RestoreCertificateAuthorityRequest], + operations_pb2.Operation]: + r"""Return a callable for the restore certificate authority method over gRPC. + + Restore a + [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority] + that is scheduled for deletion. + + Returns: + Callable[[~.RestoreCertificateAuthorityRequest], + ~.Operation]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if 'restore_certificate_authority' not in self._stubs: + self._stubs['restore_certificate_authority'] = self.grpc_channel.unary_unary( + '/google.cloud.security.privateca.v1beta1.CertificateAuthorityService/RestoreCertificateAuthority', + request_serializer=service.RestoreCertificateAuthorityRequest.serialize, + response_deserializer=operations_pb2.Operation.FromString, + ) + return self._stubs['restore_certificate_authority'] + + @property + def schedule_delete_certificate_authority(self) -> Callable[ + [service.ScheduleDeleteCertificateAuthorityRequest], + operations_pb2.Operation]: + r"""Return a callable for the schedule delete certificate + authority method over gRPC. + + Schedule a + [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority] + for deletion. + + Returns: + Callable[[~.ScheduleDeleteCertificateAuthorityRequest], + ~.Operation]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if 'schedule_delete_certificate_authority' not in self._stubs: + self._stubs['schedule_delete_certificate_authority'] = self.grpc_channel.unary_unary( + '/google.cloud.security.privateca.v1beta1.CertificateAuthorityService/ScheduleDeleteCertificateAuthority', + request_serializer=service.ScheduleDeleteCertificateAuthorityRequest.serialize, + response_deserializer=operations_pb2.Operation.FromString, + ) + return self._stubs['schedule_delete_certificate_authority'] + + @property + def update_certificate_authority(self) -> Callable[ + [service.UpdateCertificateAuthorityRequest], + operations_pb2.Operation]: + r"""Return a callable for the update certificate authority method over gRPC. + + Update a + [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority]. + + Returns: + Callable[[~.UpdateCertificateAuthorityRequest], + ~.Operation]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if 'update_certificate_authority' not in self._stubs: + 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_pb2.Operation.FromString, + ) + return self._stubs['update_certificate_authority'] + + @property + def get_certificate_revocation_list(self) -> Callable[ + [service.GetCertificateRevocationListRequest], + resources.CertificateRevocationList]: + r"""Return a callable for the get certificate revocation + list method over gRPC. + + Returns a + [CertificateRevocationList][google.cloud.security.privateca.v1beta1.CertificateRevocationList]. + + Returns: + Callable[[~.GetCertificateRevocationListRequest], + ~.CertificateRevocationList]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if 'get_certificate_revocation_list' not in self._stubs: + self._stubs['get_certificate_revocation_list'] = self.grpc_channel.unary_unary( + '/google.cloud.security.privateca.v1beta1.CertificateAuthorityService/GetCertificateRevocationList', + request_serializer=service.GetCertificateRevocationListRequest.serialize, + response_deserializer=resources.CertificateRevocationList.deserialize, + ) + return self._stubs['get_certificate_revocation_list'] + + @property + def list_certificate_revocation_lists(self) -> Callable[ + [service.ListCertificateRevocationListsRequest], + service.ListCertificateRevocationListsResponse]: + r"""Return a callable for the list certificate revocation + lists method over gRPC. + + Lists + [CertificateRevocationLists][google.cloud.security.privateca.v1beta1.CertificateRevocationList]. + + Returns: + Callable[[~.ListCertificateRevocationListsRequest], + ~.ListCertificateRevocationListsResponse]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if 'list_certificate_revocation_lists' not in self._stubs: + self._stubs['list_certificate_revocation_lists'] = self.grpc_channel.unary_unary( + '/google.cloud.security.privateca.v1beta1.CertificateAuthorityService/ListCertificateRevocationLists', + request_serializer=service.ListCertificateRevocationListsRequest.serialize, + response_deserializer=service.ListCertificateRevocationListsResponse.deserialize, + ) + return self._stubs['list_certificate_revocation_lists'] + + @property + def update_certificate_revocation_list(self) -> Callable[ + [service.UpdateCertificateRevocationListRequest], + operations_pb2.Operation]: + r"""Return a callable for the update certificate revocation + list method over gRPC. + + Update a + [CertificateRevocationList][google.cloud.security.privateca.v1beta1.CertificateRevocationList]. + + Returns: + Callable[[~.UpdateCertificateRevocationListRequest], + ~.Operation]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if 'update_certificate_revocation_list' not in self._stubs: + self._stubs['update_certificate_revocation_list'] = self.grpc_channel.unary_unary( + '/google.cloud.security.privateca.v1beta1.CertificateAuthorityService/UpdateCertificateRevocationList', + request_serializer=service.UpdateCertificateRevocationListRequest.serialize, + response_deserializer=operations_pb2.Operation.FromString, + ) + return self._stubs['update_certificate_revocation_list'] + + @property + def get_reusable_config(self) -> Callable[ + [service.GetReusableConfigRequest], + resources.ReusableConfig]: + r"""Return a callable for the get reusable config method over gRPC. + + Returns a + [ReusableConfig][google.cloud.security.privateca.v1beta1.ReusableConfig]. + + Returns: + Callable[[~.GetReusableConfigRequest], + ~.ReusableConfig]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if 'get_reusable_config' not in self._stubs: + self._stubs['get_reusable_config'] = self.grpc_channel.unary_unary( + '/google.cloud.security.privateca.v1beta1.CertificateAuthorityService/GetReusableConfig', + request_serializer=service.GetReusableConfigRequest.serialize, + response_deserializer=resources.ReusableConfig.deserialize, + ) + return self._stubs['get_reusable_config'] + + @property + def list_reusable_configs(self) -> Callable[ + [service.ListReusableConfigsRequest], + service.ListReusableConfigsResponse]: + r"""Return a callable for the list reusable configs method over gRPC. + + Lists + [ReusableConfigs][google.cloud.security.privateca.v1beta1.ReusableConfig]. + + Returns: + Callable[[~.ListReusableConfigsRequest], + ~.ListReusableConfigsResponse]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if 'list_reusable_configs' not in self._stubs: + self._stubs['list_reusable_configs'] = self.grpc_channel.unary_unary( + '/google.cloud.security.privateca.v1beta1.CertificateAuthorityService/ListReusableConfigs', + request_serializer=service.ListReusableConfigsRequest.serialize, + response_deserializer=service.ListReusableConfigsResponse.deserialize, + ) + return self._stubs['list_reusable_configs'] + + def close(self): + self.grpc_channel.close() + + @property + def kind(self) -> str: + return "grpc" + + +__all__ = ( + 'CertificateAuthorityServiceGrpcTransport', +) diff --git a/owl-bot-staging/v1beta1/google/cloud/security/privateca_v1beta1/services/certificate_authority_service/transports/grpc_asyncio.py b/owl-bot-staging/v1beta1/google/cloud/security/privateca_v1beta1/services/certificate_authority_service/transports/grpc_asyncio.py new file mode 100644 index 0000000..521538c --- /dev/null +++ b/owl-bot-staging/v1beta1/google/cloud/security/privateca_v1beta1/services/certificate_authority_service/transports/grpc_asyncio.py @@ -0,0 +1,829 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +import warnings +from typing import Awaitable, Callable, Dict, Optional, Sequence, Tuple, Union + +from google.api_core import gapic_v1 +from google.api_core import grpc_helpers_async +from google.api_core import operations_v1 +from google.auth import credentials as ga_credentials # type: ignore +from google.auth.transport.grpc import SslCredentials # type: ignore + +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 # type: ignore +from .base import CertificateAuthorityServiceTransport, DEFAULT_CLIENT_INFO +from .grpc import CertificateAuthorityServiceGrpcTransport + + +class CertificateAuthorityServiceGrpcAsyncIOTransport(CertificateAuthorityServiceTransport): + """gRPC AsyncIO backend transport for CertificateAuthorityService. + + [Certificate Authority + Service][google.cloud.security.privateca.v1beta1.CertificateAuthorityService] + manages private certificate authorities and issued certificates. + + This class defines the same methods as the primary client, so the + primary client can load the underlying transport implementation + and call it. + + It sends protocol buffers over the wire using gRPC (which is built on + top of HTTP/2); the ``grpcio`` package must be installed. + """ + + _grpc_channel: aio.Channel + _stubs: Dict[str, Callable] = {} + + @classmethod + def create_channel(cls, + host: str = 'privateca.googleapis.com', + credentials: Optional[ga_credentials.Credentials] = None, + credentials_file: Optional[str] = None, + scopes: Optional[Sequence[str]] = None, + quota_project_id: Optional[str] = None, + **kwargs) -> aio.Channel: + """Create and return a gRPC AsyncIO channel object. + Args: + host (Optional[str]): The host for the channel to use. + credentials (Optional[~.Credentials]): The + authorization credentials to attach to requests. These + credentials identify this application to the service. If + none are specified, the client will attempt to ascertain + the credentials from the environment. + credentials_file (Optional[str]): A file with credentials that can + be loaded with :func:`google.auth.load_credentials_from_file`. + This argument is ignored if ``channel`` is provided. + scopes (Optional[Sequence[str]]): A optional list of scopes needed for this + service. These are only used when credentials are not specified and + are passed to :func:`google.auth.default`. + quota_project_id (Optional[str]): An optional project to use for billing + and quota. + kwargs (Optional[dict]): Keyword arguments, which are passed to the + channel creation. + Returns: + aio.Channel: A gRPC AsyncIO channel object. + """ + + return grpc_helpers_async.create_channel( + host, + credentials=credentials, + credentials_file=credentials_file, + quota_project_id=quota_project_id, + default_scopes=cls.AUTH_SCOPES, + scopes=scopes, + default_host=cls.DEFAULT_HOST, + **kwargs + ) + + def __init__(self, *, + host: str = 'privateca.googleapis.com', + credentials: Optional[ga_credentials.Credentials] = None, + credentials_file: Optional[str] = None, + scopes: Optional[Sequence[str]] = None, + channel: Optional[aio.Channel] = None, + api_mtls_endpoint: Optional[str] = None, + client_cert_source: Optional[Callable[[], Tuple[bytes, bytes]]] = None, + ssl_channel_credentials: Optional[grpc.ChannelCredentials] = None, + client_cert_source_for_mtls: Optional[Callable[[], Tuple[bytes, bytes]]] = None, + quota_project_id: Optional[str] = None, + client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, + always_use_jwt_access: Optional[bool] = False, + api_audience: Optional[str] = None, + ) -> None: + """Instantiate the transport. + + Args: + 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 + are specified, the client will attempt to ascertain the + credentials from the environment. + This argument is ignored if ``channel`` is provided. + credentials_file (Optional[str]): A file with credentials that can + be loaded with :func:`google.auth.load_credentials_from_file`. + This argument is ignored if ``channel`` is provided. + scopes (Optional[Sequence[str]]): A optional list of scopes needed for this + service. These are only used when credentials are not specified and + are passed to :func:`google.auth.default`. + channel (Optional[aio.Channel]): A ``Channel`` instance through + which to make calls. + api_mtls_endpoint (Optional[str]): Deprecated. The mutual TLS endpoint. + If provided, it overrides the ``host`` argument and tries to create + a mutual TLS channel with client SSL credentials from + ``client_cert_source`` or application default SSL credentials. + client_cert_source (Optional[Callable[[], Tuple[bytes, bytes]]]): + Deprecated. A callback to provide client SSL certificate bytes and + private key bytes, both in PEM format. It is ignored if + ``api_mtls_endpoint`` is None. + ssl_channel_credentials (grpc.ChannelCredentials): SSL credentials + for the grpc channel. It is ignored if ``channel`` is provided. + client_cert_source_for_mtls (Optional[Callable[[], Tuple[bytes, bytes]]]): + A callback to provide client certificate bytes and private key bytes, + both in PEM format. It is used to configure a mutual TLS channel. It is + ignored if ``channel`` or ``ssl_channel_credentials`` is provided. + quota_project_id (Optional[str]): An optional project to use for billing + and quota. + client_info (google.api_core.gapic_v1.client_info.ClientInfo): + The client info used to send a user-agent string along with + API requests. If ``None``, then default info will be used. + Generally, you only need to set this if you're developing + your own client library. + always_use_jwt_access (Optional[bool]): Whether self signed JWT should + be used for service account credentials. + + Raises: + google.auth.exceptions.MutualTlsChannelError: If mutual TLS transport + creation failed for any reason. + google.api_core.exceptions.DuplicateCredentialArgs: If both ``credentials`` + and ``credentials_file`` are passed. + """ + self._grpc_channel = None + self._ssl_channel_credentials = ssl_channel_credentials + self._stubs: Dict[str, Callable] = {} + self._operations_client: Optional[operations_v1.OperationsAsyncClient] = None + + if api_mtls_endpoint: + warnings.warn("api_mtls_endpoint is deprecated", DeprecationWarning) + if client_cert_source: + warnings.warn("client_cert_source is deprecated", DeprecationWarning) + + if channel: + # Ignore credentials if a channel was passed. + credentials = False + # 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 + + # Create SSL credentials with client_cert_source or application + # default SSL credentials. + if client_cert_source: + cert, key = client_cert_source() + self._ssl_channel_credentials = grpc.ssl_channel_credentials( + certificate_chain=cert, private_key=key + ) + else: + self._ssl_channel_credentials = SslCredentials().ssl_credentials + + else: + if client_cert_source_for_mtls and not ssl_channel_credentials: + cert, key = client_cert_source_for_mtls() + self._ssl_channel_credentials = grpc.ssl_channel_credentials( + certificate_chain=cert, private_key=key + ) + + # The base transport sets the host, credentials and scopes + super().__init__( + host=host, + credentials=credentials, + credentials_file=credentials_file, + scopes=scopes, + quota_project_id=quota_project_id, + client_info=client_info, + always_use_jwt_access=always_use_jwt_access, + api_audience=api_audience, + ) + + if not self._grpc_channel: + self._grpc_channel = type(self).create_channel( + self._host, + # use the credentials which are saved + credentials=self._credentials, + # Set ``credentials_file`` to ``None`` here as + # the credentials that we saved earlier should be used. + credentials_file=None, + scopes=self._scopes, + ssl_credentials=self._ssl_channel_credentials, + quota_project_id=quota_project_id, + options=[ + ("grpc.max_send_message_length", -1), + ("grpc.max_receive_message_length", -1), + ], + ) + + # Wrap messages. This must be done after self._grpc_channel exists + self._prep_wrapped_messages(client_info) + + @property + def grpc_channel(self) -> aio.Channel: + """Create the channel designed to connect to this service. + + This property caches on the instance; repeated calls return + the same channel. + """ + # Return the channel from cache. + return self._grpc_channel + + @property + def operations_client(self) -> operations_v1.OperationsAsyncClient: + """Create the client designed to process long-running operations. + + This property caches on the instance; repeated calls return the same + client. + """ + # Quick check: Only create a new client if we do not already have one. + if self._operations_client is None: + self._operations_client = operations_v1.OperationsAsyncClient( + self.grpc_channel + ) + + # Return the client from cache. + return self._operations_client + + @property + def create_certificate(self) -> Callable[ + [service.CreateCertificateRequest], + Awaitable[resources.Certificate]]: + r"""Return a callable for the create certificate method over gRPC. + + Create a new + [Certificate][google.cloud.security.privateca.v1beta1.Certificate] + in a given Project, Location from a particular + [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority]. + + Returns: + Callable[[~.CreateCertificateRequest], + Awaitable[~.Certificate]]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if 'create_certificate' not in self._stubs: + self._stubs['create_certificate'] = self.grpc_channel.unary_unary( + '/google.cloud.security.privateca.v1beta1.CertificateAuthorityService/CreateCertificate', + request_serializer=service.CreateCertificateRequest.serialize, + response_deserializer=resources.Certificate.deserialize, + ) + return self._stubs['create_certificate'] + + @property + def get_certificate(self) -> Callable[ + [service.GetCertificateRequest], + Awaitable[resources.Certificate]]: + r"""Return a callable for the get certificate method over gRPC. + + Returns a + [Certificate][google.cloud.security.privateca.v1beta1.Certificate]. + + Returns: + Callable[[~.GetCertificateRequest], + Awaitable[~.Certificate]]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if 'get_certificate' not in self._stubs: + self._stubs['get_certificate'] = self.grpc_channel.unary_unary( + '/google.cloud.security.privateca.v1beta1.CertificateAuthorityService/GetCertificate', + request_serializer=service.GetCertificateRequest.serialize, + response_deserializer=resources.Certificate.deserialize, + ) + return self._stubs['get_certificate'] + + @property + def list_certificates(self) -> Callable[ + [service.ListCertificatesRequest], + Awaitable[service.ListCertificatesResponse]]: + r"""Return a callable for the list certificates method over gRPC. + + Lists + [Certificates][google.cloud.security.privateca.v1beta1.Certificate]. + + Returns: + Callable[[~.ListCertificatesRequest], + Awaitable[~.ListCertificatesResponse]]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if 'list_certificates' not in self._stubs: + self._stubs['list_certificates'] = self.grpc_channel.unary_unary( + '/google.cloud.security.privateca.v1beta1.CertificateAuthorityService/ListCertificates', + request_serializer=service.ListCertificatesRequest.serialize, + response_deserializer=service.ListCertificatesResponse.deserialize, + ) + return self._stubs['list_certificates'] + + @property + def revoke_certificate(self) -> Callable[ + [service.RevokeCertificateRequest], + Awaitable[resources.Certificate]]: + r"""Return a callable for the revoke certificate method over gRPC. + + Revoke a + [Certificate][google.cloud.security.privateca.v1beta1.Certificate]. + + Returns: + Callable[[~.RevokeCertificateRequest], + Awaitable[~.Certificate]]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if 'revoke_certificate' not in self._stubs: + self._stubs['revoke_certificate'] = self.grpc_channel.unary_unary( + '/google.cloud.security.privateca.v1beta1.CertificateAuthorityService/RevokeCertificate', + request_serializer=service.RevokeCertificateRequest.serialize, + response_deserializer=resources.Certificate.deserialize, + ) + return self._stubs['revoke_certificate'] + + @property + def update_certificate(self) -> Callable[ + [service.UpdateCertificateRequest], + Awaitable[resources.Certificate]]: + r"""Return a callable for the update certificate method over gRPC. + + Update a + [Certificate][google.cloud.security.privateca.v1beta1.Certificate]. + Currently, the only field you can update is the + [labels][google.cloud.security.privateca.v1beta1.Certificate.labels] + field. + + Returns: + Callable[[~.UpdateCertificateRequest], + Awaitable[~.Certificate]]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if 'update_certificate' not in self._stubs: + self._stubs['update_certificate'] = self.grpc_channel.unary_unary( + '/google.cloud.security.privateca.v1beta1.CertificateAuthorityService/UpdateCertificate', + request_serializer=service.UpdateCertificateRequest.serialize, + response_deserializer=resources.Certificate.deserialize, + ) + return self._stubs['update_certificate'] + + @property + def activate_certificate_authority(self) -> Callable[ + [service.ActivateCertificateAuthorityRequest], + Awaitable[operations_pb2.Operation]]: + r"""Return a callable for the activate certificate authority method over gRPC. + + Activate a + [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority] + that is in state + [PENDING_ACTIVATION][google.cloud.security.privateca.v1beta1.CertificateAuthority.State.PENDING_ACTIVATION] + and is of type + [SUBORDINATE][google.cloud.security.privateca.v1beta1.CertificateAuthority.Type.SUBORDINATE]. + After the parent Certificate Authority signs a certificate + signing request from + [FetchCertificateAuthorityCsr][google.cloud.security.privateca.v1beta1.CertificateAuthorityService.FetchCertificateAuthorityCsr], + this method can complete the activation process. + + Returns: + Callable[[~.ActivateCertificateAuthorityRequest], + Awaitable[~.Operation]]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if 'activate_certificate_authority' not in self._stubs: + self._stubs['activate_certificate_authority'] = self.grpc_channel.unary_unary( + '/google.cloud.security.privateca.v1beta1.CertificateAuthorityService/ActivateCertificateAuthority', + request_serializer=service.ActivateCertificateAuthorityRequest.serialize, + response_deserializer=operations_pb2.Operation.FromString, + ) + return self._stubs['activate_certificate_authority'] + + @property + def create_certificate_authority(self) -> Callable[ + [service.CreateCertificateAuthorityRequest], + Awaitable[operations_pb2.Operation]]: + r"""Return a callable for the create certificate authority method over gRPC. + + Create a new + [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority] + in a given Project and Location. + + Returns: + Callable[[~.CreateCertificateAuthorityRequest], + Awaitable[~.Operation]]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if 'create_certificate_authority' not in self._stubs: + 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_pb2.Operation.FromString, + ) + return self._stubs['create_certificate_authority'] + + @property + def disable_certificate_authority(self) -> Callable[ + [service.DisableCertificateAuthorityRequest], + Awaitable[operations_pb2.Operation]]: + r"""Return a callable for the disable certificate authority method over gRPC. + + Disable a + [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority]. + + Returns: + Callable[[~.DisableCertificateAuthorityRequest], + Awaitable[~.Operation]]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if 'disable_certificate_authority' not in self._stubs: + self._stubs['disable_certificate_authority'] = self.grpc_channel.unary_unary( + '/google.cloud.security.privateca.v1beta1.CertificateAuthorityService/DisableCertificateAuthority', + request_serializer=service.DisableCertificateAuthorityRequest.serialize, + response_deserializer=operations_pb2.Operation.FromString, + ) + return self._stubs['disable_certificate_authority'] + + @property + def enable_certificate_authority(self) -> Callable[ + [service.EnableCertificateAuthorityRequest], + Awaitable[operations_pb2.Operation]]: + r"""Return a callable for the enable certificate authority method over gRPC. + + Enable a + [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority]. + + Returns: + Callable[[~.EnableCertificateAuthorityRequest], + Awaitable[~.Operation]]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if 'enable_certificate_authority' not in self._stubs: + 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_pb2.Operation.FromString, + ) + return self._stubs['enable_certificate_authority'] + + @property + def fetch_certificate_authority_csr(self) -> Callable[ + [service.FetchCertificateAuthorityCsrRequest], + Awaitable[service.FetchCertificateAuthorityCsrResponse]]: + r"""Return a callable for the fetch certificate authority + csr method over gRPC. + + Fetch a certificate signing request (CSR) from a + [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority] + that is in state + [PENDING_ACTIVATION][google.cloud.security.privateca.v1beta1.CertificateAuthority.State.PENDING_ACTIVATION] + and is of type + [SUBORDINATE][google.cloud.security.privateca.v1beta1.CertificateAuthority.Type.SUBORDINATE]. + The CSR must then be signed by the desired parent Certificate + Authority, which could be another + [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority] + resource, or could be an on-prem certificate authority. See also + [ActivateCertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthorityService.ActivateCertificateAuthority]. + + Returns: + Callable[[~.FetchCertificateAuthorityCsrRequest], + Awaitable[~.FetchCertificateAuthorityCsrResponse]]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if 'fetch_certificate_authority_csr' not in self._stubs: + self._stubs['fetch_certificate_authority_csr'] = self.grpc_channel.unary_unary( + '/google.cloud.security.privateca.v1beta1.CertificateAuthorityService/FetchCertificateAuthorityCsr', + request_serializer=service.FetchCertificateAuthorityCsrRequest.serialize, + response_deserializer=service.FetchCertificateAuthorityCsrResponse.deserialize, + ) + return self._stubs['fetch_certificate_authority_csr'] + + @property + def get_certificate_authority(self) -> Callable[ + [service.GetCertificateAuthorityRequest], + Awaitable[resources.CertificateAuthority]]: + r"""Return a callable for the get certificate authority method over gRPC. + + Returns a + [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority]. + + Returns: + Callable[[~.GetCertificateAuthorityRequest], + Awaitable[~.CertificateAuthority]]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if 'get_certificate_authority' not in self._stubs: + self._stubs['get_certificate_authority'] = self.grpc_channel.unary_unary( + '/google.cloud.security.privateca.v1beta1.CertificateAuthorityService/GetCertificateAuthority', + request_serializer=service.GetCertificateAuthorityRequest.serialize, + response_deserializer=resources.CertificateAuthority.deserialize, + ) + return self._stubs['get_certificate_authority'] + + @property + def list_certificate_authorities(self) -> Callable[ + [service.ListCertificateAuthoritiesRequest], + Awaitable[service.ListCertificateAuthoritiesResponse]]: + r"""Return a callable for the list certificate authorities method over gRPC. + + Lists + [CertificateAuthorities][google.cloud.security.privateca.v1beta1.CertificateAuthority]. + + Returns: + Callable[[~.ListCertificateAuthoritiesRequest], + Awaitable[~.ListCertificateAuthoritiesResponse]]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if 'list_certificate_authorities' not in self._stubs: + self._stubs['list_certificate_authorities'] = self.grpc_channel.unary_unary( + '/google.cloud.security.privateca.v1beta1.CertificateAuthorityService/ListCertificateAuthorities', + request_serializer=service.ListCertificateAuthoritiesRequest.serialize, + response_deserializer=service.ListCertificateAuthoritiesResponse.deserialize, + ) + return self._stubs['list_certificate_authorities'] + + @property + def restore_certificate_authority(self) -> Callable[ + [service.RestoreCertificateAuthorityRequest], + Awaitable[operations_pb2.Operation]]: + r"""Return a callable for the restore certificate authority method over gRPC. + + Restore a + [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority] + that is scheduled for deletion. + + Returns: + Callable[[~.RestoreCertificateAuthorityRequest], + Awaitable[~.Operation]]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if 'restore_certificate_authority' not in self._stubs: + self._stubs['restore_certificate_authority'] = self.grpc_channel.unary_unary( + '/google.cloud.security.privateca.v1beta1.CertificateAuthorityService/RestoreCertificateAuthority', + request_serializer=service.RestoreCertificateAuthorityRequest.serialize, + response_deserializer=operations_pb2.Operation.FromString, + ) + return self._stubs['restore_certificate_authority'] + + @property + def schedule_delete_certificate_authority(self) -> Callable[ + [service.ScheduleDeleteCertificateAuthorityRequest], + Awaitable[operations_pb2.Operation]]: + r"""Return a callable for the schedule delete certificate + authority method over gRPC. + + Schedule a + [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority] + for deletion. + + Returns: + Callable[[~.ScheduleDeleteCertificateAuthorityRequest], + Awaitable[~.Operation]]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if 'schedule_delete_certificate_authority' not in self._stubs: + self._stubs['schedule_delete_certificate_authority'] = self.grpc_channel.unary_unary( + '/google.cloud.security.privateca.v1beta1.CertificateAuthorityService/ScheduleDeleteCertificateAuthority', + request_serializer=service.ScheduleDeleteCertificateAuthorityRequest.serialize, + response_deserializer=operations_pb2.Operation.FromString, + ) + return self._stubs['schedule_delete_certificate_authority'] + + @property + def update_certificate_authority(self) -> Callable[ + [service.UpdateCertificateAuthorityRequest], + Awaitable[operations_pb2.Operation]]: + r"""Return a callable for the update certificate authority method over gRPC. + + Update a + [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority]. + + Returns: + Callable[[~.UpdateCertificateAuthorityRequest], + Awaitable[~.Operation]]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if 'update_certificate_authority' not in self._stubs: + 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_pb2.Operation.FromString, + ) + return self._stubs['update_certificate_authority'] + + @property + def get_certificate_revocation_list(self) -> Callable[ + [service.GetCertificateRevocationListRequest], + Awaitable[resources.CertificateRevocationList]]: + r"""Return a callable for the get certificate revocation + list method over gRPC. + + Returns a + [CertificateRevocationList][google.cloud.security.privateca.v1beta1.CertificateRevocationList]. + + Returns: + Callable[[~.GetCertificateRevocationListRequest], + Awaitable[~.CertificateRevocationList]]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if 'get_certificate_revocation_list' not in self._stubs: + self._stubs['get_certificate_revocation_list'] = self.grpc_channel.unary_unary( + '/google.cloud.security.privateca.v1beta1.CertificateAuthorityService/GetCertificateRevocationList', + request_serializer=service.GetCertificateRevocationListRequest.serialize, + response_deserializer=resources.CertificateRevocationList.deserialize, + ) + return self._stubs['get_certificate_revocation_list'] + + @property + def list_certificate_revocation_lists(self) -> Callable[ + [service.ListCertificateRevocationListsRequest], + Awaitable[service.ListCertificateRevocationListsResponse]]: + r"""Return a callable for the list certificate revocation + lists method over gRPC. + + Lists + [CertificateRevocationLists][google.cloud.security.privateca.v1beta1.CertificateRevocationList]. + + Returns: + Callable[[~.ListCertificateRevocationListsRequest], + Awaitable[~.ListCertificateRevocationListsResponse]]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if 'list_certificate_revocation_lists' not in self._stubs: + self._stubs['list_certificate_revocation_lists'] = self.grpc_channel.unary_unary( + '/google.cloud.security.privateca.v1beta1.CertificateAuthorityService/ListCertificateRevocationLists', + request_serializer=service.ListCertificateRevocationListsRequest.serialize, + response_deserializer=service.ListCertificateRevocationListsResponse.deserialize, + ) + return self._stubs['list_certificate_revocation_lists'] + + @property + def update_certificate_revocation_list(self) -> Callable[ + [service.UpdateCertificateRevocationListRequest], + Awaitable[operations_pb2.Operation]]: + r"""Return a callable for the update certificate revocation + list method over gRPC. + + Update a + [CertificateRevocationList][google.cloud.security.privateca.v1beta1.CertificateRevocationList]. + + Returns: + Callable[[~.UpdateCertificateRevocationListRequest], + Awaitable[~.Operation]]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if 'update_certificate_revocation_list' not in self._stubs: + self._stubs['update_certificate_revocation_list'] = self.grpc_channel.unary_unary( + '/google.cloud.security.privateca.v1beta1.CertificateAuthorityService/UpdateCertificateRevocationList', + request_serializer=service.UpdateCertificateRevocationListRequest.serialize, + response_deserializer=operations_pb2.Operation.FromString, + ) + return self._stubs['update_certificate_revocation_list'] + + @property + def get_reusable_config(self) -> Callable[ + [service.GetReusableConfigRequest], + Awaitable[resources.ReusableConfig]]: + r"""Return a callable for the get reusable config method over gRPC. + + Returns a + [ReusableConfig][google.cloud.security.privateca.v1beta1.ReusableConfig]. + + Returns: + Callable[[~.GetReusableConfigRequest], + Awaitable[~.ReusableConfig]]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if 'get_reusable_config' not in self._stubs: + self._stubs['get_reusable_config'] = self.grpc_channel.unary_unary( + '/google.cloud.security.privateca.v1beta1.CertificateAuthorityService/GetReusableConfig', + request_serializer=service.GetReusableConfigRequest.serialize, + response_deserializer=resources.ReusableConfig.deserialize, + ) + return self._stubs['get_reusable_config'] + + @property + def list_reusable_configs(self) -> Callable[ + [service.ListReusableConfigsRequest], + Awaitable[service.ListReusableConfigsResponse]]: + r"""Return a callable for the list reusable configs method over gRPC. + + Lists + [ReusableConfigs][google.cloud.security.privateca.v1beta1.ReusableConfig]. + + Returns: + Callable[[~.ListReusableConfigsRequest], + Awaitable[~.ListReusableConfigsResponse]]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if 'list_reusable_configs' not in self._stubs: + self._stubs['list_reusable_configs'] = self.grpc_channel.unary_unary( + '/google.cloud.security.privateca.v1beta1.CertificateAuthorityService/ListReusableConfigs', + request_serializer=service.ListReusableConfigsRequest.serialize, + response_deserializer=service.ListReusableConfigsResponse.deserialize, + ) + return self._stubs['list_reusable_configs'] + + def close(self): + return self.grpc_channel.close() + + +__all__ = ( + 'CertificateAuthorityServiceGrpcAsyncIOTransport', +) diff --git a/owl-bot-staging/v1beta1/google/cloud/security/privateca_v1beta1/types/__init__.py b/owl-bot-staging/v1beta1/google/cloud/security/privateca_v1beta1/types/__init__.py new file mode 100644 index 0000000..f12211a --- /dev/null +++ b/owl-bot-staging/v1beta1/google/cloud/security/privateca_v1beta1/types/__init__.py @@ -0,0 +1,106 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +from .resources import ( + Certificate, + CertificateAuthority, + CertificateConfig, + CertificateDescription, + CertificateRevocationList, + KeyUsage, + ObjectId, + PublicKey, + ReusableConfig, + ReusableConfigValues, + ReusableConfigWrapper, + Subject, + SubjectAltNames, + SubordinateConfig, + X509Extension, + RevocationReason, +) +from .service import ( + ActivateCertificateAuthorityRequest, + CreateCertificateAuthorityRequest, + CreateCertificateRequest, + DisableCertificateAuthorityRequest, + EnableCertificateAuthorityRequest, + FetchCertificateAuthorityCsrRequest, + FetchCertificateAuthorityCsrResponse, + GetCertificateAuthorityRequest, + GetCertificateRequest, + GetCertificateRevocationListRequest, + GetReusableConfigRequest, + ListCertificateAuthoritiesRequest, + ListCertificateAuthoritiesResponse, + ListCertificateRevocationListsRequest, + ListCertificateRevocationListsResponse, + ListCertificatesRequest, + ListCertificatesResponse, + ListReusableConfigsRequest, + ListReusableConfigsResponse, + OperationMetadata, + RestoreCertificateAuthorityRequest, + RevokeCertificateRequest, + ScheduleDeleteCertificateAuthorityRequest, + UpdateCertificateAuthorityRequest, + UpdateCertificateRequest, + UpdateCertificateRevocationListRequest, +) + +__all__ = ( + 'Certificate', + 'CertificateAuthority', + 'CertificateConfig', + 'CertificateDescription', + 'CertificateRevocationList', + 'KeyUsage', + 'ObjectId', + 'PublicKey', + 'ReusableConfig', + 'ReusableConfigValues', + 'ReusableConfigWrapper', + 'Subject', + 'SubjectAltNames', + 'SubordinateConfig', + 'X509Extension', + 'RevocationReason', + 'ActivateCertificateAuthorityRequest', + 'CreateCertificateAuthorityRequest', + 'CreateCertificateRequest', + 'DisableCertificateAuthorityRequest', + 'EnableCertificateAuthorityRequest', + 'FetchCertificateAuthorityCsrRequest', + 'FetchCertificateAuthorityCsrResponse', + 'GetCertificateAuthorityRequest', + 'GetCertificateRequest', + 'GetCertificateRevocationListRequest', + 'GetReusableConfigRequest', + 'ListCertificateAuthoritiesRequest', + 'ListCertificateAuthoritiesResponse', + 'ListCertificateRevocationListsRequest', + 'ListCertificateRevocationListsResponse', + 'ListCertificatesRequest', + 'ListCertificatesResponse', + 'ListReusableConfigsRequest', + 'ListReusableConfigsResponse', + 'OperationMetadata', + 'RestoreCertificateAuthorityRequest', + 'RevokeCertificateRequest', + 'ScheduleDeleteCertificateAuthorityRequest', + 'UpdateCertificateAuthorityRequest', + 'UpdateCertificateRequest', + 'UpdateCertificateRevocationListRequest', +) diff --git a/owl-bot-staging/v1beta1/google/cloud/security/privateca_v1beta1/types/resources.py b/owl-bot-staging/v1beta1/google/cloud/security/privateca_v1beta1/types/resources.py new file mode 100644 index 0000000..f314a6c --- /dev/null +++ b/owl-bot-staging/v1beta1/google/cloud/security/privateca_v1beta1/types/resources.py @@ -0,0 +1,1861 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +from typing import MutableMapping, MutableSequence + +import proto # 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( + package='google.cloud.security.privateca.v1beta1', + manifest={ + 'RevocationReason', + 'CertificateAuthority', + 'CertificateRevocationList', + 'Certificate', + 'ReusableConfig', + 'ReusableConfigValues', + 'ReusableConfigWrapper', + 'SubordinateConfig', + 'PublicKey', + 'CertificateConfig', + 'CertificateDescription', + 'ObjectId', + 'X509Extension', + 'KeyUsage', + 'Subject', + 'SubjectAltNames', + }, +) + + +class RevocationReason(proto.Enum): + r"""A + [RevocationReason][google.cloud.security.privateca.v1beta1.RevocationReason] + indicates whether a + [Certificate][google.cloud.security.privateca.v1beta1.Certificate] + has been revoked, and the reason for revocation. These correspond to + standard revocation reasons from RFC 5280. Note that the enum labels + and values in this definition are not the same ASN.1 values defined + in RFC 5280. These values will be translated to the correct ASN.1 + values when a CRL is created. + + Values: + REVOCATION_REASON_UNSPECIFIED (0): + Default unspecified value. This value does indicate that a + [Certificate][google.cloud.security.privateca.v1beta1.Certificate] + has been revoked, but that a reason has not been recorded. + KEY_COMPROMISE (1): + Key material for this + [Certificate][google.cloud.security.privateca.v1beta1.Certificate] + may have leaked. + CERTIFICATE_AUTHORITY_COMPROMISE (2): + The key material for a certificate authority + in the issuing path may have leaked. + AFFILIATION_CHANGED (3): + The subject or other attributes in this + [Certificate][google.cloud.security.privateca.v1beta1.Certificate] + have changed. + SUPERSEDED (4): + This + [Certificate][google.cloud.security.privateca.v1beta1.Certificate] + has been superseded. + CESSATION_OF_OPERATION (5): + This + [Certificate][google.cloud.security.privateca.v1beta1.Certificate] + or entities in the issuing path have ceased to operate. + CERTIFICATE_HOLD (6): + This + [Certificate][google.cloud.security.privateca.v1beta1.Certificate] + should not be considered valid, it is expected that it may + become valid in the future. + PRIVILEGE_WITHDRAWN (7): + This + [Certificate][google.cloud.security.privateca.v1beta1.Certificate] + no longer has permission to assert the listed attributes. + ATTRIBUTE_AUTHORITY_COMPROMISE (8): + The authority which determines appropriate attributes for a + [Certificate][google.cloud.security.privateca.v1beta1.Certificate] + may have been compromised. + """ + REVOCATION_REASON_UNSPECIFIED = 0 + KEY_COMPROMISE = 1 + CERTIFICATE_AUTHORITY_COMPROMISE = 2 + AFFILIATION_CHANGED = 3 + SUPERSEDED = 4 + CESSATION_OF_OPERATION = 5 + CERTIFICATE_HOLD = 6 + PRIVILEGE_WITHDRAWN = 7 + ATTRIBUTE_AUTHORITY_COMPROMISE = 8 + + +class CertificateAuthority(proto.Message): + r"""A + [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority] + represents an individual Certificate Authority. A + [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority] + can be used to create + [Certificates][google.cloud.security.privateca.v1beta1.Certificate]. + + Attributes: + name (str): + Output only. The resource name for this + [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority] + in the format + ``projects/*/locations/*/certificateAuthorities/*``. + type_ (google.cloud.security.privateca_v1beta1.types.CertificateAuthority.Type): + Required. Immutable. The + [Type][google.cloud.security.privateca.v1beta1.CertificateAuthority.Type] + of this + [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority]. + tier (google.cloud.security.privateca_v1beta1.types.CertificateAuthority.Tier): + Required. Immutable. The + [Tier][google.cloud.security.privateca.v1beta1.CertificateAuthority.Tier] + of this + [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority]. + config (google.cloud.security.privateca_v1beta1.types.CertificateConfig): + Required. Immutable. The config used to + create a self-signed X.509 certificate or CSR. + lifetime (google.protobuf.duration_pb2.Duration): + Required. The desired lifetime of the CA certificate. Used + to create the "not_before_time" and "not_after_time" fields + inside an X.509 certificate. + key_spec (google.cloud.security.privateca_v1beta1.types.CertificateAuthority.KeyVersionSpec): + Required. Immutable. Used when issuing certificates for this + [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority]. + If this + [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority] + is a self-signed CertificateAuthority, this key is also used + to sign the self-signed CA certificate. Otherwise, it is + used to sign a CSR. + certificate_policy (google.cloud.security.privateca_v1beta1.types.CertificateAuthority.CertificateAuthorityPolicy): + Optional. The + [CertificateAuthorityPolicy][google.cloud.security.privateca.v1beta1.CertificateAuthority.CertificateAuthorityPolicy] + to enforce when issuing + [Certificates][google.cloud.security.privateca.v1beta1.Certificate] + from this + [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority]. + issuing_options (google.cloud.security.privateca_v1beta1.types.CertificateAuthority.IssuingOptions): + Optional. The + [IssuingOptions][google.cloud.security.privateca.v1beta1.CertificateAuthority.IssuingOptions] + to follow when issuing + [Certificates][google.cloud.security.privateca.v1beta1.Certificate] + from this + [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority]. + subordinate_config (google.cloud.security.privateca_v1beta1.types.SubordinateConfig): + Optional. If this is a subordinate + [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority], + this field will be set with the subordinate configuration, + which describes its issuers. This may be updated, but this + [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority] + must continue to validate. + state (google.cloud.security.privateca_v1beta1.types.CertificateAuthority.State): + Output only. The + [State][google.cloud.security.privateca.v1beta1.CertificateAuthority.State] + for this + [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority]. + pem_ca_certificates (MutableSequence[str]): + Output only. This + [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority]'s + certificate chain, including the current + [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority]'s + certificate. Ordered such that the root issuer is the final + element (consistent with RFC 5246). For a self-signed CA, + this will only list the current + [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority]'s + certificate. + ca_certificate_descriptions (MutableSequence[google.cloud.security.privateca_v1beta1.types.CertificateDescription]): + Output only. A structured description of this + [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority]'s + CA certificate and its issuers. Ordered as self-to-root. + gcs_bucket (str): + Immutable. The name of a Cloud Storage bucket where this + [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority] + will publish content, such as the CA certificate and CRLs. + This must be a bucket name, without any prefixes (such as + ``gs://``) or suffixes (such as ``.googleapis.com``). For + example, to use a bucket named ``my-bucket``, you would + simply specify ``my-bucket``. If not specified, a managed + bucket will be created. + access_urls (google.cloud.security.privateca_v1beta1.types.CertificateAuthority.AccessUrls): + Output only. URLs for accessing content + published by this CA, such as the CA certificate + and CRLs. + create_time (google.protobuf.timestamp_pb2.Timestamp): + Output only. The time at which this + [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority] + was created. + update_time (google.protobuf.timestamp_pb2.Timestamp): + Output only. The time at which this + [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority] + was updated. + delete_time (google.protobuf.timestamp_pb2.Timestamp): + Output only. The time at which this + [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority] + will be deleted, if scheduled for deletion. + labels (MutableMapping[str, str]): + Optional. Labels with user-defined metadata. + """ + class Type(proto.Enum): + r"""The type of a + [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority], + indicating its issuing chain. + + Values: + TYPE_UNSPECIFIED (0): + Not specified. + SELF_SIGNED (1): + Self-signed CA. + SUBORDINATE (2): + Subordinate CA. Could be issued by a Private CA + [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority] + or an unmanaged CA. + """ + TYPE_UNSPECIFIED = 0 + SELF_SIGNED = 1 + SUBORDINATE = 2 + + class Tier(proto.Enum): + r"""The tier of a + [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority], + indicating its supported functionality and/or billing SKU. + + Values: + TIER_UNSPECIFIED (0): + Not specified. + ENTERPRISE (1): + Enterprise tier. + DEVOPS (2): + DevOps tier. + """ + TIER_UNSPECIFIED = 0 + ENTERPRISE = 1 + DEVOPS = 2 + + class State(proto.Enum): + r"""The state of a + [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority], + indicating if it can be used. + + Values: + STATE_UNSPECIFIED (0): + Not specified. + ENABLED (1): + Certificates can be issued from this CA. CRLs + will be generated for this CA. + DISABLED (2): + Certificates cannot be issued from this CA. + CRLs will still be generated. + PENDING_ACTIVATION (3): + Certificates cannot be issued from this CA. + CRLs will not be generated. + PENDING_DELETION (4): + Certificates cannot be issued from this CA. + CRLs will not be generated. + """ + STATE_UNSPECIFIED = 0 + ENABLED = 1 + DISABLED = 2 + PENDING_ACTIVATION = 3 + PENDING_DELETION = 4 + + class SignHashAlgorithm(proto.Enum): + r"""The algorithm of a Cloud KMS CryptoKeyVersion of a + [CryptoKey][google.cloud.kms.v1.CryptoKey] with the + [CryptoKeyPurpose][google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose] + value ``ASYMMETRIC_SIGN``. These values correspond to the + [CryptoKeyVersionAlgorithm][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionAlgorithm] + values. For RSA signing algorithms, the PSS algorithms should be + preferred, use PKCS1 algorithms if required for compatibility. For + further recommandations, see + https://cloud.google.com/kms/docs/algorithms#algorithm_recommendations. + + Values: + SIGN_HASH_ALGORITHM_UNSPECIFIED (0): + Not specified. + RSA_PSS_2048_SHA256 (1): + maps to CryptoKeyVersionAlgorithm.RSA_SIGN_PSS_2048_SHA256 + RSA_PSS_3072_SHA256 (2): + maps to CryptoKeyVersionAlgorithm. RSA_SIGN_PSS_3072_SHA256 + RSA_PSS_4096_SHA256 (3): + maps to CryptoKeyVersionAlgorithm.RSA_SIGN_PSS_4096_SHA256 + RSA_PKCS1_2048_SHA256 (6): + maps to CryptoKeyVersionAlgorithm.RSA_SIGN_PKCS1_2048_SHA256 + RSA_PKCS1_3072_SHA256 (7): + maps to CryptoKeyVersionAlgorithm.RSA_SIGN_PKCS1_3072_SHA256 + RSA_PKCS1_4096_SHA256 (8): + maps to CryptoKeyVersionAlgorithm.RSA_SIGN_PKCS1_4096_SHA256 + EC_P256_SHA256 (4): + maps to CryptoKeyVersionAlgorithm.EC_SIGN_P256_SHA256 + EC_P384_SHA384 (5): + maps to CryptoKeyVersionAlgorithm.EC_SIGN_P384_SHA384 + """ + SIGN_HASH_ALGORITHM_UNSPECIFIED = 0 + RSA_PSS_2048_SHA256 = 1 + RSA_PSS_3072_SHA256 = 2 + RSA_PSS_4096_SHA256 = 3 + RSA_PKCS1_2048_SHA256 = 6 + RSA_PKCS1_3072_SHA256 = 7 + RSA_PKCS1_4096_SHA256 = 8 + EC_P256_SHA256 = 4 + EC_P384_SHA384 = 5 + + class IssuingOptions(proto.Message): + r"""Options that affect all certificates issued by a + [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority]. + + Attributes: + include_ca_cert_url (bool): + Required. When true, includes a URL to the + issuing CA certificate in the "authority + information access" X.509 extension. + include_crl_access_url (bool): + Required. When true, includes a URL to the CRL corresponding + to certificates issued from a + [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority]. + CRLs will expire 7 days from their creation. However, we + will rebuild daily. CRLs are also rebuilt shortly after a + certificate is revoked. + """ + + include_ca_cert_url: bool = proto.Field( + proto.BOOL, + number=1, + ) + include_crl_access_url: bool = proto.Field( + proto.BOOL, + number=2, + ) + + class CertificateAuthorityPolicy(proto.Message): + r"""The issuing policy for a + [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority]. + [Certificates][google.cloud.security.privateca.v1beta1.Certificate] + will not be successfully issued from this + [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority] + if they violate the policy. + + This message has `oneof`_ fields (mutually exclusive fields). + For each oneof, at most one member field can be set at the same time. + Setting any member of the oneof automatically clears all other + members. + + .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields + + Attributes: + allowed_config_list (google.cloud.security.privateca_v1beta1.types.CertificateAuthority.CertificateAuthorityPolicy.AllowedConfigList): + Optional. All + [Certificates][google.cloud.security.privateca.v1beta1.Certificate] + issued by the + [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority] + must match at least one listed + [ReusableConfigWrapper][google.cloud.security.privateca.v1beta1.ReusableConfigWrapper] + in the list. + + This field is a member of `oneof`_ ``config_policy``. + overwrite_config_values (google.cloud.security.privateca_v1beta1.types.ReusableConfigWrapper): + Optional. All + [Certificates][google.cloud.security.privateca.v1beta1.Certificate] + issued by the + [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority] + will use the provided configuration values, overwriting any + requested configuration values. + + This field is a member of `oneof`_ ``config_policy``. + allowed_locations_and_organizations (MutableSequence[google.cloud.security.privateca_v1beta1.types.Subject]): + Optional. If any + [Subject][google.cloud.security.privateca.v1beta1.Subject] + is specified here, then all + [Certificates][google.cloud.security.privateca.v1beta1.Certificate] + issued by the + [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority] + must match at least one listed + [Subject][google.cloud.security.privateca.v1beta1.Subject]. + If a + [Subject][google.cloud.security.privateca.v1beta1.Subject] + has an empty field, any value will be allowed for that + field. + allowed_common_names (MutableSequence[str]): + Optional. If any value is specified here, then all + [Certificates][google.cloud.security.privateca.v1beta1.Certificate] + issued by the + [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority] + must match at least one listed value. If no value is + specified, all values will be allowed for this fied. Glob + patterns are also supported. + allowed_sans (google.cloud.security.privateca_v1beta1.types.CertificateAuthority.CertificateAuthorityPolicy.AllowedSubjectAltNames): + Optional. If a + [AllowedSubjectAltNames][google.cloud.security.privateca.v1beta1.CertificateAuthority.CertificateAuthorityPolicy.AllowedSubjectAltNames] + is specified here, then all + [Certificates][google.cloud.security.privateca.v1beta1.Certificate] + issued by the + [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority] + must match + [AllowedSubjectAltNames][google.cloud.security.privateca.v1beta1.CertificateAuthority.CertificateAuthorityPolicy.AllowedSubjectAltNames]. + If no value or an empty value is specified, any value will + be allowed for the + [SubjectAltNames][google.cloud.security.privateca.v1beta1.SubjectAltNames] + field. + maximum_lifetime (google.protobuf.duration_pb2.Duration): + Optional. The maximum lifetime allowed by the + [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority]. + Note that if the any part if the issuing chain expires + before a + [Certificate][google.cloud.security.privateca.v1beta1.Certificate]'s + requested maximum_lifetime, the effective lifetime will be + explicitly truncated. + allowed_issuance_modes (google.cloud.security.privateca_v1beta1.types.CertificateAuthority.CertificateAuthorityPolicy.IssuanceModes): + Optional. If specified, then only methods allowed in the + [IssuanceModes][google.cloud.security.privateca.v1beta1.CertificateAuthority.CertificateAuthorityPolicy.IssuanceModes] + may be used to issue + [Certificates][google.cloud.security.privateca.v1beta1.Certificate]. + """ + + class AllowedConfigList(proto.Message): + r""" + + Attributes: + allowed_config_values (MutableSequence[google.cloud.security.privateca_v1beta1.types.ReusableConfigWrapper]): + Required. All + [Certificates][google.cloud.security.privateca.v1beta1.Certificate] + issued by the + [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority] + must match at least one listed + [ReusableConfigWrapper][google.cloud.security.privateca.v1beta1.ReusableConfigWrapper]. + If a + [ReusableConfigWrapper][google.cloud.security.privateca.v1beta1.ReusableConfigWrapper] + has an empty field, any value will be allowed for that + field. + """ + + allowed_config_values: MutableSequence['ReusableConfigWrapper'] = proto.RepeatedField( + proto.MESSAGE, + number=1, + message='ReusableConfigWrapper', + ) + + class AllowedSubjectAltNames(proto.Message): + r"""[AllowedSubjectAltNames][google.cloud.security.privateca.v1beta1.CertificateAuthority.CertificateAuthorityPolicy.AllowedSubjectAltNames] + specifies the allowed values for + [SubjectAltNames][google.cloud.security.privateca.v1beta1.SubjectAltNames] + by the + [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority] + when issuing + [Certificates][google.cloud.security.privateca.v1beta1.Certificate]. + + Attributes: + allowed_dns_names (MutableSequence[str]): + Optional. Contains valid, fully-qualified host names. Glob + patterns are also supported. To allow an explicit wildcard + certificate, escape with backlash (i.e. ``\*``). E.g. for + globbed entries: ``*bar.com`` will allow ``foo.bar.com``, + but not ``*.bar.com``, unless the + [allow_globbing_dns_wildcards][google.cloud.security.privateca.v1beta1.CertificateAuthority.CertificateAuthorityPolicy.AllowedSubjectAltNames.allow_globbing_dns_wildcards] + field is set. E.g. for wildcard entries: ``\*.bar.com`` will + allow ``*.bar.com``, but not ``foo.bar.com``. + allowed_uris (MutableSequence[str]): + Optional. Contains valid RFC 3986 URIs. Glob patterns are + also supported. To match across path seperators (i.e. '/') + use the double star glob pattern (i.e. '**'). + allowed_email_addresses (MutableSequence[str]): + Optional. Contains valid RFC 2822 E-mail + addresses. Glob patterns are also supported. + allowed_ips (MutableSequence[str]): + Optional. Contains valid 32-bit IPv4 + addresses and subnet ranges or RFC 4291 IPv6 + addresses and subnet ranges. Subnet ranges are + specified using the '/' notation (e.g. + 10.0.0.0/8, 2001:700:300:1800::/64). Glob + patterns are supported only for ip address + entries (i.e. not for subnet ranges). + allow_globbing_dns_wildcards (bool): + Optional. Specifies if glob patterns used for + [allowed_dns_names][google.cloud.security.privateca.v1beta1.CertificateAuthority.CertificateAuthorityPolicy.AllowedSubjectAltNames.allowed_dns_names] + allows wildcard certificates. + allow_custom_sans (bool): + Optional. Specifies if to allow custom + X509Extension values. + """ + + allowed_dns_names: MutableSequence[str] = proto.RepeatedField( + proto.STRING, + number=1, + ) + allowed_uris: MutableSequence[str] = proto.RepeatedField( + proto.STRING, + number=2, + ) + allowed_email_addresses: MutableSequence[str] = proto.RepeatedField( + proto.STRING, + number=3, + ) + allowed_ips: MutableSequence[str] = proto.RepeatedField( + proto.STRING, + number=4, + ) + allow_globbing_dns_wildcards: bool = proto.Field( + proto.BOOL, + number=5, + ) + allow_custom_sans: bool = proto.Field( + proto.BOOL, + number=6, + ) + + class IssuanceModes(proto.Message): + r"""[IssuanceModes][google.cloud.security.privateca.v1beta1.CertificateAuthority.CertificateAuthorityPolicy.IssuanceModes] + specifies the allowed ways in which + [Certificates][google.cloud.security.privateca.v1beta1.Certificate] + may be requested from this + [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority]. + + Attributes: + allow_csr_based_issuance (bool): + Required. When true, allows callers to create + [Certificates][google.cloud.security.privateca.v1beta1.Certificate] + by specifying a CSR. + allow_config_based_issuance (bool): + Required. When true, allows callers to create + [Certificates][google.cloud.security.privateca.v1beta1.Certificate] + by specifying a + [CertificateConfig][google.cloud.security.privateca.v1beta1.CertificateConfig]. + """ + + allow_csr_based_issuance: bool = proto.Field( + proto.BOOL, + number=1, + ) + allow_config_based_issuance: bool = proto.Field( + proto.BOOL, + number=2, + ) + + allowed_config_list: 'CertificateAuthority.CertificateAuthorityPolicy.AllowedConfigList' = proto.Field( + proto.MESSAGE, + number=1, + oneof='config_policy', + message='CertificateAuthority.CertificateAuthorityPolicy.AllowedConfigList', + ) + overwrite_config_values: 'ReusableConfigWrapper' = proto.Field( + proto.MESSAGE, + number=2, + oneof='config_policy', + message='ReusableConfigWrapper', + ) + allowed_locations_and_organizations: MutableSequence['Subject'] = proto.RepeatedField( + proto.MESSAGE, + number=3, + message='Subject', + ) + allowed_common_names: MutableSequence[str] = proto.RepeatedField( + proto.STRING, + number=4, + ) + allowed_sans: 'CertificateAuthority.CertificateAuthorityPolicy.AllowedSubjectAltNames' = proto.Field( + proto.MESSAGE, + number=5, + message='CertificateAuthority.CertificateAuthorityPolicy.AllowedSubjectAltNames', + ) + maximum_lifetime: duration_pb2.Duration = proto.Field( + proto.MESSAGE, + number=6, + message=duration_pb2.Duration, + ) + allowed_issuance_modes: 'CertificateAuthority.CertificateAuthorityPolicy.IssuanceModes' = proto.Field( + proto.MESSAGE, + number=8, + message='CertificateAuthority.CertificateAuthorityPolicy.IssuanceModes', + ) + + class AccessUrls(proto.Message): + r"""URLs where a + [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority] + will publish content. + + Attributes: + ca_certificate_access_url (str): + The URL where this + [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority]'s + CA certificate is published. This will only be set for CAs + that have been activated. + crl_access_url (str): + The URL where this + [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority]'s + CRLs are published. This will only be set for CAs that have + been activated. + """ + + ca_certificate_access_url: str = proto.Field( + proto.STRING, + number=1, + ) + crl_access_url: str = proto.Field( + proto.STRING, + number=2, + ) + + class KeyVersionSpec(proto.Message): + r"""A Cloud KMS key configuration that a + [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority] + will use. + + This message has `oneof`_ fields (mutually exclusive fields). + For each oneof, at most one member field can be set at the same time. + Setting any member of the oneof automatically clears all other + members. + + .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields + + Attributes: + cloud_kms_key_version (str): + Required. The resource name for an existing Cloud KMS + CryptoKeyVersion in the format + ``projects/*/locations/*/keyRings/*/cryptoKeys/*/cryptoKeyVersions/*``. + This option enables full flexibility in the key's + capabilities and properties. + + This field is a member of `oneof`_ ``KeyVersion``. + algorithm (google.cloud.security.privateca_v1beta1.types.CertificateAuthority.SignHashAlgorithm): + Required. The algorithm to use for creating a managed Cloud + KMS key for a for a simplified experience. All managed keys + will be have their + [ProtectionLevel][google.cloud.kms.v1.ProtectionLevel] as + ``HSM``. + + This field is a member of `oneof`_ ``KeyVersion``. + """ + + cloud_kms_key_version: str = proto.Field( + proto.STRING, + number=1, + oneof='KeyVersion', + ) + algorithm: 'CertificateAuthority.SignHashAlgorithm' = proto.Field( + proto.ENUM, + number=2, + oneof='KeyVersion', + enum='CertificateAuthority.SignHashAlgorithm', + ) + + name: str = proto.Field( + proto.STRING, + number=1, + ) + type_: Type = proto.Field( + proto.ENUM, + number=2, + enum=Type, + ) + tier: Tier = proto.Field( + proto.ENUM, + number=3, + enum=Tier, + ) + config: 'CertificateConfig' = proto.Field( + proto.MESSAGE, + number=4, + message='CertificateConfig', + ) + lifetime: duration_pb2.Duration = proto.Field( + proto.MESSAGE, + number=5, + message=duration_pb2.Duration, + ) + key_spec: KeyVersionSpec = proto.Field( + proto.MESSAGE, + number=6, + message=KeyVersionSpec, + ) + certificate_policy: CertificateAuthorityPolicy = proto.Field( + proto.MESSAGE, + number=7, + message=CertificateAuthorityPolicy, + ) + issuing_options: IssuingOptions = proto.Field( + proto.MESSAGE, + number=8, + message=IssuingOptions, + ) + subordinate_config: 'SubordinateConfig' = proto.Field( + proto.MESSAGE, + number=19, + message='SubordinateConfig', + ) + state: State = proto.Field( + proto.ENUM, + number=10, + enum=State, + ) + pem_ca_certificates: MutableSequence[str] = proto.RepeatedField( + proto.STRING, + number=9, + ) + ca_certificate_descriptions: MutableSequence['CertificateDescription'] = proto.RepeatedField( + proto.MESSAGE, + number=12, + message='CertificateDescription', + ) + gcs_bucket: str = proto.Field( + proto.STRING, + number=13, + ) + access_urls: AccessUrls = proto.Field( + proto.MESSAGE, + number=14, + message=AccessUrls, + ) + create_time: timestamp_pb2.Timestamp = proto.Field( + proto.MESSAGE, + number=15, + message=timestamp_pb2.Timestamp, + ) + update_time: timestamp_pb2.Timestamp = proto.Field( + proto.MESSAGE, + number=16, + message=timestamp_pb2.Timestamp, + ) + delete_time: timestamp_pb2.Timestamp = proto.Field( + proto.MESSAGE, + number=17, + message=timestamp_pb2.Timestamp, + ) + labels: MutableMapping[str, str] = proto.MapField( + proto.STRING, + proto.STRING, + number=18, + ) + + +class CertificateRevocationList(proto.Message): + r"""A + [CertificateRevocationList][google.cloud.security.privateca.v1beta1.CertificateRevocationList] + corresponds to a signed X.509 certificate Revocation List (CRL). A + CRL contains the serial numbers of certificates that should no + longer be trusted. + + Attributes: + name (str): + Output only. The resource path for this + [CertificateRevocationList][google.cloud.security.privateca.v1beta1.CertificateRevocationList] + in the format + ``projects/*/locations/*/certificateAuthorities/*/ certificateRevocationLists/*``. + sequence_number (int): + Output only. The CRL sequence number that appears in + pem_crl. + revoked_certificates (MutableSequence[google.cloud.security.privateca_v1beta1.types.CertificateRevocationList.RevokedCertificate]): + Output only. The revoked serial numbers that appear in + pem_crl. + pem_crl (str): + Output only. The PEM-encoded X.509 CRL. + access_url (str): + Output only. The location where 'pem_crl' can be accessed. + state (google.cloud.security.privateca_v1beta1.types.CertificateRevocationList.State): + Output only. The + [State][google.cloud.security.privateca.v1beta1.CertificateRevocationList.State] + for this + [CertificateRevocationList][google.cloud.security.privateca.v1beta1.CertificateRevocationList]. + create_time (google.protobuf.timestamp_pb2.Timestamp): + Output only. The time at which this + [CertificateRevocationList][google.cloud.security.privateca.v1beta1.CertificateRevocationList] + was created. + update_time (google.protobuf.timestamp_pb2.Timestamp): + Output only. The time at which this + [CertificateRevocationList][google.cloud.security.privateca.v1beta1.CertificateRevocationList] + was updated. + labels (MutableMapping[str, str]): + Optional. Labels with user-defined metadata. + """ + class State(proto.Enum): + r"""The state of a + [CertificateRevocationList][google.cloud.security.privateca.v1beta1.CertificateRevocationList], + indicating if it is current. + + Values: + STATE_UNSPECIFIED (0): + Not specified. + ACTIVE (1): + The + [CertificateRevocationList][google.cloud.security.privateca.v1beta1.CertificateRevocationList] + is up to date. + SUPERSEDED (2): + The + [CertificateRevocationList][google.cloud.security.privateca.v1beta1.CertificateRevocationList] + is no longer current. + """ + STATE_UNSPECIFIED = 0 + ACTIVE = 1 + SUPERSEDED = 2 + + class RevokedCertificate(proto.Message): + r"""Describes a revoked + [Certificate][google.cloud.security.privateca.v1beta1.Certificate]. + + Attributes: + certificate (str): + The resource path for the + [Certificate][google.cloud.security.privateca.v1beta1.Certificate] + in the format + ``projects/*/locations/*/certificateAuthorities/*/certificates/*``. + hex_serial_number (str): + The serial number of the + [Certificate][google.cloud.security.privateca.v1beta1.Certificate]. + revocation_reason (google.cloud.security.privateca_v1beta1.types.RevocationReason): + The reason the + [Certificate][google.cloud.security.privateca.v1beta1.Certificate] + was revoked. + """ + + certificate: str = proto.Field( + proto.STRING, + number=1, + ) + hex_serial_number: str = proto.Field( + proto.STRING, + number=2, + ) + revocation_reason: 'RevocationReason' = proto.Field( + proto.ENUM, + number=3, + enum='RevocationReason', + ) + + name: str = proto.Field( + proto.STRING, + number=1, + ) + sequence_number: int = proto.Field( + proto.INT64, + number=2, + ) + revoked_certificates: MutableSequence[RevokedCertificate] = proto.RepeatedField( + proto.MESSAGE, + number=3, + message=RevokedCertificate, + ) + pem_crl: str = proto.Field( + proto.STRING, + number=4, + ) + access_url: str = proto.Field( + proto.STRING, + number=5, + ) + state: State = proto.Field( + proto.ENUM, + number=6, + enum=State, + ) + create_time: timestamp_pb2.Timestamp = proto.Field( + proto.MESSAGE, + number=7, + message=timestamp_pb2.Timestamp, + ) + update_time: timestamp_pb2.Timestamp = proto.Field( + proto.MESSAGE, + number=8, + message=timestamp_pb2.Timestamp, + ) + labels: MutableMapping[str, str] = proto.MapField( + proto.STRING, + proto.STRING, + number=9, + ) + + +class Certificate(proto.Message): + r"""A [Certificate][google.cloud.security.privateca.v1beta1.Certificate] + corresponds to a signed X.509 certificate issued by a + [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority]. + + This message has `oneof`_ fields (mutually exclusive fields). + For each oneof, at most one member field can be set at the same time. + Setting any member of the oneof automatically clears all other + members. + + .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields + + Attributes: + name (str): + Output only. The resource path for this + [Certificate][google.cloud.security.privateca.v1beta1.Certificate] + in the format + ``projects/*/locations/*/certificateAuthorities/*/certificates/*``. + pem_csr (str): + Immutable. A pem-encoded X.509 certificate + signing request (CSR). + + This field is a member of `oneof`_ ``certificate_config``. + config (google.cloud.security.privateca_v1beta1.types.CertificateConfig): + Immutable. A description of the certificate + and key that does not require X.509 or ASN.1. + + This field is a member of `oneof`_ ``certificate_config``. + lifetime (google.protobuf.duration_pb2.Duration): + Required. Immutable. The desired lifetime of a certificate. + Used to create the "not_before_time" and "not_after_time" + fields inside an X.509 certificate. Note that the lifetime + may be truncated if it would extend past the life of any + certificate authority in the issuing chain. + revocation_details (google.cloud.security.privateca_v1beta1.types.Certificate.RevocationDetails): + Output only. Details regarding the revocation of this + [Certificate][google.cloud.security.privateca.v1beta1.Certificate]. + This + [Certificate][google.cloud.security.privateca.v1beta1.Certificate] + is considered revoked if and only if this field is present. + pem_certificate (str): + Output only. The pem-encoded, signed X.509 + certificate. + certificate_description (google.cloud.security.privateca_v1beta1.types.CertificateDescription): + Output only. A structured description of the + issued X.509 certificate. + pem_certificate_chain (MutableSequence[str]): + Output only. The chain that may be used to + verify the X.509 certificate. Expected to be in + issuer-to-root order according to RFC 5246. + create_time (google.protobuf.timestamp_pb2.Timestamp): + Output only. The time at which this + [Certificate][google.cloud.security.privateca.v1beta1.Certificate] + was created. + update_time (google.protobuf.timestamp_pb2.Timestamp): + Output only. The time at which this + [Certificate][google.cloud.security.privateca.v1beta1.Certificate] + was updated. + labels (MutableMapping[str, str]): + Optional. Labels with user-defined metadata. + """ + + class RevocationDetails(proto.Message): + r"""Describes fields that are relavent to the revocation of a + [Certificate][google.cloud.security.privateca.v1beta1.Certificate]. + + Attributes: + revocation_state (google.cloud.security.privateca_v1beta1.types.RevocationReason): + Indicates why a + [Certificate][google.cloud.security.privateca.v1beta1.Certificate] + was revoked. + revocation_time (google.protobuf.timestamp_pb2.Timestamp): + The time at which this + [Certificate][google.cloud.security.privateca.v1beta1.Certificate] + was revoked. + """ + + revocation_state: 'RevocationReason' = proto.Field( + proto.ENUM, + number=1, + enum='RevocationReason', + ) + revocation_time: timestamp_pb2.Timestamp = proto.Field( + proto.MESSAGE, + number=2, + message=timestamp_pb2.Timestamp, + ) + + name: str = proto.Field( + proto.STRING, + number=1, + ) + pem_csr: str = proto.Field( + proto.STRING, + number=2, + oneof='certificate_config', + ) + config: 'CertificateConfig' = proto.Field( + proto.MESSAGE, + number=3, + oneof='certificate_config', + message='CertificateConfig', + ) + lifetime: duration_pb2.Duration = proto.Field( + proto.MESSAGE, + number=4, + message=duration_pb2.Duration, + ) + revocation_details: RevocationDetails = proto.Field( + proto.MESSAGE, + number=5, + message=RevocationDetails, + ) + pem_certificate: str = proto.Field( + proto.STRING, + number=6, + ) + certificate_description: 'CertificateDescription' = proto.Field( + proto.MESSAGE, + number=7, + message='CertificateDescription', + ) + pem_certificate_chain: MutableSequence[str] = proto.RepeatedField( + proto.STRING, + number=8, + ) + create_time: timestamp_pb2.Timestamp = proto.Field( + proto.MESSAGE, + number=9, + message=timestamp_pb2.Timestamp, + ) + update_time: timestamp_pb2.Timestamp = proto.Field( + proto.MESSAGE, + number=10, + message=timestamp_pb2.Timestamp, + ) + labels: MutableMapping[str, str] = proto.MapField( + proto.STRING, + proto.STRING, + number=11, + ) + + +class ReusableConfig(proto.Message): + r"""A + [ReusableConfig][google.cloud.security.privateca.v1beta1.ReusableConfig] + refers to a managed + [ReusableConfigValues][google.cloud.security.privateca.v1beta1.ReusableConfigValues]. + Those, in turn, are used to describe certain fields of an X.509 + certificate, such as the key usage fields, fields specific to CA + certificates, certificate policy extensions and custom extensions. + + Attributes: + name (str): + Output only. The resource path for this + [ReusableConfig][google.cloud.security.privateca.v1beta1.ReusableConfig] + in the format ``projects/*/locations/*/reusableConfigs/*``. + values (google.cloud.security.privateca_v1beta1.types.ReusableConfigValues): + Required. The config values. + description (str): + Optional. A human-readable description of + scenarios these ReusableConfigValues may be + compatible with. + create_time (google.protobuf.timestamp_pb2.Timestamp): + Output only. The time at which this + [ReusableConfig][google.cloud.security.privateca.v1beta1.ReusableConfig] + was created. + update_time (google.protobuf.timestamp_pb2.Timestamp): + Output only. The time at which this + [ReusableConfig][google.cloud.security.privateca.v1beta1.ReusableConfig] + was updated. + labels (MutableMapping[str, str]): + Optional. Labels with user-defined metadata. + """ + + name: str = proto.Field( + proto.STRING, + number=1, + ) + values: 'ReusableConfigValues' = proto.Field( + proto.MESSAGE, + number=2, + message='ReusableConfigValues', + ) + description: str = proto.Field( + proto.STRING, + number=3, + ) + create_time: timestamp_pb2.Timestamp = proto.Field( + proto.MESSAGE, + number=4, + message=timestamp_pb2.Timestamp, + ) + update_time: timestamp_pb2.Timestamp = proto.Field( + proto.MESSAGE, + number=5, + message=timestamp_pb2.Timestamp, + ) + labels: MutableMapping[str, str] = proto.MapField( + proto.STRING, + proto.STRING, + number=6, + ) + + +class ReusableConfigValues(proto.Message): + r"""A + [ReusableConfigValues][google.cloud.security.privateca.v1beta1.ReusableConfigValues] + is used to describe certain fields of an X.509 certificate, such as + the key usage fields, fields specific to CA certificates, + certificate policy extensions and custom extensions. + + Attributes: + key_usage (google.cloud.security.privateca_v1beta1.types.KeyUsage): + Optional. Indicates the intended use for keys + that correspond to a certificate. + ca_options (google.cloud.security.privateca_v1beta1.types.ReusableConfigValues.CaOptions): + Optional. Describes options in this + [ReusableConfigValues][google.cloud.security.privateca.v1beta1.ReusableConfigValues] + that are relevant in a CA certificate. + policy_ids (MutableSequence[google.cloud.security.privateca_v1beta1.types.ObjectId]): + Optional. Describes the X.509 certificate + policy object identifiers, per + https://tools.ietf.org/html/rfc5280#section-4.2.1.4. + aia_ocsp_servers (MutableSequence[str]): + Optional. Describes Online Certificate Status + Protocol (OCSP) endpoint addresses that appear + in the "Authority Information Access" extension + in the certificate. + additional_extensions (MutableSequence[google.cloud.security.privateca_v1beta1.types.X509Extension]): + Optional. Describes custom X.509 extensions. + """ + + 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, + which is a boolean value. When this value is + missing, the extension will be omitted from the + CA certificate. + max_issuer_path_length (google.protobuf.wrappers_pb2.Int32Value): + Optional. Refers to the path length + restriction X.509 extension. For a CA + certificate, this value describes the depth of + subordinate CA certificates that are allowed. + If this value is less than 0, the request will + fail. If this value is missing, the max path + length will be omitted from the CA certificate. + """ + + is_ca: wrappers_pb2.BoolValue = proto.Field( + proto.MESSAGE, + number=1, + message=wrappers_pb2.BoolValue, + ) + max_issuer_path_length: wrappers_pb2.Int32Value = proto.Field( + proto.MESSAGE, + number=2, + message=wrappers_pb2.Int32Value, + ) + + key_usage: 'KeyUsage' = proto.Field( + proto.MESSAGE, + number=1, + message='KeyUsage', + ) + ca_options: CaOptions = proto.Field( + proto.MESSAGE, + number=2, + message=CaOptions, + ) + policy_ids: MutableSequence['ObjectId'] = proto.RepeatedField( + proto.MESSAGE, + number=3, + message='ObjectId', + ) + aia_ocsp_servers: MutableSequence[str] = proto.RepeatedField( + proto.STRING, + number=4, + ) + additional_extensions: MutableSequence['X509Extension'] = proto.RepeatedField( + proto.MESSAGE, + number=5, + message='X509Extension', + ) + + +class ReusableConfigWrapper(proto.Message): + r"""A + [ReusableConfigWrapper][google.cloud.security.privateca.v1beta1.ReusableConfigWrapper] + describes values that may assist in creating an X.509 certificate, + or a reference to a pre-defined set of values. + + This message has `oneof`_ fields (mutually exclusive fields). + For each oneof, at most one member field can be set at the same time. + Setting any member of the oneof automatically clears all other + members. + + .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields + + Attributes: + reusable_config (str): + Required. A resource path to a + [ReusableConfig][google.cloud.security.privateca.v1beta1.ReusableConfig] + in the format ``projects/*/locations/*/reusableConfigs/*``. + + This field is a member of `oneof`_ ``config_values``. + reusable_config_values (google.cloud.security.privateca_v1beta1.types.ReusableConfigValues): + Required. A user-specified inline + [ReusableConfigValues][google.cloud.security.privateca.v1beta1.ReusableConfigValues]. + + This field is a member of `oneof`_ ``config_values``. + """ + + reusable_config: str = proto.Field( + proto.STRING, + number=1, + oneof='config_values', + ) + reusable_config_values: 'ReusableConfigValues' = proto.Field( + proto.MESSAGE, + number=2, + oneof='config_values', + message='ReusableConfigValues', + ) + + +class SubordinateConfig(proto.Message): + r"""Describes a subordinate CA's issuers. This is either a resource path + to a known issuing + [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority], + or a PEM issuer certificate chain. + + This message has `oneof`_ fields (mutually exclusive fields). + For each oneof, at most one member field can be set at the same time. + Setting any member of the oneof automatically clears all other + members. + + .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields + + Attributes: + certificate_authority (str): + Required. This can refer to a + [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority] + in the same project that was used to create a subordinate + [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority]. + This field is used for information and usability purposes + only. The resource name is in the format + ``projects/*/locations/*/certificateAuthorities/*``. + + This field is a member of `oneof`_ ``subordinate_config``. + pem_issuer_chain (google.cloud.security.privateca_v1beta1.types.SubordinateConfig.SubordinateConfigChain): + Required. Contains the PEM certificate chain for the issuers + of this + [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority], + but not pem certificate for this CA itself. + + This field is a member of `oneof`_ ``subordinate_config``. + """ + + class SubordinateConfigChain(proto.Message): + r"""This message describes a subordinate CA's issuer certificate + chain. This wrapper exists for compatibility reasons. + + Attributes: + pem_certificates (MutableSequence[str]): + Required. Expected to be in leaf-to-root + order according to RFC 5246. + """ + + pem_certificates: MutableSequence[str] = proto.RepeatedField( + proto.STRING, + number=1, + ) + + certificate_authority: str = proto.Field( + proto.STRING, + number=1, + oneof='subordinate_config', + ) + pem_issuer_chain: SubordinateConfigChain = proto.Field( + proto.MESSAGE, + number=2, + oneof='subordinate_config', + message=SubordinateConfigChain, + ) + + +class PublicKey(proto.Message): + r"""A [PublicKey][google.cloud.security.privateca.v1beta1.PublicKey] + describes a public key. + + Attributes: + type_ (google.cloud.security.privateca_v1beta1.types.PublicKey.KeyType): + Required. The type of public key. + key (bytes): + Required. A public key. Padding and encoding + varies by 'KeyType' and is described along with + the KeyType values. + """ + class KeyType(proto.Enum): + r"""Types of public keys that are supported. At a minimum, we support + RSA and ECDSA, for the key sizes or curves listed: + https://cloud.google.com/kms/docs/algorithms#asymmetric_signing_algorithms + + Values: + KEY_TYPE_UNSPECIFIED (0): + Default unspecified value. + PEM_RSA_KEY (1): + A PEM-encoded PKCS#1/RFC 3447 RSAPrivateKey + structure. + PEM_EC_KEY (2): + A PEM-encoded compressed NIST + P-256/secp256r1/prime256v1 or P-384 key. + """ + KEY_TYPE_UNSPECIFIED = 0 + PEM_RSA_KEY = 1 + PEM_EC_KEY = 2 + + type_: KeyType = proto.Field( + proto.ENUM, + number=1, + enum=KeyType, + ) + key: bytes = proto.Field( + proto.BYTES, + number=2, + ) + + +class CertificateConfig(proto.Message): + r"""A + [CertificateConfig][google.cloud.security.privateca.v1beta1.CertificateConfig] + describes an X.509 certificate or CSR that is to be created, as an + alternative to using ASN.1. + + Attributes: + subject_config (google.cloud.security.privateca_v1beta1.types.CertificateConfig.SubjectConfig): + Required. Specifies some of the values in a + certificate that are related to the subject. + reusable_config (google.cloud.security.privateca_v1beta1.types.ReusableConfigWrapper): + Required. Describes how some of the technical + fields in a certificate should be populated. + public_key (google.cloud.security.privateca_v1beta1.types.PublicKey): + Optional. The public key that corresponds to this config. + This is, for example, used when issuing + [Certificates][google.cloud.security.privateca.v1beta1.Certificate], + but not when creating a self-signed + [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority] + or + [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority] + CSR. + """ + + class SubjectConfig(proto.Message): + r"""These values are used to create the distinguished name and + subject alternative name fields in an X.509 certificate. + + Attributes: + subject (google.cloud.security.privateca_v1beta1.types.Subject): + Required. Contains distinguished name fields + such as the location and organization. + common_name (str): + Optional. The "common name" of the + distinguished name. + subject_alt_name (google.cloud.security.privateca_v1beta1.types.SubjectAltNames): + Optional. The subject alternative name + fields. + """ + + subject: 'Subject' = proto.Field( + proto.MESSAGE, + number=1, + message='Subject', + ) + common_name: str = proto.Field( + proto.STRING, + number=2, + ) + subject_alt_name: 'SubjectAltNames' = proto.Field( + proto.MESSAGE, + number=3, + message='SubjectAltNames', + ) + + subject_config: SubjectConfig = proto.Field( + proto.MESSAGE, + number=1, + message=SubjectConfig, + ) + reusable_config: 'ReusableConfigWrapper' = proto.Field( + proto.MESSAGE, + number=2, + message='ReusableConfigWrapper', + ) + public_key: 'PublicKey' = proto.Field( + proto.MESSAGE, + number=3, + message='PublicKey', + ) + + +class CertificateDescription(proto.Message): + r"""A + [CertificateDescription][google.cloud.security.privateca.v1beta1.CertificateDescription] + describes an X.509 certificate or CSR that has been issued, as an + alternative to using ASN.1 / X.509. + + Attributes: + subject_description (google.cloud.security.privateca_v1beta1.types.CertificateDescription.SubjectDescription): + Describes some of the values in a certificate + that are related to the subject and lifetime. + config_values (google.cloud.security.privateca_v1beta1.types.ReusableConfigValues): + Describes some of the technical fields in a + certificate. + public_key (google.cloud.security.privateca_v1beta1.types.PublicKey): + The public key that corresponds to an issued + certificate. + subject_key_id (google.cloud.security.privateca_v1beta1.types.CertificateDescription.KeyId): + Provides a means of identifiying certificates + that contain a particular public key, per + https://tools.ietf.org/html/rfc5280#section-4.2.1.2. + authority_key_id (google.cloud.security.privateca_v1beta1.types.CertificateDescription.KeyId): + Identifies the subject_key_id of the parent certificate, per + https://tools.ietf.org/html/rfc5280#section-4.2.1.1 + crl_distribution_points (MutableSequence[str]): + Describes a list of locations to obtain CRL + information, i.e. the DistributionPoint.fullName + described by + https://tools.ietf.org/html/rfc5280#section-4.2.1.13 + aia_issuing_certificate_urls (MutableSequence[str]): + Describes lists of issuer CA certificate URLs + that appear in the "Authority Information + Access" extension in the certificate. + cert_fingerprint (google.cloud.security.privateca_v1beta1.types.CertificateDescription.CertificateFingerprint): + The hash of the x.509 certificate. + """ + + class SubjectDescription(proto.Message): + r"""These values describe fields in an issued X.509 certificate + such as the distinguished name, subject alternative names, + serial number, and lifetime. + + Attributes: + subject (google.cloud.security.privateca_v1beta1.types.Subject): + Contains distinguished name fields such as + the location and organization. + common_name (str): + The "common name" of the distinguished name. + subject_alt_name (google.cloud.security.privateca_v1beta1.types.SubjectAltNames): + The subject alternative name fields. + hex_serial_number (str): + The serial number encoded in lowercase + hexadecimal. + lifetime (google.protobuf.duration_pb2.Duration): + For convenience, the actual lifetime of an issued + certificate. Corresponds to 'not_after_time' - + 'not_before_time'. + not_before_time (google.protobuf.timestamp_pb2.Timestamp): + The time at which the certificate becomes + valid. + not_after_time (google.protobuf.timestamp_pb2.Timestamp): + The time at which the certificate expires. + """ + + subject: 'Subject' = proto.Field( + proto.MESSAGE, + number=1, + message='Subject', + ) + common_name: str = proto.Field( + proto.STRING, + number=2, + ) + subject_alt_name: 'SubjectAltNames' = proto.Field( + proto.MESSAGE, + number=3, + message='SubjectAltNames', + ) + hex_serial_number: str = proto.Field( + proto.STRING, + number=4, + ) + lifetime: duration_pb2.Duration = proto.Field( + proto.MESSAGE, + number=5, + message=duration_pb2.Duration, + ) + not_before_time: timestamp_pb2.Timestamp = proto.Field( + proto.MESSAGE, + number=6, + message=timestamp_pb2.Timestamp, + ) + not_after_time: timestamp_pb2.Timestamp = proto.Field( + proto.MESSAGE, + number=7, + message=timestamp_pb2.Timestamp, + ) + + class KeyId(proto.Message): + r"""A KeyId identifies a specific public key, usually by hashing + the public key. + + Attributes: + key_id (str): + Optional. The value of this KeyId encoded in + lowercase hexadecimal. This is most likely the + 160 bit SHA-1 hash of the public key. + """ + + key_id: str = 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: str = proto.Field( + proto.STRING, + number=1, + ) + + subject_description: SubjectDescription = proto.Field( + proto.MESSAGE, + number=1, + message=SubjectDescription, + ) + config_values: 'ReusableConfigValues' = proto.Field( + proto.MESSAGE, + number=2, + message='ReusableConfigValues', + ) + public_key: 'PublicKey' = proto.Field( + proto.MESSAGE, + number=3, + message='PublicKey', + ) + subject_key_id: KeyId = proto.Field( + proto.MESSAGE, + number=4, + message=KeyId, + ) + authority_key_id: KeyId = proto.Field( + proto.MESSAGE, + number=5, + message=KeyId, + ) + crl_distribution_points: MutableSequence[str] = proto.RepeatedField( + proto.STRING, + number=6, + ) + aia_issuing_certificate_urls: MutableSequence[str] = proto.RepeatedField( + proto.STRING, + number=7, + ) + cert_fingerprint: CertificateFingerprint = proto.Field( + proto.MESSAGE, + number=8, + message=CertificateFingerprint, + ) + + +class ObjectId(proto.Message): + r"""An [ObjectId][google.cloud.security.privateca.v1beta1.ObjectId] + specifies an object identifier (OID). These provide context and + describe types in ASN.1 messages. + + Attributes: + object_id_path (MutableSequence[int]): + Required. The parts of an OID path. The most + significant parts of the path come first. + """ + + object_id_path: MutableSequence[int] = proto.RepeatedField( + proto.INT32, + number=1, + ) + + +class X509Extension(proto.Message): + r"""An + [X509Extension][google.cloud.security.privateca.v1beta1.X509Extension] + specifies an X.509 extension, which may be used in different parts + of X.509 objects like certificates, CSRs, and CRLs. + + Attributes: + object_id (google.cloud.security.privateca_v1beta1.types.ObjectId): + Required. The OID for this X.509 extension. + critical (bool): + Required. Indicates whether or not this + extension is critical (i.e., if the client does + not know how to handle this extension, the + client should consider this to be an error). + value (bytes): + Required. The value of this X.509 extension. + """ + + object_id: 'ObjectId' = proto.Field( + proto.MESSAGE, + number=1, + message='ObjectId', + ) + critical: bool = proto.Field( + proto.BOOL, + number=2, + ) + value: bytes = proto.Field( + proto.BYTES, + number=3, + ) + + +class KeyUsage(proto.Message): + r"""A [KeyUsage][google.cloud.security.privateca.v1beta1.KeyUsage] + describes key usage values that may appear in an X.509 certificate. + + Attributes: + base_key_usage (google.cloud.security.privateca_v1beta1.types.KeyUsage.KeyUsageOptions): + Describes high-level ways in which a key may + be used. + extended_key_usage (google.cloud.security.privateca_v1beta1.types.KeyUsage.ExtendedKeyUsageOptions): + Detailed scenarios in which a key may be + used. + unknown_extended_key_usages (MutableSequence[google.cloud.security.privateca_v1beta1.types.ObjectId]): + Used to describe extended key usages that are not listed in + the + [KeyUsage.ExtendedKeyUsageOptions][google.cloud.security.privateca.v1beta1.KeyUsage.ExtendedKeyUsageOptions] + message. + """ + + class KeyUsageOptions(proto.Message): + r"""[KeyUsage.KeyUsageOptions][google.cloud.security.privateca.v1beta1.KeyUsage.KeyUsageOptions] + corresponds to the key usage values described in + https://tools.ietf.org/html/rfc5280#section-4.2.1.3. + + Attributes: + digital_signature (bool): + The key may be used for digital signatures. + content_commitment (bool): + The key may be used for cryptographic + commitments. Note that this may also be referred + to as "non-repudiation". + key_encipherment (bool): + The key may be used to encipher other keys. + data_encipherment (bool): + The key may be used to encipher data. + key_agreement (bool): + The key may be used in a key agreement + protocol. + cert_sign (bool): + The key may be used to sign certificates. + crl_sign (bool): + The key may be used sign certificate + revocation lists. + encipher_only (bool): + The key may be used to encipher only. + decipher_only (bool): + The key may be used to decipher only. + """ + + digital_signature: bool = proto.Field( + proto.BOOL, + number=1, + ) + content_commitment: bool = proto.Field( + proto.BOOL, + number=2, + ) + key_encipherment: bool = proto.Field( + proto.BOOL, + number=3, + ) + data_encipherment: bool = proto.Field( + proto.BOOL, + number=4, + ) + key_agreement: bool = proto.Field( + proto.BOOL, + number=5, + ) + cert_sign: bool = proto.Field( + proto.BOOL, + number=6, + ) + crl_sign: bool = proto.Field( + proto.BOOL, + number=7, + ) + encipher_only: bool = proto.Field( + proto.BOOL, + number=8, + ) + decipher_only: bool = proto.Field( + proto.BOOL, + number=9, + ) + + class ExtendedKeyUsageOptions(proto.Message): + r"""[KeyUsage.ExtendedKeyUsageOptions][google.cloud.security.privateca.v1beta1.KeyUsage.ExtendedKeyUsageOptions] + has fields that correspond to certain common OIDs that could be + specified as an extended key usage value. + + Attributes: + server_auth (bool): + Corresponds to OID 1.3.6.1.5.5.7.3.1. + Officially described as "TLS WWW server + authentication", though regularly used for + non-WWW TLS. + client_auth (bool): + Corresponds to OID 1.3.6.1.5.5.7.3.2. + Officially described as "TLS WWW client + authentication", though regularly used for + non-WWW TLS. + code_signing (bool): + Corresponds to OID 1.3.6.1.5.5.7.3.3. + Officially described as "Signing of downloadable + executable code client authentication". + email_protection (bool): + Corresponds to OID 1.3.6.1.5.5.7.3.4. + Officially described as "Email protection". + time_stamping (bool): + Corresponds to OID 1.3.6.1.5.5.7.3.8. + Officially described as "Binding the hash of an + object to a time". + ocsp_signing (bool): + Corresponds to OID 1.3.6.1.5.5.7.3.9. + Officially described as "Signing OCSP + responses". + """ + + server_auth: bool = proto.Field( + proto.BOOL, + number=1, + ) + client_auth: bool = proto.Field( + proto.BOOL, + number=2, + ) + code_signing: bool = proto.Field( + proto.BOOL, + number=3, + ) + email_protection: bool = proto.Field( + proto.BOOL, + number=4, + ) + time_stamping: bool = proto.Field( + proto.BOOL, + number=5, + ) + ocsp_signing: bool = proto.Field( + proto.BOOL, + number=6, + ) + + base_key_usage: KeyUsageOptions = proto.Field( + proto.MESSAGE, + number=1, + message=KeyUsageOptions, + ) + extended_key_usage: ExtendedKeyUsageOptions = proto.Field( + proto.MESSAGE, + number=2, + message=ExtendedKeyUsageOptions, + ) + unknown_extended_key_usages: MutableSequence['ObjectId'] = proto.RepeatedField( + proto.MESSAGE, + number=3, + message='ObjectId', + ) + + +class Subject(proto.Message): + r"""[Subject][google.cloud.security.privateca.v1beta1.Subject] describes + parts of a distinguished name that, in turn, describes the subject + of the certificate. + + Attributes: + country_code (str): + The country code of the subject. + organization (str): + The organization of the subject. + organizational_unit (str): + The organizational_unit of the subject. + locality (str): + The locality or city of the subject. + province (str): + The province, territory, or regional state of + the subject. + street_address (str): + The street address of the subject. + postal_code (str): + The postal code of the subject. + """ + + country_code: str = proto.Field( + proto.STRING, + number=1, + ) + organization: str = proto.Field( + proto.STRING, + number=2, + ) + organizational_unit: str = proto.Field( + proto.STRING, + number=3, + ) + locality: str = proto.Field( + proto.STRING, + number=4, + ) + province: str = proto.Field( + proto.STRING, + number=5, + ) + street_address: str = proto.Field( + proto.STRING, + number=6, + ) + postal_code: str = proto.Field( + proto.STRING, + number=7, + ) + + +class SubjectAltNames(proto.Message): + r"""[SubjectAltNames][google.cloud.security.privateca.v1beta1.SubjectAltNames] + corresponds to a more modern way of listing what the asserted + identity is in a certificate (i.e., compared to the "common name" in + the distinguished name). + + Attributes: + dns_names (MutableSequence[str]): + Contains only valid, fully-qualified host + names. + uris (MutableSequence[str]): + Contains only valid RFC 3986 URIs. + email_addresses (MutableSequence[str]): + Contains only valid RFC 2822 E-mail + addresses. + ip_addresses (MutableSequence[str]): + Contains only valid 32-bit IPv4 addresses or + RFC 4291 IPv6 addresses. + custom_sans (MutableSequence[google.cloud.security.privateca_v1beta1.types.X509Extension]): + Contains additional subject alternative name + values. + """ + + dns_names: MutableSequence[str] = proto.RepeatedField( + proto.STRING, + number=1, + ) + uris: MutableSequence[str] = proto.RepeatedField( + proto.STRING, + number=2, + ) + email_addresses: MutableSequence[str] = proto.RepeatedField( + proto.STRING, + number=3, + ) + ip_addresses: MutableSequence[str] = proto.RepeatedField( + proto.STRING, + number=4, + ) + custom_sans: MutableSequence['X509Extension'] = proto.RepeatedField( + proto.MESSAGE, + number=5, + message='X509Extension', + ) + + +__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/owl-bot-staging/v1beta1/google/cloud/security/privateca_v1beta1/types/service.py b/owl-bot-staging/v1beta1/google/cloud/security/privateca_v1beta1/types/service.py new file mode 100644 index 0000000..4c505a9 --- /dev/null +++ b/owl-bot-staging/v1beta1/google/cloud/security/privateca_v1beta1/types/service.py @@ -0,0 +1,1124 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +from typing import MutableMapping, MutableSequence + +import proto # type: ignore + +from google.cloud.security.privateca_v1beta1.types import resources +from google.protobuf import field_mask_pb2 # type: ignore +from google.protobuf import timestamp_pb2 # type: ignore + + +__protobuf__ = proto.module( + package='google.cloud.security.privateca.v1beta1', + manifest={ + 'CreateCertificateRequest', + 'GetCertificateRequest', + 'ListCertificatesRequest', + 'ListCertificatesResponse', + 'RevokeCertificateRequest', + 'UpdateCertificateRequest', + 'ActivateCertificateAuthorityRequest', + 'CreateCertificateAuthorityRequest', + 'DisableCertificateAuthorityRequest', + 'EnableCertificateAuthorityRequest', + 'FetchCertificateAuthorityCsrRequest', + 'FetchCertificateAuthorityCsrResponse', + 'GetCertificateAuthorityRequest', + 'ListCertificateAuthoritiesRequest', + 'ListCertificateAuthoritiesResponse', + 'RestoreCertificateAuthorityRequest', + 'ScheduleDeleteCertificateAuthorityRequest', + 'UpdateCertificateAuthorityRequest', + 'GetCertificateRevocationListRequest', + 'ListCertificateRevocationListsRequest', + 'ListCertificateRevocationListsResponse', + 'UpdateCertificateRevocationListRequest', + 'GetReusableConfigRequest', + 'ListReusableConfigsRequest', + 'ListReusableConfigsResponse', + 'OperationMetadata', + }, +) + + +class CreateCertificateRequest(proto.Message): + r"""Request message for + [CertificateAuthorityService.CreateCertificate][google.cloud.security.privateca.v1beta1.CertificateAuthorityService.CreateCertificate]. + + Attributes: + parent (str): + Required. The resource name of the location and + [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority] + associated with the + [Certificate][google.cloud.security.privateca.v1beta1.Certificate], + in the format + ``projects/*/locations/*/certificateAuthorities/*``. + certificate_id (str): + Optional. It must be unique within a location and match the + regular expression ``[a-zA-Z0-9_-]{1,63}``. This field is + required when using a + [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority] + in the Enterprise + [CertificateAuthority.Tier][google.cloud.security.privateca.v1beta1.CertificateAuthority.Tier], + but is optional and its value is ignored otherwise. + certificate (google.cloud.security.privateca_v1beta1.types.Certificate): + Required. A + [Certificate][google.cloud.security.privateca.v1beta1.Certificate] + with initial field values. + request_id (str): + Optional. An ID to identify requests. Specify + a unique request ID so that if you must retry + your request, the server will know to ignore the + request if it has already been completed. The + server will guarantee that for at least 60 + minutes since the first request. + + For example, consider a situation where you make + an initial request and t he request times out. + If you make the request again with the same + request ID, the server can check if original + operation with the same request ID was received, + and if so, will ignore the second request. This + prevents clients from accidentally creating + duplicate commitments. + The request ID must be a valid UUID with the + exception that zero UUID is not supported + (00000000-0000-0000-0000-000000000000). + """ + + parent: str = proto.Field( + proto.STRING, + number=1, + ) + certificate_id: str = proto.Field( + proto.STRING, + number=2, + ) + certificate: resources.Certificate = proto.Field( + proto.MESSAGE, + number=3, + message=resources.Certificate, + ) + request_id: str = proto.Field( + proto.STRING, + number=4, + ) + + +class GetCertificateRequest(proto.Message): + r"""Request message for + [CertificateAuthorityService.GetCertificate][google.cloud.security.privateca.v1beta1.CertificateAuthorityService.GetCertificate]. + + Attributes: + name (str): + Required. The + [name][google.cloud.security.privateca.v1beta1.Certificate.name] + of the + [Certificate][google.cloud.security.privateca.v1beta1.Certificate] + to get. + """ + + name: str = proto.Field( + proto.STRING, + number=1, + ) + + +class ListCertificatesRequest(proto.Message): + r"""Request message for + [CertificateAuthorityService.ListCertificates][google.cloud.security.privateca.v1beta1.CertificateAuthorityService.ListCertificates]. + + Attributes: + parent (str): + Required. The resource name of the location associated with + the + [Certificates][google.cloud.security.privateca.v1beta1.Certificate], + in the format + ``projects/*/locations/*/certificateauthorities/*``. + page_size (int): + Optional. Limit on the number of + [Certificates][google.cloud.security.privateca.v1beta1.Certificate] + to include in the response. Further + [Certificates][google.cloud.security.privateca.v1beta1.Certificate] + can subsequently be obtained by including the + [ListCertificatesResponse.next_page_token][google.cloud.security.privateca.v1beta1.ListCertificatesResponse.next_page_token] + in a subsequent request. If unspecified, the server will + pick an appropriate default. + page_token (str): + Optional. Pagination token, returned earlier via + [ListCertificatesResponse.next_page_token][google.cloud.security.privateca.v1beta1.ListCertificatesResponse.next_page_token]. + filter (str): + Optional. Only include resources that match the filter in + the response. For details on supported filters and syntax, + see `Certificates Filtering + documentation `__. + order_by (str): + Optional. Specify how the results should be sorted. For + details on supported fields and syntax, see `Certificates + Sorting + documentation `__. + """ + + parent: str = proto.Field( + proto.STRING, + number=1, + ) + page_size: int = proto.Field( + proto.INT32, + number=2, + ) + page_token: str = proto.Field( + proto.STRING, + number=3, + ) + filter: str = proto.Field( + proto.STRING, + number=4, + ) + order_by: str = proto.Field( + proto.STRING, + number=5, + ) + + +class ListCertificatesResponse(proto.Message): + r"""Response message for + [CertificateAuthorityService.ListCertificates][google.cloud.security.privateca.v1beta1.CertificateAuthorityService.ListCertificates]. + + Attributes: + certificates (MutableSequence[google.cloud.security.privateca_v1beta1.types.Certificate]): + The list of + [Certificates][google.cloud.security.privateca.v1beta1.Certificate]. + next_page_token (str): + A token to retrieve next page of results. Pass this value in + [ListCertificatesRequest.next_page_token][] to retrieve the + next page of results. + unreachable (MutableSequence[str]): + A list of locations (e.g. "us-west1") that + could not be reached. + """ + + @property + def raw_page(self): + return self + + certificates: MutableSequence[resources.Certificate] = proto.RepeatedField( + proto.MESSAGE, + number=1, + message=resources.Certificate, + ) + next_page_token: str = proto.Field( + proto.STRING, + number=2, + ) + unreachable: MutableSequence[str] = proto.RepeatedField( + proto.STRING, + number=3, + ) + + +class RevokeCertificateRequest(proto.Message): + r"""Request message for + [CertificateAuthorityService.RevokeCertificate][google.cloud.security.privateca.v1beta1.CertificateAuthorityService.RevokeCertificate]. + + Attributes: + name (str): + Required. The resource name for this + [Certificate][google.cloud.security.privateca.v1beta1.Certificate] + in the format + ``projects/*/locations/*/certificateAuthorities/*/certificates/*``. + reason (google.cloud.security.privateca_v1beta1.types.RevocationReason): + Required. The + [RevocationReason][google.cloud.security.privateca.v1beta1.RevocationReason] + for revoking this certificate. + request_id (str): + Optional. An ID to identify requests. Specify + a unique request ID so that if you must retry + your request, the server will know to ignore the + request if it has already been completed. The + server will guarantee that for at least 60 + minutes since the first request. + + For example, consider a situation where you make + an initial request and t he request times out. + If you make the request again with the same + request ID, the server can check if original + operation with the same request ID was received, + and if so, will ignore the second request. This + prevents clients from accidentally creating + duplicate commitments. + The request ID must be a valid UUID with the + exception that zero UUID is not supported + (00000000-0000-0000-0000-000000000000). + """ + + name: str = proto.Field( + proto.STRING, + number=1, + ) + reason: resources.RevocationReason = proto.Field( + proto.ENUM, + number=2, + enum=resources.RevocationReason, + ) + request_id: str = proto.Field( + proto.STRING, + number=3, + ) + + +class UpdateCertificateRequest(proto.Message): + r"""Request message for + [CertificateAuthorityService.UpdateCertificate][google.cloud.security.privateca.v1beta1.CertificateAuthorityService.UpdateCertificate]. + + Attributes: + certificate (google.cloud.security.privateca_v1beta1.types.Certificate): + Required. + [Certificate][google.cloud.security.privateca.v1beta1.Certificate] + with updated values. + update_mask (google.protobuf.field_mask_pb2.FieldMask): + Required. A list of fields to be updated in + this request. + request_id (str): + Optional. An ID to identify requests. Specify + a unique request ID so that if you must retry + your request, the server will know to ignore the + request if it has already been completed. The + server will guarantee that for at least 60 + minutes since the first request. + + For example, consider a situation where you make + an initial request and t he request times out. + If you make the request again with the same + request ID, the server can check if original + operation with the same request ID was received, + and if so, will ignore the second request. This + prevents clients from accidentally creating + duplicate commitments. + The request ID must be a valid UUID with the + exception that zero UUID is not supported + (00000000-0000-0000-0000-000000000000). + """ + + certificate: resources.Certificate = proto.Field( + proto.MESSAGE, + number=1, + message=resources.Certificate, + ) + update_mask: field_mask_pb2.FieldMask = proto.Field( + proto.MESSAGE, + number=2, + message=field_mask_pb2.FieldMask, + ) + request_id: str = proto.Field( + proto.STRING, + number=3, + ) + + +class ActivateCertificateAuthorityRequest(proto.Message): + r"""Request message for + [CertificateAuthorityService.ActivateCertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthorityService.ActivateCertificateAuthority]. + + Attributes: + name (str): + Required. The resource name for this + [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority] + in the format + ``projects/*/locations/*/certificateAuthorities/*``. + pem_ca_certificate (str): + Required. The signed CA certificate issued from + [FetchCertificateAuthorityCsrResponse.pem_csr][google.cloud.security.privateca.v1beta1.FetchCertificateAuthorityCsrResponse.pem_csr]. + subordinate_config (google.cloud.security.privateca_v1beta1.types.SubordinateConfig): + Required. Must include information about the issuer of + 'pem_ca_certificate', and any further issuers until the + self-signed CA. + request_id (str): + Optional. An ID to identify requests. Specify + a unique request ID so that if you must retry + your request, the server will know to ignore the + request if it has already been completed. The + server will guarantee that for at least 60 + minutes since the first request. + + For example, consider a situation where you make + an initial request and t he request times out. + If you make the request again with the same + request ID, the server can check if original + operation with the same request ID was received, + and if so, will ignore the second request. This + prevents clients from accidentally creating + duplicate commitments. + The request ID must be a valid UUID with the + exception that zero UUID is not supported + (00000000-0000-0000-0000-000000000000). + """ + + name: str = proto.Field( + proto.STRING, + number=1, + ) + pem_ca_certificate: str = proto.Field( + proto.STRING, + number=2, + ) + subordinate_config: resources.SubordinateConfig = proto.Field( + proto.MESSAGE, + number=3, + message=resources.SubordinateConfig, + ) + request_id: str = proto.Field( + proto.STRING, + number=4, + ) + + +class CreateCertificateAuthorityRequest(proto.Message): + r"""Request message for + [CertificateAuthorityService.CreateCertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthorityService.CreateCertificateAuthority]. + + Attributes: + parent (str): + Required. The resource name of the location associated with + the + [CertificateAuthorities][google.cloud.security.privateca.v1beta1.CertificateAuthority], + in the format ``projects/*/locations/*``. + certificate_authority_id (str): + Required. It must be unique within a location and match the + regular expression ``[a-zA-Z0-9_-]{1,63}`` + certificate_authority (google.cloud.security.privateca_v1beta1.types.CertificateAuthority): + Required. A + [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority] + with initial field values. + request_id (str): + Optional. An ID to identify requests. Specify + a unique request ID so that if you must retry + your request, the server will know to ignore the + request if it has already been completed. The + server will guarantee that for at least 60 + minutes since the first request. + + For example, consider a situation where you make + an initial request and t he request times out. + If you make the request again with the same + request ID, the server can check if original + operation with the same request ID was received, + and if so, will ignore the second request. This + prevents clients from accidentally creating + duplicate commitments. + The request ID must be a valid UUID with the + exception that zero UUID is not supported + (00000000-0000-0000-0000-000000000000). + """ + + parent: str = proto.Field( + proto.STRING, + number=1, + ) + certificate_authority_id: str = proto.Field( + proto.STRING, + number=2, + ) + certificate_authority: resources.CertificateAuthority = proto.Field( + proto.MESSAGE, + number=3, + message=resources.CertificateAuthority, + ) + request_id: str = proto.Field( + proto.STRING, + number=4, + ) + + +class DisableCertificateAuthorityRequest(proto.Message): + r"""Request message for + [CertificateAuthorityService.DisableCertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthorityService.DisableCertificateAuthority]. + + Attributes: + name (str): + Required. The resource name for this + [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority] + in the format + ``projects/*/locations/*/certificateAuthorities/*``. + request_id (str): + Optional. An ID to identify requests. Specify + a unique request ID so that if you must retry + your request, the server will know to ignore the + request if it has already been completed. The + server will guarantee that for at least 60 + minutes since the first request. + + For example, consider a situation where you make + an initial request and t he request times out. + If you make the request again with the same + request ID, the server can check if original + operation with the same request ID was received, + and if so, will ignore the second request. This + prevents clients from accidentally creating + duplicate commitments. + The request ID must be a valid UUID with the + exception that zero UUID is not supported + (00000000-0000-0000-0000-000000000000). + """ + + name: str = proto.Field( + proto.STRING, + number=1, + ) + request_id: str = proto.Field( + proto.STRING, + number=2, + ) + + +class EnableCertificateAuthorityRequest(proto.Message): + r"""Request message for + [CertificateAuthorityService.EnableCertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthorityService.EnableCertificateAuthority]. + + Attributes: + name (str): + Required. The resource name for this + [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority] + in the format + ``projects/*/locations/*/certificateAuthorities/*``. + request_id (str): + Optional. An ID to identify requests. Specify + a unique request ID so that if you must retry + your request, the server will know to ignore the + request if it has already been completed. The + server will guarantee that for at least 60 + minutes since the first request. + + For example, consider a situation where you make + an initial request and t he request times out. + If you make the request again with the same + request ID, the server can check if original + operation with the same request ID was received, + and if so, will ignore the second request. This + prevents clients from accidentally creating + duplicate commitments. + The request ID must be a valid UUID with the + exception that zero UUID is not supported + (00000000-0000-0000-0000-000000000000). + """ + + name: str = proto.Field( + proto.STRING, + number=1, + ) + request_id: str = proto.Field( + proto.STRING, + number=2, + ) + + +class FetchCertificateAuthorityCsrRequest(proto.Message): + r"""Request message for + [CertificateAuthorityService.FetchCertificateAuthorityCsr][google.cloud.security.privateca.v1beta1.CertificateAuthorityService.FetchCertificateAuthorityCsr]. + + Attributes: + name (str): + Required. The resource name for this + [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority] + in the format + ``projects/*/locations/*/certificateAuthorities/*``. + """ + + name: str = proto.Field( + proto.STRING, + number=1, + ) + + +class FetchCertificateAuthorityCsrResponse(proto.Message): + r"""Response message for + [CertificateAuthorityService.FetchCertificateAuthorityCsr][google.cloud.security.privateca.v1beta1.CertificateAuthorityService.FetchCertificateAuthorityCsr]. + + Attributes: + pem_csr (str): + Output only. The PEM-encoded signed + certificate signing request (CSR). + """ + + pem_csr: str = proto.Field( + proto.STRING, + number=1, + ) + + +class GetCertificateAuthorityRequest(proto.Message): + r"""Request message for + [CertificateAuthorityService.GetCertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthorityService.GetCertificateAuthority]. + + Attributes: + name (str): + Required. The + [name][google.cloud.security.privateca.v1beta1.CertificateAuthority.name] + of the + [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority] + to get. + """ + + name: str = proto.Field( + proto.STRING, + number=1, + ) + + +class ListCertificateAuthoritiesRequest(proto.Message): + r"""Request message for + [CertificateAuthorityService.ListCertificateAuthorities][google.cloud.security.privateca.v1beta1.CertificateAuthorityService.ListCertificateAuthorities]. + + Attributes: + parent (str): + Required. The resource name of the location associated with + the + [CertificateAuthorities][google.cloud.security.privateca.v1beta1.CertificateAuthority], + in the format ``projects/*/locations/*``. + page_size (int): + Optional. Limit on the number of + [CertificateAuthorities][google.cloud.security.privateca.v1beta1.CertificateAuthority] + to include in the response. Further + [CertificateAuthorities][google.cloud.security.privateca.v1beta1.CertificateAuthority] + can subsequently be obtained by including the + [ListCertificateAuthoritiesResponse.next_page_token][google.cloud.security.privateca.v1beta1.ListCertificateAuthoritiesResponse.next_page_token] + in a subsequent request. If unspecified, the server will + pick an appropriate default. + page_token (str): + Optional. Pagination token, returned earlier via + [ListCertificateAuthoritiesResponse.next_page_token][google.cloud.security.privateca.v1beta1.ListCertificateAuthoritiesResponse.next_page_token]. + filter (str): + Optional. Only include resources that match + the filter in the response. + order_by (str): + Optional. Specify how the results should be + sorted. + """ + + parent: str = proto.Field( + proto.STRING, + number=1, + ) + page_size: int = proto.Field( + proto.INT32, + number=2, + ) + page_token: str = proto.Field( + proto.STRING, + number=3, + ) + filter: str = proto.Field( + proto.STRING, + number=4, + ) + order_by: str = proto.Field( + proto.STRING, + number=5, + ) + + +class ListCertificateAuthoritiesResponse(proto.Message): + r"""Response message for + [CertificateAuthorityService.ListCertificateAuthorities][google.cloud.security.privateca.v1beta1.CertificateAuthorityService.ListCertificateAuthorities]. + + Attributes: + certificate_authorities (MutableSequence[google.cloud.security.privateca_v1beta1.types.CertificateAuthority]): + The list of + [CertificateAuthorities][google.cloud.security.privateca.v1beta1.CertificateAuthority]. + next_page_token (str): + A token to retrieve next page of results. Pass this value in + [ListCertificateAuthoritiesRequest.next_page_token][] to + retrieve the next page of results. + unreachable (MutableSequence[str]): + A list of locations (e.g. "us-west1") that + could not be reached. + """ + + @property + def raw_page(self): + return self + + certificate_authorities: MutableSequence[resources.CertificateAuthority] = proto.RepeatedField( + proto.MESSAGE, + number=1, + message=resources.CertificateAuthority, + ) + next_page_token: str = proto.Field( + proto.STRING, + number=2, + ) + unreachable: MutableSequence[str] = proto.RepeatedField( + proto.STRING, + number=3, + ) + + +class RestoreCertificateAuthorityRequest(proto.Message): + r"""Request message for + [CertificateAuthorityService.RestoreCertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthorityService.RestoreCertificateAuthority]. + + Attributes: + name (str): + Required. The resource name for this + [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority] + in the format + ``projects/*/locations/*/certificateAuthorities/*``. + request_id (str): + Optional. An ID to identify requests. Specify + a unique request ID so that if you must retry + your request, the server will know to ignore the + request if it has already been completed. The + server will guarantee that for at least 60 + minutes since the first request. + + For example, consider a situation where you make + an initial request and t he request times out. + If you make the request again with the same + request ID, the server can check if original + operation with the same request ID was received, + and if so, will ignore the second request. This + prevents clients from accidentally creating + duplicate commitments. + The request ID must be a valid UUID with the + exception that zero UUID is not supported + (00000000-0000-0000-0000-000000000000). + """ + + name: str = proto.Field( + proto.STRING, + number=1, + ) + request_id: str = proto.Field( + proto.STRING, + number=2, + ) + + +class ScheduleDeleteCertificateAuthorityRequest(proto.Message): + r"""Request message for + [CertificateAuthorityService.ScheduleDeleteCertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthorityService.ScheduleDeleteCertificateAuthority]. + + Attributes: + name (str): + Required. The resource name for this + [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority] + in the format + ``projects/*/locations/*/certificateAuthorities/*``. + request_id (str): + Optional. An ID to identify requests. Specify + a unique request ID so that if you must retry + your request, the server will know to ignore the + request if it has already been completed. The + server will guarantee that for at least 60 + minutes since the first request. + + For example, consider a situation where you make + an initial request and t he request times out. + If you make the request again with the same + request ID, the server can check if original + operation with the same request ID was received, + and if so, will ignore the second request. This + prevents clients from accidentally creating + duplicate commitments. + The request ID must be a valid UUID with the + exception that zero UUID is not supported + (00000000-0000-0000-0000-000000000000). + """ + + name: str = proto.Field( + proto.STRING, + number=1, + ) + request_id: str = proto.Field( + proto.STRING, + number=2, + ) + + +class UpdateCertificateAuthorityRequest(proto.Message): + r"""Request message for + [CertificateAuthorityService.UpdateCertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthorityService.UpdateCertificateAuthority]. + + Attributes: + certificate_authority (google.cloud.security.privateca_v1beta1.types.CertificateAuthority): + Required. + [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority] + with updated values. + update_mask (google.protobuf.field_mask_pb2.FieldMask): + Required. A list of fields to be updated in + this request. + request_id (str): + Optional. An ID to identify requests. Specify + a unique request ID so that if you must retry + your request, the server will know to ignore the + request if it has already been completed. The + server will guarantee that for at least 60 + minutes since the first request. + + For example, consider a situation where you make + an initial request and t he request times out. + If you make the request again with the same + request ID, the server can check if original + operation with the same request ID was received, + and if so, will ignore the second request. This + prevents clients from accidentally creating + duplicate commitments. + The request ID must be a valid UUID with the + exception that zero UUID is not supported + (00000000-0000-0000-0000-000000000000). + """ + + certificate_authority: resources.CertificateAuthority = proto.Field( + proto.MESSAGE, + number=1, + message=resources.CertificateAuthority, + ) + update_mask: field_mask_pb2.FieldMask = proto.Field( + proto.MESSAGE, + number=2, + message=field_mask_pb2.FieldMask, + ) + request_id: str = proto.Field( + proto.STRING, + number=3, + ) + + +class GetCertificateRevocationListRequest(proto.Message): + r"""Request message for + [CertificateAuthorityService.GetCertificateRevocationList][google.cloud.security.privateca.v1beta1.CertificateAuthorityService.GetCertificateRevocationList]. + + Attributes: + name (str): + Required. The + [name][google.cloud.security.privateca.v1beta1.CertificateRevocationList.name] + of the + [CertificateRevocationList][google.cloud.security.privateca.v1beta1.CertificateRevocationList] + to get. + """ + + name: str = proto.Field( + proto.STRING, + number=1, + ) + + +class ListCertificateRevocationListsRequest(proto.Message): + r"""Request message for + [CertificateAuthorityService.ListCertificateRevocationLists][google.cloud.security.privateca.v1beta1.CertificateAuthorityService.ListCertificateRevocationLists]. + + Attributes: + parent (str): + Required. The resource name of the location associated with + the + [CertificateRevocationLists][google.cloud.security.privateca.v1beta1.CertificateRevocationList], + in the format + ``projects/*/locations/*/certificateauthorities/*``. + page_size (int): + Optional. Limit on the number of + [CertificateRevocationLists][google.cloud.security.privateca.v1beta1.CertificateRevocationList] + to include in the response. Further + [CertificateRevocationLists][google.cloud.security.privateca.v1beta1.CertificateRevocationList] + can subsequently be obtained by including the + [ListCertificateRevocationListsResponse.next_page_token][google.cloud.security.privateca.v1beta1.ListCertificateRevocationListsResponse.next_page_token] + in a subsequent request. If unspecified, the server will + pick an appropriate default. + page_token (str): + Optional. Pagination token, returned earlier via + [ListCertificateRevocationListsResponse.next_page_token][google.cloud.security.privateca.v1beta1.ListCertificateRevocationListsResponse.next_page_token]. + filter (str): + Optional. Only include resources that match + the filter in the response. + order_by (str): + Optional. Specify how the results should be + sorted. + """ + + parent: str = proto.Field( + proto.STRING, + number=1, + ) + page_size: int = proto.Field( + proto.INT32, + number=2, + ) + page_token: str = proto.Field( + proto.STRING, + number=3, + ) + filter: str = proto.Field( + proto.STRING, + number=4, + ) + order_by: str = proto.Field( + proto.STRING, + number=5, + ) + + +class ListCertificateRevocationListsResponse(proto.Message): + r"""Response message for + [CertificateAuthorityService.ListCertificateRevocationLists][google.cloud.security.privateca.v1beta1.CertificateAuthorityService.ListCertificateRevocationLists]. + + Attributes: + certificate_revocation_lists (MutableSequence[google.cloud.security.privateca_v1beta1.types.CertificateRevocationList]): + The list of + [CertificateRevocationLists][google.cloud.security.privateca.v1beta1.CertificateRevocationList]. + next_page_token (str): + A token to retrieve next page of results. Pass this value in + [ListCertificateRevocationListsRequest.next_page_token][] to + retrieve the next page of results. + unreachable (MutableSequence[str]): + A list of locations (e.g. "us-west1") that + could not be reached. + """ + + @property + def raw_page(self): + return self + + certificate_revocation_lists: MutableSequence[resources.CertificateRevocationList] = proto.RepeatedField( + proto.MESSAGE, + number=1, + message=resources.CertificateRevocationList, + ) + next_page_token: str = proto.Field( + proto.STRING, + number=2, + ) + unreachable: MutableSequence[str] = proto.RepeatedField( + proto.STRING, + number=3, + ) + + +class UpdateCertificateRevocationListRequest(proto.Message): + r"""Request message for + [CertificateAuthorityService.UpdateCertificateRevocationList][google.cloud.security.privateca.v1beta1.CertificateAuthorityService.UpdateCertificateRevocationList]. + + Attributes: + certificate_revocation_list (google.cloud.security.privateca_v1beta1.types.CertificateRevocationList): + Required. + [CertificateRevocationList][google.cloud.security.privateca.v1beta1.CertificateRevocationList] + with updated values. + update_mask (google.protobuf.field_mask_pb2.FieldMask): + Required. A list of fields to be updated in + this request. + request_id (str): + Optional. An ID to identify requests. Specify + a unique request ID so that if you must retry + your request, the server will know to ignore the + request if it has already been completed. The + server will guarantee that for at least 60 + minutes since the first request. + + For example, consider a situation where you make + an initial request and t he request times out. + If you make the request again with the same + request ID, the server can check if original + operation with the same request ID was received, + and if so, will ignore the second request. This + prevents clients from accidentally creating + duplicate commitments. + The request ID must be a valid UUID with the + exception that zero UUID is not supported + (00000000-0000-0000-0000-000000000000). + """ + + certificate_revocation_list: resources.CertificateRevocationList = proto.Field( + proto.MESSAGE, + number=1, + message=resources.CertificateRevocationList, + ) + update_mask: field_mask_pb2.FieldMask = proto.Field( + proto.MESSAGE, + number=2, + message=field_mask_pb2.FieldMask, + ) + request_id: str = proto.Field( + proto.STRING, + number=3, + ) + + +class GetReusableConfigRequest(proto.Message): + r"""Request message for + [CertificateAuthorityService.GetReusableConfig][google.cloud.security.privateca.v1beta1.CertificateAuthorityService.GetReusableConfig]. + + Attributes: + name (str): + Required. The [name][ReusableConfigs.name] of the + [ReusableConfigs][] to get. + """ + + name: str = proto.Field( + proto.STRING, + number=1, + ) + + +class ListReusableConfigsRequest(proto.Message): + r"""Request message for + [CertificateAuthorityService.ListReusableConfigs][google.cloud.security.privateca.v1beta1.CertificateAuthorityService.ListReusableConfigs]. + + Attributes: + parent (str): + Required. The resource name of the location associated with + the + [ReusableConfigs][google.cloud.security.privateca.v1beta1.ReusableConfig], + in the format ``projects/*/locations/*``. + page_size (int): + Optional. Limit on the number of + [ReusableConfigs][google.cloud.security.privateca.v1beta1.ReusableConfig] + to include in the response. Further + [ReusableConfigs][google.cloud.security.privateca.v1beta1.ReusableConfig] + can subsequently be obtained by including the + [ListReusableConfigsResponse.next_page_token][google.cloud.security.privateca.v1beta1.ListReusableConfigsResponse.next_page_token] + in a subsequent request. If unspecified, the server will + pick an appropriate default. + page_token (str): + Optional. Pagination token, returned earlier via + [ListReusableConfigsResponse.next_page_token][google.cloud.security.privateca.v1beta1.ListReusableConfigsResponse.next_page_token]. + filter (str): + Optional. Only include resources that match + the filter in the response. + order_by (str): + Optional. Specify how the results should be + sorted. + """ + + parent: str = proto.Field( + proto.STRING, + number=1, + ) + page_size: int = proto.Field( + proto.INT32, + number=2, + ) + page_token: str = proto.Field( + proto.STRING, + number=3, + ) + filter: str = proto.Field( + proto.STRING, + number=4, + ) + order_by: str = proto.Field( + proto.STRING, + number=5, + ) + + +class ListReusableConfigsResponse(proto.Message): + r"""Response message for + [CertificateAuthorityService.ListReusableConfigs][google.cloud.security.privateca.v1beta1.CertificateAuthorityService.ListReusableConfigs]. + + Attributes: + reusable_configs (MutableSequence[google.cloud.security.privateca_v1beta1.types.ReusableConfig]): + The list of + [ReusableConfigs][google.cloud.security.privateca.v1beta1.ReusableConfig]. + next_page_token (str): + A token to retrieve next page of results. Pass this value in + [ListReusableConfigsRequest.next_page_token][] to retrieve + the next page of results. + unreachable (MutableSequence[str]): + A list of locations (e.g. "us-west1") that + could not be reached. + """ + + @property + def raw_page(self): + return self + + reusable_configs: MutableSequence[resources.ReusableConfig] = proto.RepeatedField( + proto.MESSAGE, + number=1, + message=resources.ReusableConfig, + ) + next_page_token: str = proto.Field( + proto.STRING, + number=2, + ) + unreachable: MutableSequence[str] = 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 + created. + end_time (google.protobuf.timestamp_pb2.Timestamp): + Output only. The time the operation finished + running. + target (str): + Output only. Server-defined resource path for + the target of the operation. + verb (str): + Output only. Name of the verb executed by the + operation. + status_message (str): + Output only. Human-readable status of the + operation, if any. + requested_cancellation (bool): + Output only. Identifies whether the user has requested + cancellation of the operation. Operations that have + successfully been cancelled have [Operation.error][] value + with a [google.rpc.Status.code][google.rpc.Status.code] of + 1, corresponding to ``Code.CANCELLED``. + api_version (str): + Output only. API version used to start the + operation. + """ + + create_time: timestamp_pb2.Timestamp = proto.Field( + proto.MESSAGE, + number=1, + message=timestamp_pb2.Timestamp, + ) + end_time: timestamp_pb2.Timestamp = proto.Field( + proto.MESSAGE, + number=2, + message=timestamp_pb2.Timestamp, + ) + target: str = proto.Field( + proto.STRING, + number=3, + ) + verb: str = proto.Field( + proto.STRING, + number=4, + ) + status_message: str = proto.Field( + proto.STRING, + number=5, + ) + requested_cancellation: bool = proto.Field( + proto.BOOL, + number=6, + ) + api_version: str = proto.Field( + proto.STRING, + number=7, + ) + + +__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/owl-bot-staging/v1beta1/mypy.ini b/owl-bot-staging/v1beta1/mypy.ini new file mode 100644 index 0000000..574c5ae --- /dev/null +++ b/owl-bot-staging/v1beta1/mypy.ini @@ -0,0 +1,3 @@ +[mypy] +python_version = 3.7 +namespace_packages = True diff --git a/owl-bot-staging/v1beta1/noxfile.py b/owl-bot-staging/v1beta1/noxfile.py new file mode 100644 index 0000000..dbd43a2 --- /dev/null +++ b/owl-bot-staging/v1beta1/noxfile.py @@ -0,0 +1,184 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +import os +import pathlib +import shutil +import subprocess +import sys + + +import nox # type: ignore + +ALL_PYTHON = [ + "3.7", + "3.8", + "3.9", + "3.10", + "3.11", +] + +CURRENT_DIRECTORY = pathlib.Path(__file__).parent.absolute() + +LOWER_BOUND_CONSTRAINTS_FILE = CURRENT_DIRECTORY / "constraints.txt" +PACKAGE_NAME = subprocess.check_output([sys.executable, "setup.py", "--name"], encoding="utf-8") + +BLACK_VERSION = "black==22.3.0" +BLACK_PATHS = ["docs", "google", "tests", "samples", "noxfile.py", "setup.py"] +DEFAULT_PYTHON_VERSION = "3.11" + +nox.sessions = [ + "unit", + "cover", + "mypy", + "check_lower_bounds" + # exclude update_lower_bounds from default + "docs", + "blacken", + "lint", + "lint_setup_py", +] + +@nox.session(python=ALL_PYTHON) +def unit(session): + """Run the unit test suite.""" + + session.install('coverage', 'pytest', 'pytest-cov', 'pytest-asyncio', 'asyncmock; python_version < "3.8"') + session.install('-e', '.') + + session.run( + 'py.test', + '--quiet', + '--cov=google/cloud/security/privateca_v1beta1/', + '--cov=tests/', + '--cov-config=.coveragerc', + '--cov-report=term', + '--cov-report=html', + os.path.join('tests', 'unit', ''.join(session.posargs)) + ) + + +@nox.session(python=DEFAULT_PYTHON_VERSION) +def cover(session): + """Run the final coverage report. + This outputs the coverage report aggregating coverage from the unit + test runs (not system test runs), and then erases coverage data. + """ + session.install("coverage", "pytest-cov") + session.run("coverage", "report", "--show-missing", "--fail-under=100") + + session.run("coverage", "erase") + + +@nox.session(python=ALL_PYTHON) +def mypy(session): + """Run the type checker.""" + session.install( + 'mypy', + 'types-requests', + 'types-protobuf' + ) + session.install('.') + session.run( + 'mypy', + '--explicit-package-bases', + 'google', + ) + + +@nox.session +def update_lower_bounds(session): + """Update lower bounds in constraints.txt to match setup.py""" + session.install('google-cloud-testutils') + session.install('.') + + session.run( + 'lower-bound-checker', + 'update', + '--package-name', + PACKAGE_NAME, + '--constraints-file', + str(LOWER_BOUND_CONSTRAINTS_FILE), + ) + + +@nox.session +def check_lower_bounds(session): + """Check lower bounds in setup.py are reflected in constraints file""" + session.install('google-cloud-testutils') + session.install('.') + + session.run( + 'lower-bound-checker', + 'check', + '--package-name', + PACKAGE_NAME, + '--constraints-file', + str(LOWER_BOUND_CONSTRAINTS_FILE), + ) + +@nox.session(python=DEFAULT_PYTHON_VERSION) +def docs(session): + """Build the docs for this library.""" + + session.install("-e", ".") + session.install("sphinx==4.0.1", "alabaster", "recommonmark") + + shutil.rmtree(os.path.join("docs", "_build"), ignore_errors=True) + session.run( + "sphinx-build", + "-W", # warnings as errors + "-T", # show full traceback on exception + "-N", # no colors + "-b", + "html", + "-d", + os.path.join("docs", "_build", "doctrees", ""), + os.path.join("docs", ""), + os.path.join("docs", "_build", "html", ""), + ) + + +@nox.session(python=DEFAULT_PYTHON_VERSION) +def lint(session): + """Run linters. + + Returns a failure if the linters find linting errors or sufficiently + serious code quality issues. + """ + session.install("flake8", BLACK_VERSION) + session.run( + "black", + "--check", + *BLACK_PATHS, + ) + session.run("flake8", "google", "tests", "samples") + + +@nox.session(python=DEFAULT_PYTHON_VERSION) +def blacken(session): + """Run black. Format code to uniform standard.""" + session.install(BLACK_VERSION) + session.run( + "black", + *BLACK_PATHS, + ) + + +@nox.session(python=DEFAULT_PYTHON_VERSION) +def lint_setup_py(session): + """Verify that setup.py is valid (including RST check).""" + session.install("docutils", "pygments") + session.run("python", "setup.py", "check", "--restructuredtext", "--strict") diff --git a/owl-bot-staging/v1beta1/samples/generated_samples/privateca_v1beta1_generated_certificate_authority_service_activate_certificate_authority_async.py b/owl-bot-staging/v1beta1/samples/generated_samples/privateca_v1beta1_generated_certificate_authority_service_activate_certificate_authority_async.py new file mode 100644 index 0000000..50aa8e5 --- /dev/null +++ b/owl-bot-staging/v1beta1/samples/generated_samples/privateca_v1beta1_generated_certificate_authority_service_activate_certificate_authority_async.py @@ -0,0 +1,61 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for ActivateCertificateAuthority +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-private-ca + + +# [START privateca_v1beta1_generated_CertificateAuthorityService_ActivateCertificateAuthority_async] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud.security import privateca_v1beta1 + + +async def sample_activate_certificate_authority(): + # Create a client + client = privateca_v1beta1.CertificateAuthorityServiceAsyncClient() + + # Initialize request argument(s) + subordinate_config = privateca_v1beta1.SubordinateConfig() + subordinate_config.certificate_authority = "certificate_authority_value" + + request = privateca_v1beta1.ActivateCertificateAuthorityRequest( + name="name_value", + pem_ca_certificate="pem_ca_certificate_value", + subordinate_config=subordinate_config, + ) + + # Make the request + operation = client.activate_certificate_authority(request=request) + + print("Waiting for operation to complete...") + + response = (await operation).result() + + # Handle the response + print(response) + +# [END privateca_v1beta1_generated_CertificateAuthorityService_ActivateCertificateAuthority_async] diff --git a/owl-bot-staging/v1beta1/samples/generated_samples/privateca_v1beta1_generated_certificate_authority_service_activate_certificate_authority_sync.py b/owl-bot-staging/v1beta1/samples/generated_samples/privateca_v1beta1_generated_certificate_authority_service_activate_certificate_authority_sync.py new file mode 100644 index 0000000..14714cb --- /dev/null +++ b/owl-bot-staging/v1beta1/samples/generated_samples/privateca_v1beta1_generated_certificate_authority_service_activate_certificate_authority_sync.py @@ -0,0 +1,61 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for ActivateCertificateAuthority +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-private-ca + + +# [START privateca_v1beta1_generated_CertificateAuthorityService_ActivateCertificateAuthority_sync] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud.security import privateca_v1beta1 + + +def sample_activate_certificate_authority(): + # Create a client + client = privateca_v1beta1.CertificateAuthorityServiceClient() + + # Initialize request argument(s) + subordinate_config = privateca_v1beta1.SubordinateConfig() + subordinate_config.certificate_authority = "certificate_authority_value" + + request = privateca_v1beta1.ActivateCertificateAuthorityRequest( + name="name_value", + pem_ca_certificate="pem_ca_certificate_value", + subordinate_config=subordinate_config, + ) + + # Make the request + operation = client.activate_certificate_authority(request=request) + + print("Waiting for operation to complete...") + + response = operation.result() + + # Handle the response + print(response) + +# [END privateca_v1beta1_generated_CertificateAuthorityService_ActivateCertificateAuthority_sync] diff --git a/owl-bot-staging/v1beta1/samples/generated_samples/privateca_v1beta1_generated_certificate_authority_service_create_certificate_async.py b/owl-bot-staging/v1beta1/samples/generated_samples/privateca_v1beta1_generated_certificate_authority_service_create_certificate_async.py new file mode 100644 index 0000000..60a4177 --- /dev/null +++ b/owl-bot-staging/v1beta1/samples/generated_samples/privateca_v1beta1_generated_certificate_authority_service_create_certificate_async.py @@ -0,0 +1,56 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for CreateCertificate +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-private-ca + + +# [START privateca_v1beta1_generated_CertificateAuthorityService_CreateCertificate_async] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud.security import privateca_v1beta1 + + +async def sample_create_certificate(): + # Create a client + client = privateca_v1beta1.CertificateAuthorityServiceAsyncClient() + + # Initialize request argument(s) + certificate = privateca_v1beta1.Certificate() + certificate.pem_csr = "pem_csr_value" + + request = privateca_v1beta1.CreateCertificateRequest( + parent="parent_value", + certificate=certificate, + ) + + # Make the request + response = await client.create_certificate(request=request) + + # Handle the response + print(response) + +# [END privateca_v1beta1_generated_CertificateAuthorityService_CreateCertificate_async] diff --git a/owl-bot-staging/v1beta1/samples/generated_samples/privateca_v1beta1_generated_certificate_authority_service_create_certificate_authority_async.py b/owl-bot-staging/v1beta1/samples/generated_samples/privateca_v1beta1_generated_certificate_authority_service_create_certificate_authority_async.py new file mode 100644 index 0000000..6bd5662 --- /dev/null +++ b/owl-bot-staging/v1beta1/samples/generated_samples/privateca_v1beta1_generated_certificate_authority_service_create_certificate_authority_async.py @@ -0,0 +1,64 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for CreateCertificateAuthority +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-private-ca + + +# [START privateca_v1beta1_generated_CertificateAuthorityService_CreateCertificateAuthority_async] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud.security import privateca_v1beta1 + + +async def sample_create_certificate_authority(): + # Create a client + client = privateca_v1beta1.CertificateAuthorityServiceAsyncClient() + + # Initialize request argument(s) + certificate_authority = privateca_v1beta1.CertificateAuthority() + certificate_authority.type_ = "SUBORDINATE" + certificate_authority.tier = "DEVOPS" + certificate_authority.config.reusable_config.reusable_config = "reusable_config_value" + certificate_authority.key_spec.cloud_kms_key_version = "cloud_kms_key_version_value" + + request = privateca_v1beta1.CreateCertificateAuthorityRequest( + parent="parent_value", + certificate_authority_id="certificate_authority_id_value", + certificate_authority=certificate_authority, + ) + + # Make the request + operation = client.create_certificate_authority(request=request) + + print("Waiting for operation to complete...") + + response = (await operation).result() + + # Handle the response + print(response) + +# [END privateca_v1beta1_generated_CertificateAuthorityService_CreateCertificateAuthority_async] diff --git a/owl-bot-staging/v1beta1/samples/generated_samples/privateca_v1beta1_generated_certificate_authority_service_create_certificate_authority_sync.py b/owl-bot-staging/v1beta1/samples/generated_samples/privateca_v1beta1_generated_certificate_authority_service_create_certificate_authority_sync.py new file mode 100644 index 0000000..e424a24 --- /dev/null +++ b/owl-bot-staging/v1beta1/samples/generated_samples/privateca_v1beta1_generated_certificate_authority_service_create_certificate_authority_sync.py @@ -0,0 +1,64 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for CreateCertificateAuthority +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-private-ca + + +# [START privateca_v1beta1_generated_CertificateAuthorityService_CreateCertificateAuthority_sync] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud.security import privateca_v1beta1 + + +def sample_create_certificate_authority(): + # Create a client + client = privateca_v1beta1.CertificateAuthorityServiceClient() + + # Initialize request argument(s) + certificate_authority = privateca_v1beta1.CertificateAuthority() + certificate_authority.type_ = "SUBORDINATE" + certificate_authority.tier = "DEVOPS" + certificate_authority.config.reusable_config.reusable_config = "reusable_config_value" + certificate_authority.key_spec.cloud_kms_key_version = "cloud_kms_key_version_value" + + request = privateca_v1beta1.CreateCertificateAuthorityRequest( + parent="parent_value", + certificate_authority_id="certificate_authority_id_value", + certificate_authority=certificate_authority, + ) + + # Make the request + operation = client.create_certificate_authority(request=request) + + print("Waiting for operation to complete...") + + response = operation.result() + + # Handle the response + print(response) + +# [END privateca_v1beta1_generated_CertificateAuthorityService_CreateCertificateAuthority_sync] diff --git a/owl-bot-staging/v1beta1/samples/generated_samples/privateca_v1beta1_generated_certificate_authority_service_create_certificate_sync.py b/owl-bot-staging/v1beta1/samples/generated_samples/privateca_v1beta1_generated_certificate_authority_service_create_certificate_sync.py new file mode 100644 index 0000000..6c98333 --- /dev/null +++ b/owl-bot-staging/v1beta1/samples/generated_samples/privateca_v1beta1_generated_certificate_authority_service_create_certificate_sync.py @@ -0,0 +1,56 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for CreateCertificate +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-private-ca + + +# [START privateca_v1beta1_generated_CertificateAuthorityService_CreateCertificate_sync] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud.security import privateca_v1beta1 + + +def sample_create_certificate(): + # Create a client + client = privateca_v1beta1.CertificateAuthorityServiceClient() + + # Initialize request argument(s) + certificate = privateca_v1beta1.Certificate() + certificate.pem_csr = "pem_csr_value" + + request = privateca_v1beta1.CreateCertificateRequest( + parent="parent_value", + certificate=certificate, + ) + + # Make the request + response = client.create_certificate(request=request) + + # Handle the response + print(response) + +# [END privateca_v1beta1_generated_CertificateAuthorityService_CreateCertificate_sync] diff --git a/owl-bot-staging/v1beta1/samples/generated_samples/privateca_v1beta1_generated_certificate_authority_service_disable_certificate_authority_async.py b/owl-bot-staging/v1beta1/samples/generated_samples/privateca_v1beta1_generated_certificate_authority_service_disable_certificate_authority_async.py new file mode 100644 index 0000000..82422e0 --- /dev/null +++ b/owl-bot-staging/v1beta1/samples/generated_samples/privateca_v1beta1_generated_certificate_authority_service_disable_certificate_authority_async.py @@ -0,0 +1,56 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for DisableCertificateAuthority +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-private-ca + + +# [START privateca_v1beta1_generated_CertificateAuthorityService_DisableCertificateAuthority_async] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud.security import privateca_v1beta1 + + +async def sample_disable_certificate_authority(): + # Create a client + client = privateca_v1beta1.CertificateAuthorityServiceAsyncClient() + + # Initialize request argument(s) + request = privateca_v1beta1.DisableCertificateAuthorityRequest( + name="name_value", + ) + + # Make the request + operation = client.disable_certificate_authority(request=request) + + print("Waiting for operation to complete...") + + response = (await operation).result() + + # Handle the response + print(response) + +# [END privateca_v1beta1_generated_CertificateAuthorityService_DisableCertificateAuthority_async] diff --git a/owl-bot-staging/v1beta1/samples/generated_samples/privateca_v1beta1_generated_certificate_authority_service_disable_certificate_authority_sync.py b/owl-bot-staging/v1beta1/samples/generated_samples/privateca_v1beta1_generated_certificate_authority_service_disable_certificate_authority_sync.py new file mode 100644 index 0000000..da11d68 --- /dev/null +++ b/owl-bot-staging/v1beta1/samples/generated_samples/privateca_v1beta1_generated_certificate_authority_service_disable_certificate_authority_sync.py @@ -0,0 +1,56 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for DisableCertificateAuthority +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-private-ca + + +# [START privateca_v1beta1_generated_CertificateAuthorityService_DisableCertificateAuthority_sync] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud.security import privateca_v1beta1 + + +def sample_disable_certificate_authority(): + # Create a client + client = privateca_v1beta1.CertificateAuthorityServiceClient() + + # Initialize request argument(s) + request = privateca_v1beta1.DisableCertificateAuthorityRequest( + name="name_value", + ) + + # Make the request + operation = client.disable_certificate_authority(request=request) + + print("Waiting for operation to complete...") + + response = operation.result() + + # Handle the response + print(response) + +# [END privateca_v1beta1_generated_CertificateAuthorityService_DisableCertificateAuthority_sync] diff --git a/owl-bot-staging/v1beta1/samples/generated_samples/privateca_v1beta1_generated_certificate_authority_service_enable_certificate_authority_async.py b/owl-bot-staging/v1beta1/samples/generated_samples/privateca_v1beta1_generated_certificate_authority_service_enable_certificate_authority_async.py new file mode 100644 index 0000000..617d347 --- /dev/null +++ b/owl-bot-staging/v1beta1/samples/generated_samples/privateca_v1beta1_generated_certificate_authority_service_enable_certificate_authority_async.py @@ -0,0 +1,56 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for EnableCertificateAuthority +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-private-ca + + +# [START privateca_v1beta1_generated_CertificateAuthorityService_EnableCertificateAuthority_async] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud.security import privateca_v1beta1 + + +async def sample_enable_certificate_authority(): + # Create a client + client = privateca_v1beta1.CertificateAuthorityServiceAsyncClient() + + # Initialize request argument(s) + request = privateca_v1beta1.EnableCertificateAuthorityRequest( + name="name_value", + ) + + # Make the request + operation = client.enable_certificate_authority(request=request) + + print("Waiting for operation to complete...") + + response = (await operation).result() + + # Handle the response + print(response) + +# [END privateca_v1beta1_generated_CertificateAuthorityService_EnableCertificateAuthority_async] diff --git a/owl-bot-staging/v1beta1/samples/generated_samples/privateca_v1beta1_generated_certificate_authority_service_enable_certificate_authority_sync.py b/owl-bot-staging/v1beta1/samples/generated_samples/privateca_v1beta1_generated_certificate_authority_service_enable_certificate_authority_sync.py new file mode 100644 index 0000000..aee82e9 --- /dev/null +++ b/owl-bot-staging/v1beta1/samples/generated_samples/privateca_v1beta1_generated_certificate_authority_service_enable_certificate_authority_sync.py @@ -0,0 +1,56 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for EnableCertificateAuthority +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-private-ca + + +# [START privateca_v1beta1_generated_CertificateAuthorityService_EnableCertificateAuthority_sync] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud.security import privateca_v1beta1 + + +def sample_enable_certificate_authority(): + # Create a client + client = privateca_v1beta1.CertificateAuthorityServiceClient() + + # Initialize request argument(s) + request = privateca_v1beta1.EnableCertificateAuthorityRequest( + name="name_value", + ) + + # Make the request + operation = client.enable_certificate_authority(request=request) + + print("Waiting for operation to complete...") + + response = operation.result() + + # Handle the response + print(response) + +# [END privateca_v1beta1_generated_CertificateAuthorityService_EnableCertificateAuthority_sync] diff --git a/owl-bot-staging/v1beta1/samples/generated_samples/privateca_v1beta1_generated_certificate_authority_service_fetch_certificate_authority_csr_async.py b/owl-bot-staging/v1beta1/samples/generated_samples/privateca_v1beta1_generated_certificate_authority_service_fetch_certificate_authority_csr_async.py new file mode 100644 index 0000000..01b0def --- /dev/null +++ b/owl-bot-staging/v1beta1/samples/generated_samples/privateca_v1beta1_generated_certificate_authority_service_fetch_certificate_authority_csr_async.py @@ -0,0 +1,52 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for FetchCertificateAuthorityCsr +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-private-ca + + +# [START privateca_v1beta1_generated_CertificateAuthorityService_FetchCertificateAuthorityCsr_async] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud.security import privateca_v1beta1 + + +async def sample_fetch_certificate_authority_csr(): + # Create a client + client = privateca_v1beta1.CertificateAuthorityServiceAsyncClient() + + # Initialize request argument(s) + request = privateca_v1beta1.FetchCertificateAuthorityCsrRequest( + name="name_value", + ) + + # Make the request + response = await client.fetch_certificate_authority_csr(request=request) + + # Handle the response + print(response) + +# [END privateca_v1beta1_generated_CertificateAuthorityService_FetchCertificateAuthorityCsr_async] diff --git a/owl-bot-staging/v1beta1/samples/generated_samples/privateca_v1beta1_generated_certificate_authority_service_fetch_certificate_authority_csr_sync.py b/owl-bot-staging/v1beta1/samples/generated_samples/privateca_v1beta1_generated_certificate_authority_service_fetch_certificate_authority_csr_sync.py new file mode 100644 index 0000000..02d884e --- /dev/null +++ b/owl-bot-staging/v1beta1/samples/generated_samples/privateca_v1beta1_generated_certificate_authority_service_fetch_certificate_authority_csr_sync.py @@ -0,0 +1,52 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for FetchCertificateAuthorityCsr +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-private-ca + + +# [START privateca_v1beta1_generated_CertificateAuthorityService_FetchCertificateAuthorityCsr_sync] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud.security import privateca_v1beta1 + + +def sample_fetch_certificate_authority_csr(): + # Create a client + client = privateca_v1beta1.CertificateAuthorityServiceClient() + + # Initialize request argument(s) + request = privateca_v1beta1.FetchCertificateAuthorityCsrRequest( + name="name_value", + ) + + # Make the request + response = client.fetch_certificate_authority_csr(request=request) + + # Handle the response + print(response) + +# [END privateca_v1beta1_generated_CertificateAuthorityService_FetchCertificateAuthorityCsr_sync] diff --git a/owl-bot-staging/v1beta1/samples/generated_samples/privateca_v1beta1_generated_certificate_authority_service_get_certificate_async.py b/owl-bot-staging/v1beta1/samples/generated_samples/privateca_v1beta1_generated_certificate_authority_service_get_certificate_async.py new file mode 100644 index 0000000..2bcb79e --- /dev/null +++ b/owl-bot-staging/v1beta1/samples/generated_samples/privateca_v1beta1_generated_certificate_authority_service_get_certificate_async.py @@ -0,0 +1,52 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for GetCertificate +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-private-ca + + +# [START privateca_v1beta1_generated_CertificateAuthorityService_GetCertificate_async] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud.security import privateca_v1beta1 + + +async def sample_get_certificate(): + # Create a client + client = privateca_v1beta1.CertificateAuthorityServiceAsyncClient() + + # Initialize request argument(s) + request = privateca_v1beta1.GetCertificateRequest( + name="name_value", + ) + + # Make the request + response = await client.get_certificate(request=request) + + # Handle the response + print(response) + +# [END privateca_v1beta1_generated_CertificateAuthorityService_GetCertificate_async] diff --git a/owl-bot-staging/v1beta1/samples/generated_samples/privateca_v1beta1_generated_certificate_authority_service_get_certificate_authority_async.py b/owl-bot-staging/v1beta1/samples/generated_samples/privateca_v1beta1_generated_certificate_authority_service_get_certificate_authority_async.py new file mode 100644 index 0000000..04d6313 --- /dev/null +++ b/owl-bot-staging/v1beta1/samples/generated_samples/privateca_v1beta1_generated_certificate_authority_service_get_certificate_authority_async.py @@ -0,0 +1,52 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for GetCertificateAuthority +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-private-ca + + +# [START privateca_v1beta1_generated_CertificateAuthorityService_GetCertificateAuthority_async] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud.security import privateca_v1beta1 + + +async def sample_get_certificate_authority(): + # Create a client + client = privateca_v1beta1.CertificateAuthorityServiceAsyncClient() + + # Initialize request argument(s) + request = privateca_v1beta1.GetCertificateAuthorityRequest( + name="name_value", + ) + + # Make the request + response = await client.get_certificate_authority(request=request) + + # Handle the response + print(response) + +# [END privateca_v1beta1_generated_CertificateAuthorityService_GetCertificateAuthority_async] diff --git a/owl-bot-staging/v1beta1/samples/generated_samples/privateca_v1beta1_generated_certificate_authority_service_get_certificate_authority_sync.py b/owl-bot-staging/v1beta1/samples/generated_samples/privateca_v1beta1_generated_certificate_authority_service_get_certificate_authority_sync.py new file mode 100644 index 0000000..a616a34 --- /dev/null +++ b/owl-bot-staging/v1beta1/samples/generated_samples/privateca_v1beta1_generated_certificate_authority_service_get_certificate_authority_sync.py @@ -0,0 +1,52 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for GetCertificateAuthority +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-private-ca + + +# [START privateca_v1beta1_generated_CertificateAuthorityService_GetCertificateAuthority_sync] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud.security import privateca_v1beta1 + + +def sample_get_certificate_authority(): + # Create a client + client = privateca_v1beta1.CertificateAuthorityServiceClient() + + # Initialize request argument(s) + request = privateca_v1beta1.GetCertificateAuthorityRequest( + name="name_value", + ) + + # Make the request + response = client.get_certificate_authority(request=request) + + # Handle the response + print(response) + +# [END privateca_v1beta1_generated_CertificateAuthorityService_GetCertificateAuthority_sync] diff --git a/owl-bot-staging/v1beta1/samples/generated_samples/privateca_v1beta1_generated_certificate_authority_service_get_certificate_revocation_list_async.py b/owl-bot-staging/v1beta1/samples/generated_samples/privateca_v1beta1_generated_certificate_authority_service_get_certificate_revocation_list_async.py new file mode 100644 index 0000000..7d12c49 --- /dev/null +++ b/owl-bot-staging/v1beta1/samples/generated_samples/privateca_v1beta1_generated_certificate_authority_service_get_certificate_revocation_list_async.py @@ -0,0 +1,52 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for GetCertificateRevocationList +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-private-ca + + +# [START privateca_v1beta1_generated_CertificateAuthorityService_GetCertificateRevocationList_async] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud.security import privateca_v1beta1 + + +async def sample_get_certificate_revocation_list(): + # Create a client + client = privateca_v1beta1.CertificateAuthorityServiceAsyncClient() + + # Initialize request argument(s) + request = privateca_v1beta1.GetCertificateRevocationListRequest( + name="name_value", + ) + + # Make the request + response = await client.get_certificate_revocation_list(request=request) + + # Handle the response + print(response) + +# [END privateca_v1beta1_generated_CertificateAuthorityService_GetCertificateRevocationList_async] diff --git a/owl-bot-staging/v1beta1/samples/generated_samples/privateca_v1beta1_generated_certificate_authority_service_get_certificate_revocation_list_sync.py b/owl-bot-staging/v1beta1/samples/generated_samples/privateca_v1beta1_generated_certificate_authority_service_get_certificate_revocation_list_sync.py new file mode 100644 index 0000000..c640ef5 --- /dev/null +++ b/owl-bot-staging/v1beta1/samples/generated_samples/privateca_v1beta1_generated_certificate_authority_service_get_certificate_revocation_list_sync.py @@ -0,0 +1,52 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for GetCertificateRevocationList +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-private-ca + + +# [START privateca_v1beta1_generated_CertificateAuthorityService_GetCertificateRevocationList_sync] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud.security import privateca_v1beta1 + + +def sample_get_certificate_revocation_list(): + # Create a client + client = privateca_v1beta1.CertificateAuthorityServiceClient() + + # Initialize request argument(s) + request = privateca_v1beta1.GetCertificateRevocationListRequest( + name="name_value", + ) + + # Make the request + response = client.get_certificate_revocation_list(request=request) + + # Handle the response + print(response) + +# [END privateca_v1beta1_generated_CertificateAuthorityService_GetCertificateRevocationList_sync] diff --git a/owl-bot-staging/v1beta1/samples/generated_samples/privateca_v1beta1_generated_certificate_authority_service_get_certificate_sync.py b/owl-bot-staging/v1beta1/samples/generated_samples/privateca_v1beta1_generated_certificate_authority_service_get_certificate_sync.py new file mode 100644 index 0000000..6605b3c --- /dev/null +++ b/owl-bot-staging/v1beta1/samples/generated_samples/privateca_v1beta1_generated_certificate_authority_service_get_certificate_sync.py @@ -0,0 +1,52 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for GetCertificate +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-private-ca + + +# [START privateca_v1beta1_generated_CertificateAuthorityService_GetCertificate_sync] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud.security import privateca_v1beta1 + + +def sample_get_certificate(): + # Create a client + client = privateca_v1beta1.CertificateAuthorityServiceClient() + + # Initialize request argument(s) + request = privateca_v1beta1.GetCertificateRequest( + name="name_value", + ) + + # Make the request + response = client.get_certificate(request=request) + + # Handle the response + print(response) + +# [END privateca_v1beta1_generated_CertificateAuthorityService_GetCertificate_sync] diff --git a/owl-bot-staging/v1beta1/samples/generated_samples/privateca_v1beta1_generated_certificate_authority_service_get_reusable_config_async.py b/owl-bot-staging/v1beta1/samples/generated_samples/privateca_v1beta1_generated_certificate_authority_service_get_reusable_config_async.py new file mode 100644 index 0000000..77b7c64 --- /dev/null +++ b/owl-bot-staging/v1beta1/samples/generated_samples/privateca_v1beta1_generated_certificate_authority_service_get_reusable_config_async.py @@ -0,0 +1,52 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for GetReusableConfig +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-private-ca + + +# [START privateca_v1beta1_generated_CertificateAuthorityService_GetReusableConfig_async] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud.security import privateca_v1beta1 + + +async def sample_get_reusable_config(): + # Create a client + client = privateca_v1beta1.CertificateAuthorityServiceAsyncClient() + + # Initialize request argument(s) + request = privateca_v1beta1.GetReusableConfigRequest( + name="name_value", + ) + + # Make the request + response = await client.get_reusable_config(request=request) + + # Handle the response + print(response) + +# [END privateca_v1beta1_generated_CertificateAuthorityService_GetReusableConfig_async] diff --git a/owl-bot-staging/v1beta1/samples/generated_samples/privateca_v1beta1_generated_certificate_authority_service_get_reusable_config_sync.py b/owl-bot-staging/v1beta1/samples/generated_samples/privateca_v1beta1_generated_certificate_authority_service_get_reusable_config_sync.py new file mode 100644 index 0000000..07f9f83 --- /dev/null +++ b/owl-bot-staging/v1beta1/samples/generated_samples/privateca_v1beta1_generated_certificate_authority_service_get_reusable_config_sync.py @@ -0,0 +1,52 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for GetReusableConfig +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-private-ca + + +# [START privateca_v1beta1_generated_CertificateAuthorityService_GetReusableConfig_sync] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud.security import privateca_v1beta1 + + +def sample_get_reusable_config(): + # Create a client + client = privateca_v1beta1.CertificateAuthorityServiceClient() + + # Initialize request argument(s) + request = privateca_v1beta1.GetReusableConfigRequest( + name="name_value", + ) + + # Make the request + response = client.get_reusable_config(request=request) + + # Handle the response + print(response) + +# [END privateca_v1beta1_generated_CertificateAuthorityService_GetReusableConfig_sync] diff --git a/owl-bot-staging/v1beta1/samples/generated_samples/privateca_v1beta1_generated_certificate_authority_service_list_certificate_authorities_async.py b/owl-bot-staging/v1beta1/samples/generated_samples/privateca_v1beta1_generated_certificate_authority_service_list_certificate_authorities_async.py new file mode 100644 index 0000000..bdbfe91 --- /dev/null +++ b/owl-bot-staging/v1beta1/samples/generated_samples/privateca_v1beta1_generated_certificate_authority_service_list_certificate_authorities_async.py @@ -0,0 +1,53 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for ListCertificateAuthorities +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-private-ca + + +# [START privateca_v1beta1_generated_CertificateAuthorityService_ListCertificateAuthorities_async] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud.security import privateca_v1beta1 + + +async def sample_list_certificate_authorities(): + # Create a client + client = privateca_v1beta1.CertificateAuthorityServiceAsyncClient() + + # Initialize request argument(s) + request = privateca_v1beta1.ListCertificateAuthoritiesRequest( + parent="parent_value", + ) + + # Make the request + page_result = client.list_certificate_authorities(request=request) + + # Handle the response + async for response in page_result: + print(response) + +# [END privateca_v1beta1_generated_CertificateAuthorityService_ListCertificateAuthorities_async] diff --git a/owl-bot-staging/v1beta1/samples/generated_samples/privateca_v1beta1_generated_certificate_authority_service_list_certificate_authorities_sync.py b/owl-bot-staging/v1beta1/samples/generated_samples/privateca_v1beta1_generated_certificate_authority_service_list_certificate_authorities_sync.py new file mode 100644 index 0000000..be78a7e --- /dev/null +++ b/owl-bot-staging/v1beta1/samples/generated_samples/privateca_v1beta1_generated_certificate_authority_service_list_certificate_authorities_sync.py @@ -0,0 +1,53 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for ListCertificateAuthorities +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-private-ca + + +# [START privateca_v1beta1_generated_CertificateAuthorityService_ListCertificateAuthorities_sync] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud.security import privateca_v1beta1 + + +def sample_list_certificate_authorities(): + # Create a client + client = privateca_v1beta1.CertificateAuthorityServiceClient() + + # Initialize request argument(s) + request = privateca_v1beta1.ListCertificateAuthoritiesRequest( + parent="parent_value", + ) + + # Make the request + page_result = client.list_certificate_authorities(request=request) + + # Handle the response + for response in page_result: + print(response) + +# [END privateca_v1beta1_generated_CertificateAuthorityService_ListCertificateAuthorities_sync] diff --git a/owl-bot-staging/v1beta1/samples/generated_samples/privateca_v1beta1_generated_certificate_authority_service_list_certificate_revocation_lists_async.py b/owl-bot-staging/v1beta1/samples/generated_samples/privateca_v1beta1_generated_certificate_authority_service_list_certificate_revocation_lists_async.py new file mode 100644 index 0000000..7dcd2e0 --- /dev/null +++ b/owl-bot-staging/v1beta1/samples/generated_samples/privateca_v1beta1_generated_certificate_authority_service_list_certificate_revocation_lists_async.py @@ -0,0 +1,53 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for ListCertificateRevocationLists +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-private-ca + + +# [START privateca_v1beta1_generated_CertificateAuthorityService_ListCertificateRevocationLists_async] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud.security import privateca_v1beta1 + + +async def sample_list_certificate_revocation_lists(): + # Create a client + client = privateca_v1beta1.CertificateAuthorityServiceAsyncClient() + + # Initialize request argument(s) + request = privateca_v1beta1.ListCertificateRevocationListsRequest( + parent="parent_value", + ) + + # Make the request + page_result = client.list_certificate_revocation_lists(request=request) + + # Handle the response + async for response in page_result: + print(response) + +# [END privateca_v1beta1_generated_CertificateAuthorityService_ListCertificateRevocationLists_async] diff --git a/owl-bot-staging/v1beta1/samples/generated_samples/privateca_v1beta1_generated_certificate_authority_service_list_certificate_revocation_lists_sync.py b/owl-bot-staging/v1beta1/samples/generated_samples/privateca_v1beta1_generated_certificate_authority_service_list_certificate_revocation_lists_sync.py new file mode 100644 index 0000000..5ad590f --- /dev/null +++ b/owl-bot-staging/v1beta1/samples/generated_samples/privateca_v1beta1_generated_certificate_authority_service_list_certificate_revocation_lists_sync.py @@ -0,0 +1,53 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for ListCertificateRevocationLists +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-private-ca + + +# [START privateca_v1beta1_generated_CertificateAuthorityService_ListCertificateRevocationLists_sync] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud.security import privateca_v1beta1 + + +def sample_list_certificate_revocation_lists(): + # Create a client + client = privateca_v1beta1.CertificateAuthorityServiceClient() + + # Initialize request argument(s) + request = privateca_v1beta1.ListCertificateRevocationListsRequest( + parent="parent_value", + ) + + # Make the request + page_result = client.list_certificate_revocation_lists(request=request) + + # Handle the response + for response in page_result: + print(response) + +# [END privateca_v1beta1_generated_CertificateAuthorityService_ListCertificateRevocationLists_sync] diff --git a/owl-bot-staging/v1beta1/samples/generated_samples/privateca_v1beta1_generated_certificate_authority_service_list_certificates_async.py b/owl-bot-staging/v1beta1/samples/generated_samples/privateca_v1beta1_generated_certificate_authority_service_list_certificates_async.py new file mode 100644 index 0000000..9f76954 --- /dev/null +++ b/owl-bot-staging/v1beta1/samples/generated_samples/privateca_v1beta1_generated_certificate_authority_service_list_certificates_async.py @@ -0,0 +1,53 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for ListCertificates +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-private-ca + + +# [START privateca_v1beta1_generated_CertificateAuthorityService_ListCertificates_async] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud.security import privateca_v1beta1 + + +async def sample_list_certificates(): + # Create a client + client = privateca_v1beta1.CertificateAuthorityServiceAsyncClient() + + # Initialize request argument(s) + request = privateca_v1beta1.ListCertificatesRequest( + parent="parent_value", + ) + + # Make the request + page_result = client.list_certificates(request=request) + + # Handle the response + async for response in page_result: + print(response) + +# [END privateca_v1beta1_generated_CertificateAuthorityService_ListCertificates_async] diff --git a/owl-bot-staging/v1beta1/samples/generated_samples/privateca_v1beta1_generated_certificate_authority_service_list_certificates_sync.py b/owl-bot-staging/v1beta1/samples/generated_samples/privateca_v1beta1_generated_certificate_authority_service_list_certificates_sync.py new file mode 100644 index 0000000..36ef888 --- /dev/null +++ b/owl-bot-staging/v1beta1/samples/generated_samples/privateca_v1beta1_generated_certificate_authority_service_list_certificates_sync.py @@ -0,0 +1,53 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for ListCertificates +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-private-ca + + +# [START privateca_v1beta1_generated_CertificateAuthorityService_ListCertificates_sync] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud.security import privateca_v1beta1 + + +def sample_list_certificates(): + # Create a client + client = privateca_v1beta1.CertificateAuthorityServiceClient() + + # Initialize request argument(s) + request = privateca_v1beta1.ListCertificatesRequest( + parent="parent_value", + ) + + # Make the request + page_result = client.list_certificates(request=request) + + # Handle the response + for response in page_result: + print(response) + +# [END privateca_v1beta1_generated_CertificateAuthorityService_ListCertificates_sync] diff --git a/owl-bot-staging/v1beta1/samples/generated_samples/privateca_v1beta1_generated_certificate_authority_service_list_reusable_configs_async.py b/owl-bot-staging/v1beta1/samples/generated_samples/privateca_v1beta1_generated_certificate_authority_service_list_reusable_configs_async.py new file mode 100644 index 0000000..dc56521 --- /dev/null +++ b/owl-bot-staging/v1beta1/samples/generated_samples/privateca_v1beta1_generated_certificate_authority_service_list_reusable_configs_async.py @@ -0,0 +1,53 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for ListReusableConfigs +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-private-ca + + +# [START privateca_v1beta1_generated_CertificateAuthorityService_ListReusableConfigs_async] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud.security import privateca_v1beta1 + + +async def sample_list_reusable_configs(): + # Create a client + client = privateca_v1beta1.CertificateAuthorityServiceAsyncClient() + + # Initialize request argument(s) + request = privateca_v1beta1.ListReusableConfigsRequest( + parent="parent_value", + ) + + # Make the request + page_result = client.list_reusable_configs(request=request) + + # Handle the response + async for response in page_result: + print(response) + +# [END privateca_v1beta1_generated_CertificateAuthorityService_ListReusableConfigs_async] diff --git a/owl-bot-staging/v1beta1/samples/generated_samples/privateca_v1beta1_generated_certificate_authority_service_list_reusable_configs_sync.py b/owl-bot-staging/v1beta1/samples/generated_samples/privateca_v1beta1_generated_certificate_authority_service_list_reusable_configs_sync.py new file mode 100644 index 0000000..07a1245 --- /dev/null +++ b/owl-bot-staging/v1beta1/samples/generated_samples/privateca_v1beta1_generated_certificate_authority_service_list_reusable_configs_sync.py @@ -0,0 +1,53 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for ListReusableConfigs +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-private-ca + + +# [START privateca_v1beta1_generated_CertificateAuthorityService_ListReusableConfigs_sync] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud.security import privateca_v1beta1 + + +def sample_list_reusable_configs(): + # Create a client + client = privateca_v1beta1.CertificateAuthorityServiceClient() + + # Initialize request argument(s) + request = privateca_v1beta1.ListReusableConfigsRequest( + parent="parent_value", + ) + + # Make the request + page_result = client.list_reusable_configs(request=request) + + # Handle the response + for response in page_result: + print(response) + +# [END privateca_v1beta1_generated_CertificateAuthorityService_ListReusableConfigs_sync] diff --git a/owl-bot-staging/v1beta1/samples/generated_samples/privateca_v1beta1_generated_certificate_authority_service_restore_certificate_authority_async.py b/owl-bot-staging/v1beta1/samples/generated_samples/privateca_v1beta1_generated_certificate_authority_service_restore_certificate_authority_async.py new file mode 100644 index 0000000..8f27dfc --- /dev/null +++ b/owl-bot-staging/v1beta1/samples/generated_samples/privateca_v1beta1_generated_certificate_authority_service_restore_certificate_authority_async.py @@ -0,0 +1,56 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for RestoreCertificateAuthority +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-private-ca + + +# [START privateca_v1beta1_generated_CertificateAuthorityService_RestoreCertificateAuthority_async] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud.security import privateca_v1beta1 + + +async def sample_restore_certificate_authority(): + # Create a client + client = privateca_v1beta1.CertificateAuthorityServiceAsyncClient() + + # Initialize request argument(s) + request = privateca_v1beta1.RestoreCertificateAuthorityRequest( + name="name_value", + ) + + # Make the request + operation = client.restore_certificate_authority(request=request) + + print("Waiting for operation to complete...") + + response = (await operation).result() + + # Handle the response + print(response) + +# [END privateca_v1beta1_generated_CertificateAuthorityService_RestoreCertificateAuthority_async] diff --git a/owl-bot-staging/v1beta1/samples/generated_samples/privateca_v1beta1_generated_certificate_authority_service_restore_certificate_authority_sync.py b/owl-bot-staging/v1beta1/samples/generated_samples/privateca_v1beta1_generated_certificate_authority_service_restore_certificate_authority_sync.py new file mode 100644 index 0000000..71aab92 --- /dev/null +++ b/owl-bot-staging/v1beta1/samples/generated_samples/privateca_v1beta1_generated_certificate_authority_service_restore_certificate_authority_sync.py @@ -0,0 +1,56 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for RestoreCertificateAuthority +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-private-ca + + +# [START privateca_v1beta1_generated_CertificateAuthorityService_RestoreCertificateAuthority_sync] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud.security import privateca_v1beta1 + + +def sample_restore_certificate_authority(): + # Create a client + client = privateca_v1beta1.CertificateAuthorityServiceClient() + + # Initialize request argument(s) + request = privateca_v1beta1.RestoreCertificateAuthorityRequest( + name="name_value", + ) + + # Make the request + operation = client.restore_certificate_authority(request=request) + + print("Waiting for operation to complete...") + + response = operation.result() + + # Handle the response + print(response) + +# [END privateca_v1beta1_generated_CertificateAuthorityService_RestoreCertificateAuthority_sync] diff --git a/owl-bot-staging/v1beta1/samples/generated_samples/privateca_v1beta1_generated_certificate_authority_service_revoke_certificate_async.py b/owl-bot-staging/v1beta1/samples/generated_samples/privateca_v1beta1_generated_certificate_authority_service_revoke_certificate_async.py new file mode 100644 index 0000000..b909a8a --- /dev/null +++ b/owl-bot-staging/v1beta1/samples/generated_samples/privateca_v1beta1_generated_certificate_authority_service_revoke_certificate_async.py @@ -0,0 +1,53 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for RevokeCertificate +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-private-ca + + +# [START privateca_v1beta1_generated_CertificateAuthorityService_RevokeCertificate_async] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud.security import privateca_v1beta1 + + +async def sample_revoke_certificate(): + # Create a client + client = privateca_v1beta1.CertificateAuthorityServiceAsyncClient() + + # Initialize request argument(s) + request = privateca_v1beta1.RevokeCertificateRequest( + name="name_value", + reason="ATTRIBUTE_AUTHORITY_COMPROMISE", + ) + + # Make the request + response = await client.revoke_certificate(request=request) + + # Handle the response + print(response) + +# [END privateca_v1beta1_generated_CertificateAuthorityService_RevokeCertificate_async] diff --git a/owl-bot-staging/v1beta1/samples/generated_samples/privateca_v1beta1_generated_certificate_authority_service_revoke_certificate_sync.py b/owl-bot-staging/v1beta1/samples/generated_samples/privateca_v1beta1_generated_certificate_authority_service_revoke_certificate_sync.py new file mode 100644 index 0000000..45b4553 --- /dev/null +++ b/owl-bot-staging/v1beta1/samples/generated_samples/privateca_v1beta1_generated_certificate_authority_service_revoke_certificate_sync.py @@ -0,0 +1,53 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for RevokeCertificate +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-private-ca + + +# [START privateca_v1beta1_generated_CertificateAuthorityService_RevokeCertificate_sync] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud.security import privateca_v1beta1 + + +def sample_revoke_certificate(): + # Create a client + client = privateca_v1beta1.CertificateAuthorityServiceClient() + + # Initialize request argument(s) + request = privateca_v1beta1.RevokeCertificateRequest( + name="name_value", + reason="ATTRIBUTE_AUTHORITY_COMPROMISE", + ) + + # Make the request + response = client.revoke_certificate(request=request) + + # Handle the response + print(response) + +# [END privateca_v1beta1_generated_CertificateAuthorityService_RevokeCertificate_sync] diff --git a/owl-bot-staging/v1beta1/samples/generated_samples/privateca_v1beta1_generated_certificate_authority_service_schedule_delete_certificate_authority_async.py b/owl-bot-staging/v1beta1/samples/generated_samples/privateca_v1beta1_generated_certificate_authority_service_schedule_delete_certificate_authority_async.py new file mode 100644 index 0000000..e138cc8 --- /dev/null +++ b/owl-bot-staging/v1beta1/samples/generated_samples/privateca_v1beta1_generated_certificate_authority_service_schedule_delete_certificate_authority_async.py @@ -0,0 +1,56 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for ScheduleDeleteCertificateAuthority +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-private-ca + + +# [START privateca_v1beta1_generated_CertificateAuthorityService_ScheduleDeleteCertificateAuthority_async] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud.security import privateca_v1beta1 + + +async def sample_schedule_delete_certificate_authority(): + # Create a client + client = privateca_v1beta1.CertificateAuthorityServiceAsyncClient() + + # Initialize request argument(s) + request = privateca_v1beta1.ScheduleDeleteCertificateAuthorityRequest( + name="name_value", + ) + + # Make the request + operation = client.schedule_delete_certificate_authority(request=request) + + print("Waiting for operation to complete...") + + response = (await operation).result() + + # Handle the response + print(response) + +# [END privateca_v1beta1_generated_CertificateAuthorityService_ScheduleDeleteCertificateAuthority_async] diff --git a/owl-bot-staging/v1beta1/samples/generated_samples/privateca_v1beta1_generated_certificate_authority_service_schedule_delete_certificate_authority_sync.py b/owl-bot-staging/v1beta1/samples/generated_samples/privateca_v1beta1_generated_certificate_authority_service_schedule_delete_certificate_authority_sync.py new file mode 100644 index 0000000..29389bc --- /dev/null +++ b/owl-bot-staging/v1beta1/samples/generated_samples/privateca_v1beta1_generated_certificate_authority_service_schedule_delete_certificate_authority_sync.py @@ -0,0 +1,56 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for ScheduleDeleteCertificateAuthority +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-private-ca + + +# [START privateca_v1beta1_generated_CertificateAuthorityService_ScheduleDeleteCertificateAuthority_sync] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud.security import privateca_v1beta1 + + +def sample_schedule_delete_certificate_authority(): + # Create a client + client = privateca_v1beta1.CertificateAuthorityServiceClient() + + # Initialize request argument(s) + request = privateca_v1beta1.ScheduleDeleteCertificateAuthorityRequest( + name="name_value", + ) + + # Make the request + operation = client.schedule_delete_certificate_authority(request=request) + + print("Waiting for operation to complete...") + + response = operation.result() + + # Handle the response + print(response) + +# [END privateca_v1beta1_generated_CertificateAuthorityService_ScheduleDeleteCertificateAuthority_sync] diff --git a/owl-bot-staging/v1beta1/samples/generated_samples/privateca_v1beta1_generated_certificate_authority_service_update_certificate_async.py b/owl-bot-staging/v1beta1/samples/generated_samples/privateca_v1beta1_generated_certificate_authority_service_update_certificate_async.py new file mode 100644 index 0000000..6a48c31 --- /dev/null +++ b/owl-bot-staging/v1beta1/samples/generated_samples/privateca_v1beta1_generated_certificate_authority_service_update_certificate_async.py @@ -0,0 +1,55 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for UpdateCertificate +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-private-ca + + +# [START privateca_v1beta1_generated_CertificateAuthorityService_UpdateCertificate_async] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud.security import privateca_v1beta1 + + +async def sample_update_certificate(): + # Create a client + client = privateca_v1beta1.CertificateAuthorityServiceAsyncClient() + + # Initialize request argument(s) + certificate = privateca_v1beta1.Certificate() + certificate.pem_csr = "pem_csr_value" + + request = privateca_v1beta1.UpdateCertificateRequest( + certificate=certificate, + ) + + # Make the request + response = await client.update_certificate(request=request) + + # Handle the response + print(response) + +# [END privateca_v1beta1_generated_CertificateAuthorityService_UpdateCertificate_async] diff --git a/owl-bot-staging/v1beta1/samples/generated_samples/privateca_v1beta1_generated_certificate_authority_service_update_certificate_authority_async.py b/owl-bot-staging/v1beta1/samples/generated_samples/privateca_v1beta1_generated_certificate_authority_service_update_certificate_authority_async.py new file mode 100644 index 0000000..42ac5e4 --- /dev/null +++ b/owl-bot-staging/v1beta1/samples/generated_samples/privateca_v1beta1_generated_certificate_authority_service_update_certificate_authority_async.py @@ -0,0 +1,62 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for UpdateCertificateAuthority +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-private-ca + + +# [START privateca_v1beta1_generated_CertificateAuthorityService_UpdateCertificateAuthority_async] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud.security import privateca_v1beta1 + + +async def sample_update_certificate_authority(): + # Create a client + client = privateca_v1beta1.CertificateAuthorityServiceAsyncClient() + + # Initialize request argument(s) + certificate_authority = privateca_v1beta1.CertificateAuthority() + certificate_authority.type_ = "SUBORDINATE" + certificate_authority.tier = "DEVOPS" + certificate_authority.config.reusable_config.reusable_config = "reusable_config_value" + certificate_authority.key_spec.cloud_kms_key_version = "cloud_kms_key_version_value" + + request = privateca_v1beta1.UpdateCertificateAuthorityRequest( + certificate_authority=certificate_authority, + ) + + # Make the request + operation = client.update_certificate_authority(request=request) + + print("Waiting for operation to complete...") + + response = (await operation).result() + + # Handle the response + print(response) + +# [END privateca_v1beta1_generated_CertificateAuthorityService_UpdateCertificateAuthority_async] diff --git a/owl-bot-staging/v1beta1/samples/generated_samples/privateca_v1beta1_generated_certificate_authority_service_update_certificate_authority_sync.py b/owl-bot-staging/v1beta1/samples/generated_samples/privateca_v1beta1_generated_certificate_authority_service_update_certificate_authority_sync.py new file mode 100644 index 0000000..8a65090 --- /dev/null +++ b/owl-bot-staging/v1beta1/samples/generated_samples/privateca_v1beta1_generated_certificate_authority_service_update_certificate_authority_sync.py @@ -0,0 +1,62 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for UpdateCertificateAuthority +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-private-ca + + +# [START privateca_v1beta1_generated_CertificateAuthorityService_UpdateCertificateAuthority_sync] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud.security import privateca_v1beta1 + + +def sample_update_certificate_authority(): + # Create a client + client = privateca_v1beta1.CertificateAuthorityServiceClient() + + # Initialize request argument(s) + certificate_authority = privateca_v1beta1.CertificateAuthority() + certificate_authority.type_ = "SUBORDINATE" + certificate_authority.tier = "DEVOPS" + certificate_authority.config.reusable_config.reusable_config = "reusable_config_value" + certificate_authority.key_spec.cloud_kms_key_version = "cloud_kms_key_version_value" + + request = privateca_v1beta1.UpdateCertificateAuthorityRequest( + certificate_authority=certificate_authority, + ) + + # Make the request + operation = client.update_certificate_authority(request=request) + + print("Waiting for operation to complete...") + + response = operation.result() + + # Handle the response + print(response) + +# [END privateca_v1beta1_generated_CertificateAuthorityService_UpdateCertificateAuthority_sync] diff --git a/owl-bot-staging/v1beta1/samples/generated_samples/privateca_v1beta1_generated_certificate_authority_service_update_certificate_revocation_list_async.py b/owl-bot-staging/v1beta1/samples/generated_samples/privateca_v1beta1_generated_certificate_authority_service_update_certificate_revocation_list_async.py new file mode 100644 index 0000000..a68f06a --- /dev/null +++ b/owl-bot-staging/v1beta1/samples/generated_samples/privateca_v1beta1_generated_certificate_authority_service_update_certificate_revocation_list_async.py @@ -0,0 +1,55 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for UpdateCertificateRevocationList +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-private-ca + + +# [START privateca_v1beta1_generated_CertificateAuthorityService_UpdateCertificateRevocationList_async] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud.security import privateca_v1beta1 + + +async def sample_update_certificate_revocation_list(): + # Create a client + client = privateca_v1beta1.CertificateAuthorityServiceAsyncClient() + + # Initialize request argument(s) + request = privateca_v1beta1.UpdateCertificateRevocationListRequest( + ) + + # Make the request + operation = client.update_certificate_revocation_list(request=request) + + print("Waiting for operation to complete...") + + response = (await operation).result() + + # Handle the response + print(response) + +# [END privateca_v1beta1_generated_CertificateAuthorityService_UpdateCertificateRevocationList_async] diff --git a/owl-bot-staging/v1beta1/samples/generated_samples/privateca_v1beta1_generated_certificate_authority_service_update_certificate_revocation_list_sync.py b/owl-bot-staging/v1beta1/samples/generated_samples/privateca_v1beta1_generated_certificate_authority_service_update_certificate_revocation_list_sync.py new file mode 100644 index 0000000..3ae5dda --- /dev/null +++ b/owl-bot-staging/v1beta1/samples/generated_samples/privateca_v1beta1_generated_certificate_authority_service_update_certificate_revocation_list_sync.py @@ -0,0 +1,55 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for UpdateCertificateRevocationList +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-private-ca + + +# [START privateca_v1beta1_generated_CertificateAuthorityService_UpdateCertificateRevocationList_sync] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud.security import privateca_v1beta1 + + +def sample_update_certificate_revocation_list(): + # Create a client + client = privateca_v1beta1.CertificateAuthorityServiceClient() + + # Initialize request argument(s) + request = privateca_v1beta1.UpdateCertificateRevocationListRequest( + ) + + # Make the request + operation = client.update_certificate_revocation_list(request=request) + + print("Waiting for operation to complete...") + + response = operation.result() + + # Handle the response + print(response) + +# [END privateca_v1beta1_generated_CertificateAuthorityService_UpdateCertificateRevocationList_sync] diff --git a/owl-bot-staging/v1beta1/samples/generated_samples/privateca_v1beta1_generated_certificate_authority_service_update_certificate_sync.py b/owl-bot-staging/v1beta1/samples/generated_samples/privateca_v1beta1_generated_certificate_authority_service_update_certificate_sync.py new file mode 100644 index 0000000..44beba8 --- /dev/null +++ b/owl-bot-staging/v1beta1/samples/generated_samples/privateca_v1beta1_generated_certificate_authority_service_update_certificate_sync.py @@ -0,0 +1,55 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for UpdateCertificate +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-private-ca + + +# [START privateca_v1beta1_generated_CertificateAuthorityService_UpdateCertificate_sync] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.cloud.security import privateca_v1beta1 + + +def sample_update_certificate(): + # Create a client + client = privateca_v1beta1.CertificateAuthorityServiceClient() + + # Initialize request argument(s) + certificate = privateca_v1beta1.Certificate() + certificate.pem_csr = "pem_csr_value" + + request = privateca_v1beta1.UpdateCertificateRequest( + certificate=certificate, + ) + + # Make the request + response = client.update_certificate(request=request) + + # Handle the response + print(response) + +# [END privateca_v1beta1_generated_CertificateAuthorityService_UpdateCertificate_sync] diff --git a/owl-bot-staging/v1beta1/samples/generated_samples/snippet_metadata_google.cloud.security.privateca.v1beta1.json b/owl-bot-staging/v1beta1/samples/generated_samples/snippet_metadata_google.cloud.security.privateca.v1beta1.json new file mode 100644 index 0000000..d9af1f5 --- /dev/null +++ b/owl-bot-staging/v1beta1/samples/generated_samples/snippet_metadata_google.cloud.security.privateca.v1beta1.json @@ -0,0 +1,3291 @@ +{ + "clientLibrary": { + "apis": [ + { + "id": "google.cloud.security.privateca.v1beta1", + "version": "v1beta1" + } + ], + "language": "PYTHON", + "name": "google-cloud-private-ca", + "version": "0.1.0" + }, + "snippets": [ + { + "canonical": true, + "clientMethod": { + "async": true, + "client": { + "fullName": "google.cloud.security.privateca_v1beta1.CertificateAuthorityServiceAsyncClient", + "shortName": "CertificateAuthorityServiceAsyncClient" + }, + "fullName": "google.cloud.security.privateca_v1beta1.CertificateAuthorityServiceAsyncClient.activate_certificate_authority", + "method": { + "fullName": "google.cloud.security.privateca.v1beta1.CertificateAuthorityService.ActivateCertificateAuthority", + "service": { + "fullName": "google.cloud.security.privateca.v1beta1.CertificateAuthorityService", + "shortName": "CertificateAuthorityService" + }, + "shortName": "ActivateCertificateAuthority" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.security.privateca_v1beta1.types.ActivateCertificateAuthorityRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.api_core.operation_async.AsyncOperation", + "shortName": "activate_certificate_authority" + }, + "description": "Sample for ActivateCertificateAuthority", + "file": "privateca_v1beta1_generated_certificate_authority_service_activate_certificate_authority_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "privateca_v1beta1_generated_CertificateAuthorityService_ActivateCertificateAuthority_async", + "segments": [ + { + "end": 60, + "start": 27, + "type": "FULL" + }, + { + "end": 60, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 50, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 57, + "start": 51, + "type": "REQUEST_EXECUTION" + }, + { + "end": 61, + "start": 58, + "type": "RESPONSE_HANDLING" + } + ], + "title": "privateca_v1beta1_generated_certificate_authority_service_activate_certificate_authority_async.py" + }, + { + "canonical": true, + "clientMethod": { + "client": { + "fullName": "google.cloud.security.privateca_v1beta1.CertificateAuthorityServiceClient", + "shortName": "CertificateAuthorityServiceClient" + }, + "fullName": "google.cloud.security.privateca_v1beta1.CertificateAuthorityServiceClient.activate_certificate_authority", + "method": { + "fullName": "google.cloud.security.privateca.v1beta1.CertificateAuthorityService.ActivateCertificateAuthority", + "service": { + "fullName": "google.cloud.security.privateca.v1beta1.CertificateAuthorityService", + "shortName": "CertificateAuthorityService" + }, + "shortName": "ActivateCertificateAuthority" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.security.privateca_v1beta1.types.ActivateCertificateAuthorityRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.api_core.operation.Operation", + "shortName": "activate_certificate_authority" + }, + "description": "Sample for ActivateCertificateAuthority", + "file": "privateca_v1beta1_generated_certificate_authority_service_activate_certificate_authority_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "privateca_v1beta1_generated_CertificateAuthorityService_ActivateCertificateAuthority_sync", + "segments": [ + { + "end": 60, + "start": 27, + "type": "FULL" + }, + { + "end": 60, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 50, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 57, + "start": 51, + "type": "REQUEST_EXECUTION" + }, + { + "end": 61, + "start": 58, + "type": "RESPONSE_HANDLING" + } + ], + "title": "privateca_v1beta1_generated_certificate_authority_service_activate_certificate_authority_sync.py" + }, + { + "canonical": true, + "clientMethod": { + "async": true, + "client": { + "fullName": "google.cloud.security.privateca_v1beta1.CertificateAuthorityServiceAsyncClient", + "shortName": "CertificateAuthorityServiceAsyncClient" + }, + "fullName": "google.cloud.security.privateca_v1beta1.CertificateAuthorityServiceAsyncClient.create_certificate_authority", + "method": { + "fullName": "google.cloud.security.privateca.v1beta1.CertificateAuthorityService.CreateCertificateAuthority", + "service": { + "fullName": "google.cloud.security.privateca.v1beta1.CertificateAuthorityService", + "shortName": "CertificateAuthorityService" + }, + "shortName": "CreateCertificateAuthority" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.security.privateca_v1beta1.types.CreateCertificateAuthorityRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "certificate_authority", + "type": "google.cloud.security.privateca_v1beta1.types.CertificateAuthority" + }, + { + "name": "certificate_authority_id", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.api_core.operation_async.AsyncOperation", + "shortName": "create_certificate_authority" + }, + "description": "Sample for CreateCertificateAuthority", + "file": "privateca_v1beta1_generated_certificate_authority_service_create_certificate_authority_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "privateca_v1beta1_generated_CertificateAuthorityService_CreateCertificateAuthority_async", + "segments": [ + { + "end": 63, + "start": 27, + "type": "FULL" + }, + { + "end": 63, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 53, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 60, + "start": 54, + "type": "REQUEST_EXECUTION" + }, + { + "end": 64, + "start": 61, + "type": "RESPONSE_HANDLING" + } + ], + "title": "privateca_v1beta1_generated_certificate_authority_service_create_certificate_authority_async.py" + }, + { + "canonical": true, + "clientMethod": { + "client": { + "fullName": "google.cloud.security.privateca_v1beta1.CertificateAuthorityServiceClient", + "shortName": "CertificateAuthorityServiceClient" + }, + "fullName": "google.cloud.security.privateca_v1beta1.CertificateAuthorityServiceClient.create_certificate_authority", + "method": { + "fullName": "google.cloud.security.privateca.v1beta1.CertificateAuthorityService.CreateCertificateAuthority", + "service": { + "fullName": "google.cloud.security.privateca.v1beta1.CertificateAuthorityService", + "shortName": "CertificateAuthorityService" + }, + "shortName": "CreateCertificateAuthority" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.security.privateca_v1beta1.types.CreateCertificateAuthorityRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "certificate_authority", + "type": "google.cloud.security.privateca_v1beta1.types.CertificateAuthority" + }, + { + "name": "certificate_authority_id", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.api_core.operation.Operation", + "shortName": "create_certificate_authority" + }, + "description": "Sample for CreateCertificateAuthority", + "file": "privateca_v1beta1_generated_certificate_authority_service_create_certificate_authority_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "privateca_v1beta1_generated_CertificateAuthorityService_CreateCertificateAuthority_sync", + "segments": [ + { + "end": 63, + "start": 27, + "type": "FULL" + }, + { + "end": 63, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 53, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 60, + "start": 54, + "type": "REQUEST_EXECUTION" + }, + { + "end": 64, + "start": 61, + "type": "RESPONSE_HANDLING" + } + ], + "title": "privateca_v1beta1_generated_certificate_authority_service_create_certificate_authority_sync.py" + }, + { + "canonical": true, + "clientMethod": { + "async": true, + "client": { + "fullName": "google.cloud.security.privateca_v1beta1.CertificateAuthorityServiceAsyncClient", + "shortName": "CertificateAuthorityServiceAsyncClient" + }, + "fullName": "google.cloud.security.privateca_v1beta1.CertificateAuthorityServiceAsyncClient.create_certificate", + "method": { + "fullName": "google.cloud.security.privateca.v1beta1.CertificateAuthorityService.CreateCertificate", + "service": { + "fullName": "google.cloud.security.privateca.v1beta1.CertificateAuthorityService", + "shortName": "CertificateAuthorityService" + }, + "shortName": "CreateCertificate" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.security.privateca_v1beta1.types.CreateCertificateRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "certificate", + "type": "google.cloud.security.privateca_v1beta1.types.Certificate" + }, + { + "name": "certificate_id", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.security.privateca_v1beta1.types.Certificate", + "shortName": "create_certificate" + }, + "description": "Sample for CreateCertificate", + "file": "privateca_v1beta1_generated_certificate_authority_service_create_certificate_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "privateca_v1beta1_generated_CertificateAuthorityService_CreateCertificate_async", + "segments": [ + { + "end": 55, + "start": 27, + "type": "FULL" + }, + { + "end": 55, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 49, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 52, + "start": 50, + "type": "REQUEST_EXECUTION" + }, + { + "end": 56, + "start": 53, + "type": "RESPONSE_HANDLING" + } + ], + "title": "privateca_v1beta1_generated_certificate_authority_service_create_certificate_async.py" + }, + { + "canonical": true, + "clientMethod": { + "client": { + "fullName": "google.cloud.security.privateca_v1beta1.CertificateAuthorityServiceClient", + "shortName": "CertificateAuthorityServiceClient" + }, + "fullName": "google.cloud.security.privateca_v1beta1.CertificateAuthorityServiceClient.create_certificate", + "method": { + "fullName": "google.cloud.security.privateca.v1beta1.CertificateAuthorityService.CreateCertificate", + "service": { + "fullName": "google.cloud.security.privateca.v1beta1.CertificateAuthorityService", + "shortName": "CertificateAuthorityService" + }, + "shortName": "CreateCertificate" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.security.privateca_v1beta1.types.CreateCertificateRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "certificate", + "type": "google.cloud.security.privateca_v1beta1.types.Certificate" + }, + { + "name": "certificate_id", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.security.privateca_v1beta1.types.Certificate", + "shortName": "create_certificate" + }, + "description": "Sample for CreateCertificate", + "file": "privateca_v1beta1_generated_certificate_authority_service_create_certificate_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "privateca_v1beta1_generated_CertificateAuthorityService_CreateCertificate_sync", + "segments": [ + { + "end": 55, + "start": 27, + "type": "FULL" + }, + { + "end": 55, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 49, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 52, + "start": 50, + "type": "REQUEST_EXECUTION" + }, + { + "end": 56, + "start": 53, + "type": "RESPONSE_HANDLING" + } + ], + "title": "privateca_v1beta1_generated_certificate_authority_service_create_certificate_sync.py" + }, + { + "canonical": true, + "clientMethod": { + "async": true, + "client": { + "fullName": "google.cloud.security.privateca_v1beta1.CertificateAuthorityServiceAsyncClient", + "shortName": "CertificateAuthorityServiceAsyncClient" + }, + "fullName": "google.cloud.security.privateca_v1beta1.CertificateAuthorityServiceAsyncClient.disable_certificate_authority", + "method": { + "fullName": "google.cloud.security.privateca.v1beta1.CertificateAuthorityService.DisableCertificateAuthority", + "service": { + "fullName": "google.cloud.security.privateca.v1beta1.CertificateAuthorityService", + "shortName": "CertificateAuthorityService" + }, + "shortName": "DisableCertificateAuthority" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.security.privateca_v1beta1.types.DisableCertificateAuthorityRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.api_core.operation_async.AsyncOperation", + "shortName": "disable_certificate_authority" + }, + "description": "Sample for DisableCertificateAuthority", + "file": "privateca_v1beta1_generated_certificate_authority_service_disable_certificate_authority_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "privateca_v1beta1_generated_CertificateAuthorityService_DisableCertificateAuthority_async", + "segments": [ + { + "end": 55, + "start": 27, + "type": "FULL" + }, + { + "end": 55, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 45, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 52, + "start": 46, + "type": "REQUEST_EXECUTION" + }, + { + "end": 56, + "start": 53, + "type": "RESPONSE_HANDLING" + } + ], + "title": "privateca_v1beta1_generated_certificate_authority_service_disable_certificate_authority_async.py" + }, + { + "canonical": true, + "clientMethod": { + "client": { + "fullName": "google.cloud.security.privateca_v1beta1.CertificateAuthorityServiceClient", + "shortName": "CertificateAuthorityServiceClient" + }, + "fullName": "google.cloud.security.privateca_v1beta1.CertificateAuthorityServiceClient.disable_certificate_authority", + "method": { + "fullName": "google.cloud.security.privateca.v1beta1.CertificateAuthorityService.DisableCertificateAuthority", + "service": { + "fullName": "google.cloud.security.privateca.v1beta1.CertificateAuthorityService", + "shortName": "CertificateAuthorityService" + }, + "shortName": "DisableCertificateAuthority" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.security.privateca_v1beta1.types.DisableCertificateAuthorityRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.api_core.operation.Operation", + "shortName": "disable_certificate_authority" + }, + "description": "Sample for DisableCertificateAuthority", + "file": "privateca_v1beta1_generated_certificate_authority_service_disable_certificate_authority_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "privateca_v1beta1_generated_CertificateAuthorityService_DisableCertificateAuthority_sync", + "segments": [ + { + "end": 55, + "start": 27, + "type": "FULL" + }, + { + "end": 55, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 45, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 52, + "start": 46, + "type": "REQUEST_EXECUTION" + }, + { + "end": 56, + "start": 53, + "type": "RESPONSE_HANDLING" + } + ], + "title": "privateca_v1beta1_generated_certificate_authority_service_disable_certificate_authority_sync.py" + }, + { + "canonical": true, + "clientMethod": { + "async": true, + "client": { + "fullName": "google.cloud.security.privateca_v1beta1.CertificateAuthorityServiceAsyncClient", + "shortName": "CertificateAuthorityServiceAsyncClient" + }, + "fullName": "google.cloud.security.privateca_v1beta1.CertificateAuthorityServiceAsyncClient.enable_certificate_authority", + "method": { + "fullName": "google.cloud.security.privateca.v1beta1.CertificateAuthorityService.EnableCertificateAuthority", + "service": { + "fullName": "google.cloud.security.privateca.v1beta1.CertificateAuthorityService", + "shortName": "CertificateAuthorityService" + }, + "shortName": "EnableCertificateAuthority" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.security.privateca_v1beta1.types.EnableCertificateAuthorityRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.api_core.operation_async.AsyncOperation", + "shortName": "enable_certificate_authority" + }, + "description": "Sample for EnableCertificateAuthority", + "file": "privateca_v1beta1_generated_certificate_authority_service_enable_certificate_authority_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "privateca_v1beta1_generated_CertificateAuthorityService_EnableCertificateAuthority_async", + "segments": [ + { + "end": 55, + "start": 27, + "type": "FULL" + }, + { + "end": 55, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 45, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 52, + "start": 46, + "type": "REQUEST_EXECUTION" + }, + { + "end": 56, + "start": 53, + "type": "RESPONSE_HANDLING" + } + ], + "title": "privateca_v1beta1_generated_certificate_authority_service_enable_certificate_authority_async.py" + }, + { + "canonical": true, + "clientMethod": { + "client": { + "fullName": "google.cloud.security.privateca_v1beta1.CertificateAuthorityServiceClient", + "shortName": "CertificateAuthorityServiceClient" + }, + "fullName": "google.cloud.security.privateca_v1beta1.CertificateAuthorityServiceClient.enable_certificate_authority", + "method": { + "fullName": "google.cloud.security.privateca.v1beta1.CertificateAuthorityService.EnableCertificateAuthority", + "service": { + "fullName": "google.cloud.security.privateca.v1beta1.CertificateAuthorityService", + "shortName": "CertificateAuthorityService" + }, + "shortName": "EnableCertificateAuthority" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.security.privateca_v1beta1.types.EnableCertificateAuthorityRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.api_core.operation.Operation", + "shortName": "enable_certificate_authority" + }, + "description": "Sample for EnableCertificateAuthority", + "file": "privateca_v1beta1_generated_certificate_authority_service_enable_certificate_authority_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "privateca_v1beta1_generated_CertificateAuthorityService_EnableCertificateAuthority_sync", + "segments": [ + { + "end": 55, + "start": 27, + "type": "FULL" + }, + { + "end": 55, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 45, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 52, + "start": 46, + "type": "REQUEST_EXECUTION" + }, + { + "end": 56, + "start": 53, + "type": "RESPONSE_HANDLING" + } + ], + "title": "privateca_v1beta1_generated_certificate_authority_service_enable_certificate_authority_sync.py" + }, + { + "canonical": true, + "clientMethod": { + "async": true, + "client": { + "fullName": "google.cloud.security.privateca_v1beta1.CertificateAuthorityServiceAsyncClient", + "shortName": "CertificateAuthorityServiceAsyncClient" + }, + "fullName": "google.cloud.security.privateca_v1beta1.CertificateAuthorityServiceAsyncClient.fetch_certificate_authority_csr", + "method": { + "fullName": "google.cloud.security.privateca.v1beta1.CertificateAuthorityService.FetchCertificateAuthorityCsr", + "service": { + "fullName": "google.cloud.security.privateca.v1beta1.CertificateAuthorityService", + "shortName": "CertificateAuthorityService" + }, + "shortName": "FetchCertificateAuthorityCsr" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.security.privateca_v1beta1.types.FetchCertificateAuthorityCsrRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.security.privateca_v1beta1.types.FetchCertificateAuthorityCsrResponse", + "shortName": "fetch_certificate_authority_csr" + }, + "description": "Sample for FetchCertificateAuthorityCsr", + "file": "privateca_v1beta1_generated_certificate_authority_service_fetch_certificate_authority_csr_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "privateca_v1beta1_generated_CertificateAuthorityService_FetchCertificateAuthorityCsr_async", + "segments": [ + { + "end": 51, + "start": 27, + "type": "FULL" + }, + { + "end": 51, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 45, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 48, + "start": 46, + "type": "REQUEST_EXECUTION" + }, + { + "end": 52, + "start": 49, + "type": "RESPONSE_HANDLING" + } + ], + "title": "privateca_v1beta1_generated_certificate_authority_service_fetch_certificate_authority_csr_async.py" + }, + { + "canonical": true, + "clientMethod": { + "client": { + "fullName": "google.cloud.security.privateca_v1beta1.CertificateAuthorityServiceClient", + "shortName": "CertificateAuthorityServiceClient" + }, + "fullName": "google.cloud.security.privateca_v1beta1.CertificateAuthorityServiceClient.fetch_certificate_authority_csr", + "method": { + "fullName": "google.cloud.security.privateca.v1beta1.CertificateAuthorityService.FetchCertificateAuthorityCsr", + "service": { + "fullName": "google.cloud.security.privateca.v1beta1.CertificateAuthorityService", + "shortName": "CertificateAuthorityService" + }, + "shortName": "FetchCertificateAuthorityCsr" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.security.privateca_v1beta1.types.FetchCertificateAuthorityCsrRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.security.privateca_v1beta1.types.FetchCertificateAuthorityCsrResponse", + "shortName": "fetch_certificate_authority_csr" + }, + "description": "Sample for FetchCertificateAuthorityCsr", + "file": "privateca_v1beta1_generated_certificate_authority_service_fetch_certificate_authority_csr_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "privateca_v1beta1_generated_CertificateAuthorityService_FetchCertificateAuthorityCsr_sync", + "segments": [ + { + "end": 51, + "start": 27, + "type": "FULL" + }, + { + "end": 51, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 45, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 48, + "start": 46, + "type": "REQUEST_EXECUTION" + }, + { + "end": 52, + "start": 49, + "type": "RESPONSE_HANDLING" + } + ], + "title": "privateca_v1beta1_generated_certificate_authority_service_fetch_certificate_authority_csr_sync.py" + }, + { + "canonical": true, + "clientMethod": { + "async": true, + "client": { + "fullName": "google.cloud.security.privateca_v1beta1.CertificateAuthorityServiceAsyncClient", + "shortName": "CertificateAuthorityServiceAsyncClient" + }, + "fullName": "google.cloud.security.privateca_v1beta1.CertificateAuthorityServiceAsyncClient.get_certificate_authority", + "method": { + "fullName": "google.cloud.security.privateca.v1beta1.CertificateAuthorityService.GetCertificateAuthority", + "service": { + "fullName": "google.cloud.security.privateca.v1beta1.CertificateAuthorityService", + "shortName": "CertificateAuthorityService" + }, + "shortName": "GetCertificateAuthority" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.security.privateca_v1beta1.types.GetCertificateAuthorityRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.security.privateca_v1beta1.types.CertificateAuthority", + "shortName": "get_certificate_authority" + }, + "description": "Sample for GetCertificateAuthority", + "file": "privateca_v1beta1_generated_certificate_authority_service_get_certificate_authority_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "privateca_v1beta1_generated_CertificateAuthorityService_GetCertificateAuthority_async", + "segments": [ + { + "end": 51, + "start": 27, + "type": "FULL" + }, + { + "end": 51, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 45, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 48, + "start": 46, + "type": "REQUEST_EXECUTION" + }, + { + "end": 52, + "start": 49, + "type": "RESPONSE_HANDLING" + } + ], + "title": "privateca_v1beta1_generated_certificate_authority_service_get_certificate_authority_async.py" + }, + { + "canonical": true, + "clientMethod": { + "client": { + "fullName": "google.cloud.security.privateca_v1beta1.CertificateAuthorityServiceClient", + "shortName": "CertificateAuthorityServiceClient" + }, + "fullName": "google.cloud.security.privateca_v1beta1.CertificateAuthorityServiceClient.get_certificate_authority", + "method": { + "fullName": "google.cloud.security.privateca.v1beta1.CertificateAuthorityService.GetCertificateAuthority", + "service": { + "fullName": "google.cloud.security.privateca.v1beta1.CertificateAuthorityService", + "shortName": "CertificateAuthorityService" + }, + "shortName": "GetCertificateAuthority" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.security.privateca_v1beta1.types.GetCertificateAuthorityRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.security.privateca_v1beta1.types.CertificateAuthority", + "shortName": "get_certificate_authority" + }, + "description": "Sample for GetCertificateAuthority", + "file": "privateca_v1beta1_generated_certificate_authority_service_get_certificate_authority_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "privateca_v1beta1_generated_CertificateAuthorityService_GetCertificateAuthority_sync", + "segments": [ + { + "end": 51, + "start": 27, + "type": "FULL" + }, + { + "end": 51, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 45, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 48, + "start": 46, + "type": "REQUEST_EXECUTION" + }, + { + "end": 52, + "start": 49, + "type": "RESPONSE_HANDLING" + } + ], + "title": "privateca_v1beta1_generated_certificate_authority_service_get_certificate_authority_sync.py" + }, + { + "canonical": true, + "clientMethod": { + "async": true, + "client": { + "fullName": "google.cloud.security.privateca_v1beta1.CertificateAuthorityServiceAsyncClient", + "shortName": "CertificateAuthorityServiceAsyncClient" + }, + "fullName": "google.cloud.security.privateca_v1beta1.CertificateAuthorityServiceAsyncClient.get_certificate_revocation_list", + "method": { + "fullName": "google.cloud.security.privateca.v1beta1.CertificateAuthorityService.GetCertificateRevocationList", + "service": { + "fullName": "google.cloud.security.privateca.v1beta1.CertificateAuthorityService", + "shortName": "CertificateAuthorityService" + }, + "shortName": "GetCertificateRevocationList" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.security.privateca_v1beta1.types.GetCertificateRevocationListRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.security.privateca_v1beta1.types.CertificateRevocationList", + "shortName": "get_certificate_revocation_list" + }, + "description": "Sample for GetCertificateRevocationList", + "file": "privateca_v1beta1_generated_certificate_authority_service_get_certificate_revocation_list_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "privateca_v1beta1_generated_CertificateAuthorityService_GetCertificateRevocationList_async", + "segments": [ + { + "end": 51, + "start": 27, + "type": "FULL" + }, + { + "end": 51, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 45, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 48, + "start": 46, + "type": "REQUEST_EXECUTION" + }, + { + "end": 52, + "start": 49, + "type": "RESPONSE_HANDLING" + } + ], + "title": "privateca_v1beta1_generated_certificate_authority_service_get_certificate_revocation_list_async.py" + }, + { + "canonical": true, + "clientMethod": { + "client": { + "fullName": "google.cloud.security.privateca_v1beta1.CertificateAuthorityServiceClient", + "shortName": "CertificateAuthorityServiceClient" + }, + "fullName": "google.cloud.security.privateca_v1beta1.CertificateAuthorityServiceClient.get_certificate_revocation_list", + "method": { + "fullName": "google.cloud.security.privateca.v1beta1.CertificateAuthorityService.GetCertificateRevocationList", + "service": { + "fullName": "google.cloud.security.privateca.v1beta1.CertificateAuthorityService", + "shortName": "CertificateAuthorityService" + }, + "shortName": "GetCertificateRevocationList" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.security.privateca_v1beta1.types.GetCertificateRevocationListRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.security.privateca_v1beta1.types.CertificateRevocationList", + "shortName": "get_certificate_revocation_list" + }, + "description": "Sample for GetCertificateRevocationList", + "file": "privateca_v1beta1_generated_certificate_authority_service_get_certificate_revocation_list_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "privateca_v1beta1_generated_CertificateAuthorityService_GetCertificateRevocationList_sync", + "segments": [ + { + "end": 51, + "start": 27, + "type": "FULL" + }, + { + "end": 51, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 45, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 48, + "start": 46, + "type": "REQUEST_EXECUTION" + }, + { + "end": 52, + "start": 49, + "type": "RESPONSE_HANDLING" + } + ], + "title": "privateca_v1beta1_generated_certificate_authority_service_get_certificate_revocation_list_sync.py" + }, + { + "canonical": true, + "clientMethod": { + "async": true, + "client": { + "fullName": "google.cloud.security.privateca_v1beta1.CertificateAuthorityServiceAsyncClient", + "shortName": "CertificateAuthorityServiceAsyncClient" + }, + "fullName": "google.cloud.security.privateca_v1beta1.CertificateAuthorityServiceAsyncClient.get_certificate", + "method": { + "fullName": "google.cloud.security.privateca.v1beta1.CertificateAuthorityService.GetCertificate", + "service": { + "fullName": "google.cloud.security.privateca.v1beta1.CertificateAuthorityService", + "shortName": "CertificateAuthorityService" + }, + "shortName": "GetCertificate" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.security.privateca_v1beta1.types.GetCertificateRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.security.privateca_v1beta1.types.Certificate", + "shortName": "get_certificate" + }, + "description": "Sample for GetCertificate", + "file": "privateca_v1beta1_generated_certificate_authority_service_get_certificate_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "privateca_v1beta1_generated_CertificateAuthorityService_GetCertificate_async", + "segments": [ + { + "end": 51, + "start": 27, + "type": "FULL" + }, + { + "end": 51, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 45, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 48, + "start": 46, + "type": "REQUEST_EXECUTION" + }, + { + "end": 52, + "start": 49, + "type": "RESPONSE_HANDLING" + } + ], + "title": "privateca_v1beta1_generated_certificate_authority_service_get_certificate_async.py" + }, + { + "canonical": true, + "clientMethod": { + "client": { + "fullName": "google.cloud.security.privateca_v1beta1.CertificateAuthorityServiceClient", + "shortName": "CertificateAuthorityServiceClient" + }, + "fullName": "google.cloud.security.privateca_v1beta1.CertificateAuthorityServiceClient.get_certificate", + "method": { + "fullName": "google.cloud.security.privateca.v1beta1.CertificateAuthorityService.GetCertificate", + "service": { + "fullName": "google.cloud.security.privateca.v1beta1.CertificateAuthorityService", + "shortName": "CertificateAuthorityService" + }, + "shortName": "GetCertificate" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.security.privateca_v1beta1.types.GetCertificateRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.security.privateca_v1beta1.types.Certificate", + "shortName": "get_certificate" + }, + "description": "Sample for GetCertificate", + "file": "privateca_v1beta1_generated_certificate_authority_service_get_certificate_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "privateca_v1beta1_generated_CertificateAuthorityService_GetCertificate_sync", + "segments": [ + { + "end": 51, + "start": 27, + "type": "FULL" + }, + { + "end": 51, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 45, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 48, + "start": 46, + "type": "REQUEST_EXECUTION" + }, + { + "end": 52, + "start": 49, + "type": "RESPONSE_HANDLING" + } + ], + "title": "privateca_v1beta1_generated_certificate_authority_service_get_certificate_sync.py" + }, + { + "canonical": true, + "clientMethod": { + "async": true, + "client": { + "fullName": "google.cloud.security.privateca_v1beta1.CertificateAuthorityServiceAsyncClient", + "shortName": "CertificateAuthorityServiceAsyncClient" + }, + "fullName": "google.cloud.security.privateca_v1beta1.CertificateAuthorityServiceAsyncClient.get_reusable_config", + "method": { + "fullName": "google.cloud.security.privateca.v1beta1.CertificateAuthorityService.GetReusableConfig", + "service": { + "fullName": "google.cloud.security.privateca.v1beta1.CertificateAuthorityService", + "shortName": "CertificateAuthorityService" + }, + "shortName": "GetReusableConfig" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.security.privateca_v1beta1.types.GetReusableConfigRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.security.privateca_v1beta1.types.ReusableConfig", + "shortName": "get_reusable_config" + }, + "description": "Sample for GetReusableConfig", + "file": "privateca_v1beta1_generated_certificate_authority_service_get_reusable_config_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "privateca_v1beta1_generated_CertificateAuthorityService_GetReusableConfig_async", + "segments": [ + { + "end": 51, + "start": 27, + "type": "FULL" + }, + { + "end": 51, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 45, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 48, + "start": 46, + "type": "REQUEST_EXECUTION" + }, + { + "end": 52, + "start": 49, + "type": "RESPONSE_HANDLING" + } + ], + "title": "privateca_v1beta1_generated_certificate_authority_service_get_reusable_config_async.py" + }, + { + "canonical": true, + "clientMethod": { + "client": { + "fullName": "google.cloud.security.privateca_v1beta1.CertificateAuthorityServiceClient", + "shortName": "CertificateAuthorityServiceClient" + }, + "fullName": "google.cloud.security.privateca_v1beta1.CertificateAuthorityServiceClient.get_reusable_config", + "method": { + "fullName": "google.cloud.security.privateca.v1beta1.CertificateAuthorityService.GetReusableConfig", + "service": { + "fullName": "google.cloud.security.privateca.v1beta1.CertificateAuthorityService", + "shortName": "CertificateAuthorityService" + }, + "shortName": "GetReusableConfig" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.security.privateca_v1beta1.types.GetReusableConfigRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.security.privateca_v1beta1.types.ReusableConfig", + "shortName": "get_reusable_config" + }, + "description": "Sample for GetReusableConfig", + "file": "privateca_v1beta1_generated_certificate_authority_service_get_reusable_config_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "privateca_v1beta1_generated_CertificateAuthorityService_GetReusableConfig_sync", + "segments": [ + { + "end": 51, + "start": 27, + "type": "FULL" + }, + { + "end": 51, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 45, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 48, + "start": 46, + "type": "REQUEST_EXECUTION" + }, + { + "end": 52, + "start": 49, + "type": "RESPONSE_HANDLING" + } + ], + "title": "privateca_v1beta1_generated_certificate_authority_service_get_reusable_config_sync.py" + }, + { + "canonical": true, + "clientMethod": { + "async": true, + "client": { + "fullName": "google.cloud.security.privateca_v1beta1.CertificateAuthorityServiceAsyncClient", + "shortName": "CertificateAuthorityServiceAsyncClient" + }, + "fullName": "google.cloud.security.privateca_v1beta1.CertificateAuthorityServiceAsyncClient.list_certificate_authorities", + "method": { + "fullName": "google.cloud.security.privateca.v1beta1.CertificateAuthorityService.ListCertificateAuthorities", + "service": { + "fullName": "google.cloud.security.privateca.v1beta1.CertificateAuthorityService", + "shortName": "CertificateAuthorityService" + }, + "shortName": "ListCertificateAuthorities" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.security.privateca_v1beta1.types.ListCertificateAuthoritiesRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.security.privateca_v1beta1.services.certificate_authority_service.pagers.ListCertificateAuthoritiesAsyncPager", + "shortName": "list_certificate_authorities" + }, + "description": "Sample for ListCertificateAuthorities", + "file": "privateca_v1beta1_generated_certificate_authority_service_list_certificate_authorities_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "privateca_v1beta1_generated_CertificateAuthorityService_ListCertificateAuthorities_async", + "segments": [ + { + "end": 52, + "start": 27, + "type": "FULL" + }, + { + "end": 52, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 45, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 48, + "start": 46, + "type": "REQUEST_EXECUTION" + }, + { + "end": 53, + "start": 49, + "type": "RESPONSE_HANDLING" + } + ], + "title": "privateca_v1beta1_generated_certificate_authority_service_list_certificate_authorities_async.py" + }, + { + "canonical": true, + "clientMethod": { + "client": { + "fullName": "google.cloud.security.privateca_v1beta1.CertificateAuthorityServiceClient", + "shortName": "CertificateAuthorityServiceClient" + }, + "fullName": "google.cloud.security.privateca_v1beta1.CertificateAuthorityServiceClient.list_certificate_authorities", + "method": { + "fullName": "google.cloud.security.privateca.v1beta1.CertificateAuthorityService.ListCertificateAuthorities", + "service": { + "fullName": "google.cloud.security.privateca.v1beta1.CertificateAuthorityService", + "shortName": "CertificateAuthorityService" + }, + "shortName": "ListCertificateAuthorities" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.security.privateca_v1beta1.types.ListCertificateAuthoritiesRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.security.privateca_v1beta1.services.certificate_authority_service.pagers.ListCertificateAuthoritiesPager", + "shortName": "list_certificate_authorities" + }, + "description": "Sample for ListCertificateAuthorities", + "file": "privateca_v1beta1_generated_certificate_authority_service_list_certificate_authorities_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "privateca_v1beta1_generated_CertificateAuthorityService_ListCertificateAuthorities_sync", + "segments": [ + { + "end": 52, + "start": 27, + "type": "FULL" + }, + { + "end": 52, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 45, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 48, + "start": 46, + "type": "REQUEST_EXECUTION" + }, + { + "end": 53, + "start": 49, + "type": "RESPONSE_HANDLING" + } + ], + "title": "privateca_v1beta1_generated_certificate_authority_service_list_certificate_authorities_sync.py" + }, + { + "canonical": true, + "clientMethod": { + "async": true, + "client": { + "fullName": "google.cloud.security.privateca_v1beta1.CertificateAuthorityServiceAsyncClient", + "shortName": "CertificateAuthorityServiceAsyncClient" + }, + "fullName": "google.cloud.security.privateca_v1beta1.CertificateAuthorityServiceAsyncClient.list_certificate_revocation_lists", + "method": { + "fullName": "google.cloud.security.privateca.v1beta1.CertificateAuthorityService.ListCertificateRevocationLists", + "service": { + "fullName": "google.cloud.security.privateca.v1beta1.CertificateAuthorityService", + "shortName": "CertificateAuthorityService" + }, + "shortName": "ListCertificateRevocationLists" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.security.privateca_v1beta1.types.ListCertificateRevocationListsRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.security.privateca_v1beta1.services.certificate_authority_service.pagers.ListCertificateRevocationListsAsyncPager", + "shortName": "list_certificate_revocation_lists" + }, + "description": "Sample for ListCertificateRevocationLists", + "file": "privateca_v1beta1_generated_certificate_authority_service_list_certificate_revocation_lists_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "privateca_v1beta1_generated_CertificateAuthorityService_ListCertificateRevocationLists_async", + "segments": [ + { + "end": 52, + "start": 27, + "type": "FULL" + }, + { + "end": 52, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 45, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 48, + "start": 46, + "type": "REQUEST_EXECUTION" + }, + { + "end": 53, + "start": 49, + "type": "RESPONSE_HANDLING" + } + ], + "title": "privateca_v1beta1_generated_certificate_authority_service_list_certificate_revocation_lists_async.py" + }, + { + "canonical": true, + "clientMethod": { + "client": { + "fullName": "google.cloud.security.privateca_v1beta1.CertificateAuthorityServiceClient", + "shortName": "CertificateAuthorityServiceClient" + }, + "fullName": "google.cloud.security.privateca_v1beta1.CertificateAuthorityServiceClient.list_certificate_revocation_lists", + "method": { + "fullName": "google.cloud.security.privateca.v1beta1.CertificateAuthorityService.ListCertificateRevocationLists", + "service": { + "fullName": "google.cloud.security.privateca.v1beta1.CertificateAuthorityService", + "shortName": "CertificateAuthorityService" + }, + "shortName": "ListCertificateRevocationLists" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.security.privateca_v1beta1.types.ListCertificateRevocationListsRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.security.privateca_v1beta1.services.certificate_authority_service.pagers.ListCertificateRevocationListsPager", + "shortName": "list_certificate_revocation_lists" + }, + "description": "Sample for ListCertificateRevocationLists", + "file": "privateca_v1beta1_generated_certificate_authority_service_list_certificate_revocation_lists_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "privateca_v1beta1_generated_CertificateAuthorityService_ListCertificateRevocationLists_sync", + "segments": [ + { + "end": 52, + "start": 27, + "type": "FULL" + }, + { + "end": 52, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 45, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 48, + "start": 46, + "type": "REQUEST_EXECUTION" + }, + { + "end": 53, + "start": 49, + "type": "RESPONSE_HANDLING" + } + ], + "title": "privateca_v1beta1_generated_certificate_authority_service_list_certificate_revocation_lists_sync.py" + }, + { + "canonical": true, + "clientMethod": { + "async": true, + "client": { + "fullName": "google.cloud.security.privateca_v1beta1.CertificateAuthorityServiceAsyncClient", + "shortName": "CertificateAuthorityServiceAsyncClient" + }, + "fullName": "google.cloud.security.privateca_v1beta1.CertificateAuthorityServiceAsyncClient.list_certificates", + "method": { + "fullName": "google.cloud.security.privateca.v1beta1.CertificateAuthorityService.ListCertificates", + "service": { + "fullName": "google.cloud.security.privateca.v1beta1.CertificateAuthorityService", + "shortName": "CertificateAuthorityService" + }, + "shortName": "ListCertificates" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.security.privateca_v1beta1.types.ListCertificatesRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.security.privateca_v1beta1.services.certificate_authority_service.pagers.ListCertificatesAsyncPager", + "shortName": "list_certificates" + }, + "description": "Sample for ListCertificates", + "file": "privateca_v1beta1_generated_certificate_authority_service_list_certificates_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "privateca_v1beta1_generated_CertificateAuthorityService_ListCertificates_async", + "segments": [ + { + "end": 52, + "start": 27, + "type": "FULL" + }, + { + "end": 52, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 45, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 48, + "start": 46, + "type": "REQUEST_EXECUTION" + }, + { + "end": 53, + "start": 49, + "type": "RESPONSE_HANDLING" + } + ], + "title": "privateca_v1beta1_generated_certificate_authority_service_list_certificates_async.py" + }, + { + "canonical": true, + "clientMethod": { + "client": { + "fullName": "google.cloud.security.privateca_v1beta1.CertificateAuthorityServiceClient", + "shortName": "CertificateAuthorityServiceClient" + }, + "fullName": "google.cloud.security.privateca_v1beta1.CertificateAuthorityServiceClient.list_certificates", + "method": { + "fullName": "google.cloud.security.privateca.v1beta1.CertificateAuthorityService.ListCertificates", + "service": { + "fullName": "google.cloud.security.privateca.v1beta1.CertificateAuthorityService", + "shortName": "CertificateAuthorityService" + }, + "shortName": "ListCertificates" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.security.privateca_v1beta1.types.ListCertificatesRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.security.privateca_v1beta1.services.certificate_authority_service.pagers.ListCertificatesPager", + "shortName": "list_certificates" + }, + "description": "Sample for ListCertificates", + "file": "privateca_v1beta1_generated_certificate_authority_service_list_certificates_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "privateca_v1beta1_generated_CertificateAuthorityService_ListCertificates_sync", + "segments": [ + { + "end": 52, + "start": 27, + "type": "FULL" + }, + { + "end": 52, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 45, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 48, + "start": 46, + "type": "REQUEST_EXECUTION" + }, + { + "end": 53, + "start": 49, + "type": "RESPONSE_HANDLING" + } + ], + "title": "privateca_v1beta1_generated_certificate_authority_service_list_certificates_sync.py" + }, + { + "canonical": true, + "clientMethod": { + "async": true, + "client": { + "fullName": "google.cloud.security.privateca_v1beta1.CertificateAuthorityServiceAsyncClient", + "shortName": "CertificateAuthorityServiceAsyncClient" + }, + "fullName": "google.cloud.security.privateca_v1beta1.CertificateAuthorityServiceAsyncClient.list_reusable_configs", + "method": { + "fullName": "google.cloud.security.privateca.v1beta1.CertificateAuthorityService.ListReusableConfigs", + "service": { + "fullName": "google.cloud.security.privateca.v1beta1.CertificateAuthorityService", + "shortName": "CertificateAuthorityService" + }, + "shortName": "ListReusableConfigs" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.security.privateca_v1beta1.types.ListReusableConfigsRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.security.privateca_v1beta1.services.certificate_authority_service.pagers.ListReusableConfigsAsyncPager", + "shortName": "list_reusable_configs" + }, + "description": "Sample for ListReusableConfigs", + "file": "privateca_v1beta1_generated_certificate_authority_service_list_reusable_configs_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "privateca_v1beta1_generated_CertificateAuthorityService_ListReusableConfigs_async", + "segments": [ + { + "end": 52, + "start": 27, + "type": "FULL" + }, + { + "end": 52, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 45, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 48, + "start": 46, + "type": "REQUEST_EXECUTION" + }, + { + "end": 53, + "start": 49, + "type": "RESPONSE_HANDLING" + } + ], + "title": "privateca_v1beta1_generated_certificate_authority_service_list_reusable_configs_async.py" + }, + { + "canonical": true, + "clientMethod": { + "client": { + "fullName": "google.cloud.security.privateca_v1beta1.CertificateAuthorityServiceClient", + "shortName": "CertificateAuthorityServiceClient" + }, + "fullName": "google.cloud.security.privateca_v1beta1.CertificateAuthorityServiceClient.list_reusable_configs", + "method": { + "fullName": "google.cloud.security.privateca.v1beta1.CertificateAuthorityService.ListReusableConfigs", + "service": { + "fullName": "google.cloud.security.privateca.v1beta1.CertificateAuthorityService", + "shortName": "CertificateAuthorityService" + }, + "shortName": "ListReusableConfigs" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.security.privateca_v1beta1.types.ListReusableConfigsRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.security.privateca_v1beta1.services.certificate_authority_service.pagers.ListReusableConfigsPager", + "shortName": "list_reusable_configs" + }, + "description": "Sample for ListReusableConfigs", + "file": "privateca_v1beta1_generated_certificate_authority_service_list_reusable_configs_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "privateca_v1beta1_generated_CertificateAuthorityService_ListReusableConfigs_sync", + "segments": [ + { + "end": 52, + "start": 27, + "type": "FULL" + }, + { + "end": 52, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 45, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 48, + "start": 46, + "type": "REQUEST_EXECUTION" + }, + { + "end": 53, + "start": 49, + "type": "RESPONSE_HANDLING" + } + ], + "title": "privateca_v1beta1_generated_certificate_authority_service_list_reusable_configs_sync.py" + }, + { + "canonical": true, + "clientMethod": { + "async": true, + "client": { + "fullName": "google.cloud.security.privateca_v1beta1.CertificateAuthorityServiceAsyncClient", + "shortName": "CertificateAuthorityServiceAsyncClient" + }, + "fullName": "google.cloud.security.privateca_v1beta1.CertificateAuthorityServiceAsyncClient.restore_certificate_authority", + "method": { + "fullName": "google.cloud.security.privateca.v1beta1.CertificateAuthorityService.RestoreCertificateAuthority", + "service": { + "fullName": "google.cloud.security.privateca.v1beta1.CertificateAuthorityService", + "shortName": "CertificateAuthorityService" + }, + "shortName": "RestoreCertificateAuthority" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.security.privateca_v1beta1.types.RestoreCertificateAuthorityRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.api_core.operation_async.AsyncOperation", + "shortName": "restore_certificate_authority" + }, + "description": "Sample for RestoreCertificateAuthority", + "file": "privateca_v1beta1_generated_certificate_authority_service_restore_certificate_authority_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "privateca_v1beta1_generated_CertificateAuthorityService_RestoreCertificateAuthority_async", + "segments": [ + { + "end": 55, + "start": 27, + "type": "FULL" + }, + { + "end": 55, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 45, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 52, + "start": 46, + "type": "REQUEST_EXECUTION" + }, + { + "end": 56, + "start": 53, + "type": "RESPONSE_HANDLING" + } + ], + "title": "privateca_v1beta1_generated_certificate_authority_service_restore_certificate_authority_async.py" + }, + { + "canonical": true, + "clientMethod": { + "client": { + "fullName": "google.cloud.security.privateca_v1beta1.CertificateAuthorityServiceClient", + "shortName": "CertificateAuthorityServiceClient" + }, + "fullName": "google.cloud.security.privateca_v1beta1.CertificateAuthorityServiceClient.restore_certificate_authority", + "method": { + "fullName": "google.cloud.security.privateca.v1beta1.CertificateAuthorityService.RestoreCertificateAuthority", + "service": { + "fullName": "google.cloud.security.privateca.v1beta1.CertificateAuthorityService", + "shortName": "CertificateAuthorityService" + }, + "shortName": "RestoreCertificateAuthority" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.security.privateca_v1beta1.types.RestoreCertificateAuthorityRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.api_core.operation.Operation", + "shortName": "restore_certificate_authority" + }, + "description": "Sample for RestoreCertificateAuthority", + "file": "privateca_v1beta1_generated_certificate_authority_service_restore_certificate_authority_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "privateca_v1beta1_generated_CertificateAuthorityService_RestoreCertificateAuthority_sync", + "segments": [ + { + "end": 55, + "start": 27, + "type": "FULL" + }, + { + "end": 55, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 45, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 52, + "start": 46, + "type": "REQUEST_EXECUTION" + }, + { + "end": 56, + "start": 53, + "type": "RESPONSE_HANDLING" + } + ], + "title": "privateca_v1beta1_generated_certificate_authority_service_restore_certificate_authority_sync.py" + }, + { + "canonical": true, + "clientMethod": { + "async": true, + "client": { + "fullName": "google.cloud.security.privateca_v1beta1.CertificateAuthorityServiceAsyncClient", + "shortName": "CertificateAuthorityServiceAsyncClient" + }, + "fullName": "google.cloud.security.privateca_v1beta1.CertificateAuthorityServiceAsyncClient.revoke_certificate", + "method": { + "fullName": "google.cloud.security.privateca.v1beta1.CertificateAuthorityService.RevokeCertificate", + "service": { + "fullName": "google.cloud.security.privateca.v1beta1.CertificateAuthorityService", + "shortName": "CertificateAuthorityService" + }, + "shortName": "RevokeCertificate" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.security.privateca_v1beta1.types.RevokeCertificateRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.security.privateca_v1beta1.types.Certificate", + "shortName": "revoke_certificate" + }, + "description": "Sample for RevokeCertificate", + "file": "privateca_v1beta1_generated_certificate_authority_service_revoke_certificate_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "privateca_v1beta1_generated_CertificateAuthorityService_RevokeCertificate_async", + "segments": [ + { + "end": 52, + "start": 27, + "type": "FULL" + }, + { + "end": 52, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 46, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 49, + "start": 47, + "type": "REQUEST_EXECUTION" + }, + { + "end": 53, + "start": 50, + "type": "RESPONSE_HANDLING" + } + ], + "title": "privateca_v1beta1_generated_certificate_authority_service_revoke_certificate_async.py" + }, + { + "canonical": true, + "clientMethod": { + "client": { + "fullName": "google.cloud.security.privateca_v1beta1.CertificateAuthorityServiceClient", + "shortName": "CertificateAuthorityServiceClient" + }, + "fullName": "google.cloud.security.privateca_v1beta1.CertificateAuthorityServiceClient.revoke_certificate", + "method": { + "fullName": "google.cloud.security.privateca.v1beta1.CertificateAuthorityService.RevokeCertificate", + "service": { + "fullName": "google.cloud.security.privateca.v1beta1.CertificateAuthorityService", + "shortName": "CertificateAuthorityService" + }, + "shortName": "RevokeCertificate" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.security.privateca_v1beta1.types.RevokeCertificateRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.security.privateca_v1beta1.types.Certificate", + "shortName": "revoke_certificate" + }, + "description": "Sample for RevokeCertificate", + "file": "privateca_v1beta1_generated_certificate_authority_service_revoke_certificate_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "privateca_v1beta1_generated_CertificateAuthorityService_RevokeCertificate_sync", + "segments": [ + { + "end": 52, + "start": 27, + "type": "FULL" + }, + { + "end": 52, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 46, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 49, + "start": 47, + "type": "REQUEST_EXECUTION" + }, + { + "end": 53, + "start": 50, + "type": "RESPONSE_HANDLING" + } + ], + "title": "privateca_v1beta1_generated_certificate_authority_service_revoke_certificate_sync.py" + }, + { + "canonical": true, + "clientMethod": { + "async": true, + "client": { + "fullName": "google.cloud.security.privateca_v1beta1.CertificateAuthorityServiceAsyncClient", + "shortName": "CertificateAuthorityServiceAsyncClient" + }, + "fullName": "google.cloud.security.privateca_v1beta1.CertificateAuthorityServiceAsyncClient.schedule_delete_certificate_authority", + "method": { + "fullName": "google.cloud.security.privateca.v1beta1.CertificateAuthorityService.ScheduleDeleteCertificateAuthority", + "service": { + "fullName": "google.cloud.security.privateca.v1beta1.CertificateAuthorityService", + "shortName": "CertificateAuthorityService" + }, + "shortName": "ScheduleDeleteCertificateAuthority" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.security.privateca_v1beta1.types.ScheduleDeleteCertificateAuthorityRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.api_core.operation_async.AsyncOperation", + "shortName": "schedule_delete_certificate_authority" + }, + "description": "Sample for ScheduleDeleteCertificateAuthority", + "file": "privateca_v1beta1_generated_certificate_authority_service_schedule_delete_certificate_authority_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "privateca_v1beta1_generated_CertificateAuthorityService_ScheduleDeleteCertificateAuthority_async", + "segments": [ + { + "end": 55, + "start": 27, + "type": "FULL" + }, + { + "end": 55, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 45, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 52, + "start": 46, + "type": "REQUEST_EXECUTION" + }, + { + "end": 56, + "start": 53, + "type": "RESPONSE_HANDLING" + } + ], + "title": "privateca_v1beta1_generated_certificate_authority_service_schedule_delete_certificate_authority_async.py" + }, + { + "canonical": true, + "clientMethod": { + "client": { + "fullName": "google.cloud.security.privateca_v1beta1.CertificateAuthorityServiceClient", + "shortName": "CertificateAuthorityServiceClient" + }, + "fullName": "google.cloud.security.privateca_v1beta1.CertificateAuthorityServiceClient.schedule_delete_certificate_authority", + "method": { + "fullName": "google.cloud.security.privateca.v1beta1.CertificateAuthorityService.ScheduleDeleteCertificateAuthority", + "service": { + "fullName": "google.cloud.security.privateca.v1beta1.CertificateAuthorityService", + "shortName": "CertificateAuthorityService" + }, + "shortName": "ScheduleDeleteCertificateAuthority" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.security.privateca_v1beta1.types.ScheduleDeleteCertificateAuthorityRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.api_core.operation.Operation", + "shortName": "schedule_delete_certificate_authority" + }, + "description": "Sample for ScheduleDeleteCertificateAuthority", + "file": "privateca_v1beta1_generated_certificate_authority_service_schedule_delete_certificate_authority_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "privateca_v1beta1_generated_CertificateAuthorityService_ScheduleDeleteCertificateAuthority_sync", + "segments": [ + { + "end": 55, + "start": 27, + "type": "FULL" + }, + { + "end": 55, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 45, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 52, + "start": 46, + "type": "REQUEST_EXECUTION" + }, + { + "end": 56, + "start": 53, + "type": "RESPONSE_HANDLING" + } + ], + "title": "privateca_v1beta1_generated_certificate_authority_service_schedule_delete_certificate_authority_sync.py" + }, + { + "canonical": true, + "clientMethod": { + "async": true, + "client": { + "fullName": "google.cloud.security.privateca_v1beta1.CertificateAuthorityServiceAsyncClient", + "shortName": "CertificateAuthorityServiceAsyncClient" + }, + "fullName": "google.cloud.security.privateca_v1beta1.CertificateAuthorityServiceAsyncClient.update_certificate_authority", + "method": { + "fullName": "google.cloud.security.privateca.v1beta1.CertificateAuthorityService.UpdateCertificateAuthority", + "service": { + "fullName": "google.cloud.security.privateca.v1beta1.CertificateAuthorityService", + "shortName": "CertificateAuthorityService" + }, + "shortName": "UpdateCertificateAuthority" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.security.privateca_v1beta1.types.UpdateCertificateAuthorityRequest" + }, + { + "name": "certificate_authority", + "type": "google.cloud.security.privateca_v1beta1.types.CertificateAuthority" + }, + { + "name": "update_mask", + "type": "google.protobuf.field_mask_pb2.FieldMask" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.api_core.operation_async.AsyncOperation", + "shortName": "update_certificate_authority" + }, + "description": "Sample for UpdateCertificateAuthority", + "file": "privateca_v1beta1_generated_certificate_authority_service_update_certificate_authority_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "privateca_v1beta1_generated_CertificateAuthorityService_UpdateCertificateAuthority_async", + "segments": [ + { + "end": 61, + "start": 27, + "type": "FULL" + }, + { + "end": 61, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 51, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 58, + "start": 52, + "type": "REQUEST_EXECUTION" + }, + { + "end": 62, + "start": 59, + "type": "RESPONSE_HANDLING" + } + ], + "title": "privateca_v1beta1_generated_certificate_authority_service_update_certificate_authority_async.py" + }, + { + "canonical": true, + "clientMethod": { + "client": { + "fullName": "google.cloud.security.privateca_v1beta1.CertificateAuthorityServiceClient", + "shortName": "CertificateAuthorityServiceClient" + }, + "fullName": "google.cloud.security.privateca_v1beta1.CertificateAuthorityServiceClient.update_certificate_authority", + "method": { + "fullName": "google.cloud.security.privateca.v1beta1.CertificateAuthorityService.UpdateCertificateAuthority", + "service": { + "fullName": "google.cloud.security.privateca.v1beta1.CertificateAuthorityService", + "shortName": "CertificateAuthorityService" + }, + "shortName": "UpdateCertificateAuthority" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.security.privateca_v1beta1.types.UpdateCertificateAuthorityRequest" + }, + { + "name": "certificate_authority", + "type": "google.cloud.security.privateca_v1beta1.types.CertificateAuthority" + }, + { + "name": "update_mask", + "type": "google.protobuf.field_mask_pb2.FieldMask" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.api_core.operation.Operation", + "shortName": "update_certificate_authority" + }, + "description": "Sample for UpdateCertificateAuthority", + "file": "privateca_v1beta1_generated_certificate_authority_service_update_certificate_authority_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "privateca_v1beta1_generated_CertificateAuthorityService_UpdateCertificateAuthority_sync", + "segments": [ + { + "end": 61, + "start": 27, + "type": "FULL" + }, + { + "end": 61, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 51, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 58, + "start": 52, + "type": "REQUEST_EXECUTION" + }, + { + "end": 62, + "start": 59, + "type": "RESPONSE_HANDLING" + } + ], + "title": "privateca_v1beta1_generated_certificate_authority_service_update_certificate_authority_sync.py" + }, + { + "canonical": true, + "clientMethod": { + "async": true, + "client": { + "fullName": "google.cloud.security.privateca_v1beta1.CertificateAuthorityServiceAsyncClient", + "shortName": "CertificateAuthorityServiceAsyncClient" + }, + "fullName": "google.cloud.security.privateca_v1beta1.CertificateAuthorityServiceAsyncClient.update_certificate_revocation_list", + "method": { + "fullName": "google.cloud.security.privateca.v1beta1.CertificateAuthorityService.UpdateCertificateRevocationList", + "service": { + "fullName": "google.cloud.security.privateca.v1beta1.CertificateAuthorityService", + "shortName": "CertificateAuthorityService" + }, + "shortName": "UpdateCertificateRevocationList" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.security.privateca_v1beta1.types.UpdateCertificateRevocationListRequest" + }, + { + "name": "certificate_revocation_list", + "type": "google.cloud.security.privateca_v1beta1.types.CertificateRevocationList" + }, + { + "name": "update_mask", + "type": "google.protobuf.field_mask_pb2.FieldMask" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.api_core.operation_async.AsyncOperation", + "shortName": "update_certificate_revocation_list" + }, + "description": "Sample for UpdateCertificateRevocationList", + "file": "privateca_v1beta1_generated_certificate_authority_service_update_certificate_revocation_list_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "privateca_v1beta1_generated_CertificateAuthorityService_UpdateCertificateRevocationList_async", + "segments": [ + { + "end": 54, + "start": 27, + "type": "FULL" + }, + { + "end": 54, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 44, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 51, + "start": 45, + "type": "REQUEST_EXECUTION" + }, + { + "end": 55, + "start": 52, + "type": "RESPONSE_HANDLING" + } + ], + "title": "privateca_v1beta1_generated_certificate_authority_service_update_certificate_revocation_list_async.py" + }, + { + "canonical": true, + "clientMethod": { + "client": { + "fullName": "google.cloud.security.privateca_v1beta1.CertificateAuthorityServiceClient", + "shortName": "CertificateAuthorityServiceClient" + }, + "fullName": "google.cloud.security.privateca_v1beta1.CertificateAuthorityServiceClient.update_certificate_revocation_list", + "method": { + "fullName": "google.cloud.security.privateca.v1beta1.CertificateAuthorityService.UpdateCertificateRevocationList", + "service": { + "fullName": "google.cloud.security.privateca.v1beta1.CertificateAuthorityService", + "shortName": "CertificateAuthorityService" + }, + "shortName": "UpdateCertificateRevocationList" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.security.privateca_v1beta1.types.UpdateCertificateRevocationListRequest" + }, + { + "name": "certificate_revocation_list", + "type": "google.cloud.security.privateca_v1beta1.types.CertificateRevocationList" + }, + { + "name": "update_mask", + "type": "google.protobuf.field_mask_pb2.FieldMask" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.api_core.operation.Operation", + "shortName": "update_certificate_revocation_list" + }, + "description": "Sample for UpdateCertificateRevocationList", + "file": "privateca_v1beta1_generated_certificate_authority_service_update_certificate_revocation_list_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "privateca_v1beta1_generated_CertificateAuthorityService_UpdateCertificateRevocationList_sync", + "segments": [ + { + "end": 54, + "start": 27, + "type": "FULL" + }, + { + "end": 54, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 44, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 51, + "start": 45, + "type": "REQUEST_EXECUTION" + }, + { + "end": 55, + "start": 52, + "type": "RESPONSE_HANDLING" + } + ], + "title": "privateca_v1beta1_generated_certificate_authority_service_update_certificate_revocation_list_sync.py" + }, + { + "canonical": true, + "clientMethod": { + "async": true, + "client": { + "fullName": "google.cloud.security.privateca_v1beta1.CertificateAuthorityServiceAsyncClient", + "shortName": "CertificateAuthorityServiceAsyncClient" + }, + "fullName": "google.cloud.security.privateca_v1beta1.CertificateAuthorityServiceAsyncClient.update_certificate", + "method": { + "fullName": "google.cloud.security.privateca.v1beta1.CertificateAuthorityService.UpdateCertificate", + "service": { + "fullName": "google.cloud.security.privateca.v1beta1.CertificateAuthorityService", + "shortName": "CertificateAuthorityService" + }, + "shortName": "UpdateCertificate" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.security.privateca_v1beta1.types.UpdateCertificateRequest" + }, + { + "name": "certificate", + "type": "google.cloud.security.privateca_v1beta1.types.Certificate" + }, + { + "name": "update_mask", + "type": "google.protobuf.field_mask_pb2.FieldMask" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.security.privateca_v1beta1.types.Certificate", + "shortName": "update_certificate" + }, + "description": "Sample for UpdateCertificate", + "file": "privateca_v1beta1_generated_certificate_authority_service_update_certificate_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "privateca_v1beta1_generated_CertificateAuthorityService_UpdateCertificate_async", + "segments": [ + { + "end": 54, + "start": 27, + "type": "FULL" + }, + { + "end": 54, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 48, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 51, + "start": 49, + "type": "REQUEST_EXECUTION" + }, + { + "end": 55, + "start": 52, + "type": "RESPONSE_HANDLING" + } + ], + "title": "privateca_v1beta1_generated_certificate_authority_service_update_certificate_async.py" + }, + { + "canonical": true, + "clientMethod": { + "client": { + "fullName": "google.cloud.security.privateca_v1beta1.CertificateAuthorityServiceClient", + "shortName": "CertificateAuthorityServiceClient" + }, + "fullName": "google.cloud.security.privateca_v1beta1.CertificateAuthorityServiceClient.update_certificate", + "method": { + "fullName": "google.cloud.security.privateca.v1beta1.CertificateAuthorityService.UpdateCertificate", + "service": { + "fullName": "google.cloud.security.privateca.v1beta1.CertificateAuthorityService", + "shortName": "CertificateAuthorityService" + }, + "shortName": "UpdateCertificate" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.security.privateca_v1beta1.types.UpdateCertificateRequest" + }, + { + "name": "certificate", + "type": "google.cloud.security.privateca_v1beta1.types.Certificate" + }, + { + "name": "update_mask", + "type": "google.protobuf.field_mask_pb2.FieldMask" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.security.privateca_v1beta1.types.Certificate", + "shortName": "update_certificate" + }, + "description": "Sample for UpdateCertificate", + "file": "privateca_v1beta1_generated_certificate_authority_service_update_certificate_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "privateca_v1beta1_generated_CertificateAuthorityService_UpdateCertificate_sync", + "segments": [ + { + "end": 54, + "start": 27, + "type": "FULL" + }, + { + "end": 54, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 48, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 51, + "start": 49, + "type": "REQUEST_EXECUTION" + }, + { + "end": 55, + "start": 52, + "type": "RESPONSE_HANDLING" + } + ], + "title": "privateca_v1beta1_generated_certificate_authority_service_update_certificate_sync.py" + } + ] +} diff --git a/owl-bot-staging/v1beta1/scripts/fixup_privateca_v1beta1_keywords.py b/owl-bot-staging/v1beta1/scripts/fixup_privateca_v1beta1_keywords.py new file mode 100644 index 0000000..1ed2250 --- /dev/null +++ b/owl-bot-staging/v1beta1/scripts/fixup_privateca_v1beta1_keywords.py @@ -0,0 +1,195 @@ +#! /usr/bin/env python3 +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +import argparse +import os +import libcst as cst +import pathlib +import sys +from typing import (Any, Callable, Dict, List, Sequence, Tuple) + + +def partition( + predicate: Callable[[Any], bool], + iterator: Sequence[Any] +) -> Tuple[List[Any], List[Any]]: + """A stable, out-of-place partition.""" + results = ([], []) + + for i in iterator: + results[int(predicate(i))].append(i) + + # Returns trueList, falseList + return results[1], results[0] + + +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', ), + } + + def leave_Call(self, original: cst.Call, updated: cst.Call) -> cst.CSTNode: + try: + key = original.func.attr.value + kword_params = self.METHOD_TO_PARAMS[key] + except (AttributeError, KeyError): + # Either not a method from the API or too convoluted to be sure. + return updated + + # If the existing code is valid, keyword args come after positional args. + # Therefore, all positional args must map to the first parameters. + args, kwargs = partition(lambda a: not bool(a.keyword), updated.args) + if any(k.keyword.value == "request" for k in kwargs): + # We've already fixed this file, don't fix it again. + return updated + + kwargs, ctrl_kwargs = partition( + lambda a: a.keyword.value not in self.CTRL_PARAMS, + kwargs + ) + + args, ctrl_args = args[:len(kword_params)], args[len(kword_params):] + ctrl_kwargs.extend(cst.Arg(value=a.value, keyword=cst.Name(value=ctrl)) + for a, ctrl in zip(ctrl_args, self.CTRL_PARAMS)) + + request_arg = cst.Arg( + value=cst.Dict([ + cst.DictElement( + cst.SimpleString("'{}'".format(name)), +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 + # those could have been passed positionally or by keyword. + for name, arg in zip(kword_params, args + kwargs)]), + keyword=cst.Name("request") + ) + + return updated.with_changes( + args=[request_arg] + ctrl_kwargs + ) + + +def fix_files( + in_dir: pathlib.Path, + out_dir: pathlib.Path, + *, + transformer=privatecaCallTransformer(), +): + """Duplicate the input dir to the output dir, fixing file method calls. + + Preconditions: + * in_dir is a real directory + * out_dir is a real, empty directory + """ + pyfile_gen = ( + pathlib.Path(os.path.join(root, f)) + for root, _, files in os.walk(in_dir) + for f in files if os.path.splitext(f)[1] == ".py" + ) + + for fpath in pyfile_gen: + with open(fpath, 'r') as f: + src = f.read() + + # Parse the code and insert method call fixes. + tree = cst.parse_module(src) + updated = tree.visit(transformer) + + # Create the path and directory structure for the new file. + updated_path = out_dir.joinpath(fpath.relative_to(in_dir)) + updated_path.parent.mkdir(parents=True, exist_ok=True) + + # Generate the updated source file at the corresponding path. + with open(updated_path, 'w') as f: + f.write(updated.code) + + +if __name__ == '__main__': + parser = argparse.ArgumentParser( + description="""Fix up source that uses the privateca client library. + +The existing sources are NOT overwritten but are copied to output_dir with changes made. + +Note: This tool operates at a best-effort level at converting positional + parameters in client method calls to keyword based parameters. + Cases where it WILL FAIL include + A) * or ** expansion in a method call. + B) Calls via function or method alias (includes free function calls) + C) Indirect or dispatched calls (e.g. the method is looked up dynamically) + + These all constitute false negatives. The tool will also detect false + positives when an API method shares a name with another method. +""") + parser.add_argument( + '-d', + '--input-directory', + required=True, + dest='input_dir', + help='the input directory to walk for python files to fix up', + ) + parser.add_argument( + '-o', + '--output-directory', + required=True, + dest='output_dir', + help='the directory to output files fixed via un-flattening', + ) + args = parser.parse_args() + input_dir = pathlib.Path(args.input_dir) + output_dir = pathlib.Path(args.output_dir) + if not input_dir.is_dir(): + print( + f"input directory '{input_dir}' does not exist or is not a directory", + file=sys.stderr, + ) + sys.exit(-1) + + if not output_dir.is_dir(): + print( + f"output directory '{output_dir}' does not exist or is not a directory", + file=sys.stderr, + ) + sys.exit(-1) + + if os.listdir(output_dir): + print( + f"output directory '{output_dir}' is not empty", + file=sys.stderr, + ) + sys.exit(-1) + + fix_files(input_dir, output_dir) diff --git a/owl-bot-staging/v1beta1/setup.py b/owl-bot-staging/v1beta1/setup.py new file mode 100644 index 0000000..0c1a9f7 --- /dev/null +++ b/owl-bot-staging/v1beta1/setup.py @@ -0,0 +1,92 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +import io +import os + +import setuptools # type: ignore + +package_root = os.path.abspath(os.path.dirname(__file__)) + +name = 'google-cloud-private-ca' + + +description = "Google Cloud Private Ca API client library" + +version = {} +with open(os.path.join(package_root, 'google/cloud/security/privateca/gapic_version.py')) as fp: + exec(fp.read(), version) +version = version["__version__"] + +if version[0] == "0": + release_status = "Development Status :: 4 - Beta" +else: + release_status = "Development Status :: 5 - Production/Stable" + +dependencies = [ + "google-api-core[grpc] >= 1.34.0, <3.0.0dev,!=2.0.*,!=2.1.*,!=2.2.*,!=2.3.*,!=2.4.*,!=2.5.*,!=2.6.*,!=2.7.*,!=2.8.*,!=2.9.*,!=2.10.*", + "proto-plus >= 1.22.0, <2.0.0dev", + "proto-plus >= 1.22.2, <2.0.0dev; python_version>='3.11'", + "protobuf>=3.19.5,<5.0.0dev,!=3.20.0,!=3.20.1,!=4.21.0,!=4.21.1,!=4.21.2,!=4.21.3,!=4.21.4,!=4.21.5", +] +url = "https://github.com/googleapis/python-private-ca" + +package_root = os.path.abspath(os.path.dirname(__file__)) + +readme_filename = os.path.join(package_root, "README.rst") +with io.open(readme_filename, encoding="utf-8") as readme_file: + readme = readme_file.read() + +packages = [ + package + for package in setuptools.PEP420PackageFinder.find() + if package.startswith("google") +] + +namespaces = ["google"] +if "google.cloud" in packages: + namespaces.append("google.cloud") + +setuptools.setup( + name=name, + version=version, + description=description, + long_description=readme, + author="Google LLC", + author_email="googleapis-packages@google.com", + license="Apache 2.0", + url=url, + classifiers=[ + release_status, + "Intended Audience :: Developers", + "License :: OSI Approved :: Apache Software License", + "Programming Language :: Python", + "Programming Language :: Python :: 3", + "Programming Language :: Python :: 3.7", + "Programming Language :: Python :: 3.8", + "Programming Language :: Python :: 3.9", + "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11", + "Operating System :: OS Independent", + "Topic :: Internet", + ], + platforms="Posix; MacOS X; Windows", + packages=packages, + python_requires=">=3.7", + namespace_packages=namespaces, + install_requires=dependencies, + include_package_data=True, + zip_safe=False, +) diff --git a/owl-bot-staging/v1beta1/testing/constraints-3.10.txt b/owl-bot-staging/v1beta1/testing/constraints-3.10.txt new file mode 100644 index 0000000..ed7f9ae --- /dev/null +++ b/owl-bot-staging/v1beta1/testing/constraints-3.10.txt @@ -0,0 +1,6 @@ +# -*- coding: utf-8 -*- +# This constraints file is required for unit tests. +# List all library dependencies and extras in this file. +google-api-core +proto-plus +protobuf diff --git a/owl-bot-staging/v1beta1/testing/constraints-3.11.txt b/owl-bot-staging/v1beta1/testing/constraints-3.11.txt new file mode 100644 index 0000000..ed7f9ae --- /dev/null +++ b/owl-bot-staging/v1beta1/testing/constraints-3.11.txt @@ -0,0 +1,6 @@ +# -*- coding: utf-8 -*- +# This constraints file is required for unit tests. +# List all library dependencies and extras in this file. +google-api-core +proto-plus +protobuf diff --git a/owl-bot-staging/v1beta1/testing/constraints-3.12.txt b/owl-bot-staging/v1beta1/testing/constraints-3.12.txt new file mode 100644 index 0000000..ed7f9ae --- /dev/null +++ b/owl-bot-staging/v1beta1/testing/constraints-3.12.txt @@ -0,0 +1,6 @@ +# -*- coding: utf-8 -*- +# This constraints file is required for unit tests. +# List all library dependencies and extras in this file. +google-api-core +proto-plus +protobuf diff --git a/owl-bot-staging/v1beta1/testing/constraints-3.7.txt b/owl-bot-staging/v1beta1/testing/constraints-3.7.txt new file mode 100644 index 0000000..6c44adf --- /dev/null +++ b/owl-bot-staging/v1beta1/testing/constraints-3.7.txt @@ -0,0 +1,9 @@ +# This constraints file is used to check that lower bounds +# are correct in setup.py +# List all library dependencies and extras in this file. +# Pin the version to the lower bound. +# e.g., if setup.py has "google-cloud-foo >= 1.14.0, < 2.0.0dev", +# Then this file should have google-cloud-foo==1.14.0 +google-api-core==1.34.0 +proto-plus==1.22.0 +protobuf==3.19.5 diff --git a/owl-bot-staging/v1beta1/testing/constraints-3.8.txt b/owl-bot-staging/v1beta1/testing/constraints-3.8.txt new file mode 100644 index 0000000..ed7f9ae --- /dev/null +++ b/owl-bot-staging/v1beta1/testing/constraints-3.8.txt @@ -0,0 +1,6 @@ +# -*- coding: utf-8 -*- +# This constraints file is required for unit tests. +# List all library dependencies and extras in this file. +google-api-core +proto-plus +protobuf diff --git a/owl-bot-staging/v1beta1/testing/constraints-3.9.txt b/owl-bot-staging/v1beta1/testing/constraints-3.9.txt new file mode 100644 index 0000000..ed7f9ae --- /dev/null +++ b/owl-bot-staging/v1beta1/testing/constraints-3.9.txt @@ -0,0 +1,6 @@ +# -*- coding: utf-8 -*- +# This constraints file is required for unit tests. +# List all library dependencies and extras in this file. +google-api-core +proto-plus +protobuf diff --git a/owl-bot-staging/v1beta1/tests/__init__.py b/owl-bot-staging/v1beta1/tests/__init__.py new file mode 100644 index 0000000..231bc12 --- /dev/null +++ b/owl-bot-staging/v1beta1/tests/__init__.py @@ -0,0 +1,16 @@ + +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# diff --git a/owl-bot-staging/v1beta1/tests/unit/__init__.py b/owl-bot-staging/v1beta1/tests/unit/__init__.py new file mode 100644 index 0000000..231bc12 --- /dev/null +++ b/owl-bot-staging/v1beta1/tests/unit/__init__.py @@ -0,0 +1,16 @@ + +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# diff --git a/owl-bot-staging/v1beta1/tests/unit/gapic/__init__.py b/owl-bot-staging/v1beta1/tests/unit/gapic/__init__.py new file mode 100644 index 0000000..231bc12 --- /dev/null +++ b/owl-bot-staging/v1beta1/tests/unit/gapic/__init__.py @@ -0,0 +1,16 @@ + +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# diff --git a/owl-bot-staging/v1beta1/tests/unit/gapic/privateca_v1beta1/__init__.py b/owl-bot-staging/v1beta1/tests/unit/gapic/privateca_v1beta1/__init__.py new file mode 100644 index 0000000..231bc12 --- /dev/null +++ b/owl-bot-staging/v1beta1/tests/unit/gapic/privateca_v1beta1/__init__.py @@ -0,0 +1,16 @@ + +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# diff --git a/owl-bot-staging/v1beta1/tests/unit/gapic/privateca_v1beta1/test_certificate_authority_service.py b/owl-bot-staging/v1beta1/tests/unit/gapic/privateca_v1beta1/test_certificate_authority_service.py new file mode 100644 index 0000000..e86b4e4 --- /dev/null +++ b/owl-bot-staging/v1beta1/tests/unit/gapic/privateca_v1beta1/test_certificate_authority_service.py @@ -0,0 +1,6833 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +import os +# try/except added for compatibility with python < 3.8 +try: + from unittest import mock + from unittest.mock import AsyncMock # pragma: NO COVER +except ImportError: # pragma: NO COVER + import mock + +import grpc +from grpc.experimental import aio +import math +import pytest +from proto.marshal.rules.dates import DurationRule, TimestampRule +from proto.marshal.rules import wrappers + +from google.api_core import client_options +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 +from google.api_core import operation_async # type: ignore +from google.api_core import operations_v1 +from google.api_core import path_template +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 +from google.cloud.security.privateca_v1beta1.services.certificate_authority_service import CertificateAuthorityServiceClient +from google.cloud.security.privateca_v1beta1.services.certificate_authority_service import pagers +from google.cloud.security.privateca_v1beta1.services.certificate_authority_service import transports +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 # 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 + + +def client_cert_source_callback(): + return b"cert bytes", b"key bytes" + + +# If default endpoint is localhost, then default mtls endpoint will be the same. +# This method modifies the default endpoint so the client can produce a different +# mtls endpoint for endpoint testing purposes. +def modify_default_endpoint(client): + return "foo.googleapis.com" if ("localhost" in client.DEFAULT_ENDPOINT) else client.DEFAULT_ENDPOINT + + +def test__get_default_mtls_endpoint(): + api_endpoint = "example.googleapis.com" + api_mtls_endpoint = "example.mtls.googleapis.com" + sandbox_endpoint = "example.sandbox.googleapis.com" + sandbox_mtls_endpoint = "example.mtls.sandbox.googleapis.com" + non_googleapi = "api.example.com" + + assert CertificateAuthorityServiceClient._get_default_mtls_endpoint(None) is None + assert CertificateAuthorityServiceClient._get_default_mtls_endpoint(api_endpoint) == api_mtls_endpoint + assert CertificateAuthorityServiceClient._get_default_mtls_endpoint(api_mtls_endpoint) == api_mtls_endpoint + assert CertificateAuthorityServiceClient._get_default_mtls_endpoint(sandbox_endpoint) == sandbox_mtls_endpoint + assert CertificateAuthorityServiceClient._get_default_mtls_endpoint(sandbox_mtls_endpoint) == sandbox_mtls_endpoint + assert CertificateAuthorityServiceClient._get_default_mtls_endpoint(non_googleapi) == non_googleapi + + +@pytest.mark.parametrize("client_class,transport_name", [ + (CertificateAuthorityServiceClient, "grpc"), + (CertificateAuthorityServiceAsyncClient, "grpc_asyncio"), +]) +def test_certificate_authority_service_client_from_service_account_info(client_class, transport_name): + creds = ga_credentials.AnonymousCredentials() + with mock.patch.object(service_account.Credentials, 'from_service_account_info') as factory: + factory.return_value = creds + info = {"valid": True} + client = client_class.from_service_account_info(info, transport=transport_name) + assert client.transport._credentials == creds + assert isinstance(client, client_class) + + assert client.transport._host == ( + 'privateca.googleapis.com:443' + ) + + +@pytest.mark.parametrize("transport_class,transport_name", [ + (transports.CertificateAuthorityServiceGrpcTransport, "grpc"), + (transports.CertificateAuthorityServiceGrpcAsyncIOTransport, "grpc_asyncio"), +]) +def test_certificate_authority_service_client_service_account_always_use_jwt(transport_class, transport_name): + with mock.patch.object(service_account.Credentials, 'with_always_use_jwt_access', create=True) as use_jwt: + creds = service_account.Credentials(None, None, None) + transport = transport_class(credentials=creds, always_use_jwt_access=True) + use_jwt.assert_called_once_with(True) + + with mock.patch.object(service_account.Credentials, 'with_always_use_jwt_access', create=True) as use_jwt: + creds = service_account.Credentials(None, None, None) + transport = transport_class(credentials=creds, always_use_jwt_access=False) + use_jwt.assert_not_called() + + +@pytest.mark.parametrize("client_class,transport_name", [ + (CertificateAuthorityServiceClient, "grpc"), + (CertificateAuthorityServiceAsyncClient, "grpc_asyncio"), +]) +def test_certificate_authority_service_client_from_service_account_file(client_class, transport_name): + creds = ga_credentials.AnonymousCredentials() + with mock.patch.object(service_account.Credentials, 'from_service_account_file') as factory: + factory.return_value = creds + client = client_class.from_service_account_file("dummy/file/path.json", transport=transport_name) + assert client.transport._credentials == creds + assert isinstance(client, client_class) + + client = client_class.from_service_account_json("dummy/file/path.json", transport=transport_name) + assert client.transport._credentials == creds + assert isinstance(client, client_class) + + assert client.transport._host == ( + 'privateca.googleapis.com:443' + ) + + +def test_certificate_authority_service_client_get_transport_class(): + transport = CertificateAuthorityServiceClient.get_transport_class() + available_transports = [ + transports.CertificateAuthorityServiceGrpcTransport, + ] + assert transport in available_transports + + transport = CertificateAuthorityServiceClient.get_transport_class("grpc") + assert transport == transports.CertificateAuthorityServiceGrpcTransport + + +@pytest.mark.parametrize("client_class,transport_class,transport_name", [ + (CertificateAuthorityServiceClient, transports.CertificateAuthorityServiceGrpcTransport, "grpc"), + (CertificateAuthorityServiceAsyncClient, transports.CertificateAuthorityServiceGrpcAsyncIOTransport, "grpc_asyncio"), +]) +@mock.patch.object(CertificateAuthorityServiceClient, "DEFAULT_ENDPOINT", modify_default_endpoint(CertificateAuthorityServiceClient)) +@mock.patch.object(CertificateAuthorityServiceAsyncClient, "DEFAULT_ENDPOINT", modify_default_endpoint(CertificateAuthorityServiceAsyncClient)) +def test_certificate_authority_service_client_client_options(client_class, transport_class, transport_name): + # Check that if channel is provided we won't create a new one. + with mock.patch.object(CertificateAuthorityServiceClient, 'get_transport_class') as gtc: + transport = transport_class( + credentials=ga_credentials.AnonymousCredentials() + ) + client = client_class(transport=transport) + gtc.assert_not_called() + + # Check that if channel is provided via str we will create a new one. + with mock.patch.object(CertificateAuthorityServiceClient, 'get_transport_class') as gtc: + client = client_class(transport=transport_name) + gtc.assert_called() + + # Check the case api_endpoint is provided. + options = client_options.ClientOptions(api_endpoint="squid.clam.whelk") + with mock.patch.object(transport_class, '__init__') as patched: + patched.return_value = None + client = client_class(transport=transport_name, client_options=options) + patched.assert_called_once_with( + credentials=None, + credentials_file=None, + host="squid.clam.whelk", + scopes=None, + client_cert_source_for_mtls=None, + quota_project_id=None, + client_info=transports.base.DEFAULT_CLIENT_INFO, + always_use_jwt_access=True, + api_audience=None, + ) + + # Check the case api_endpoint is not provided and GOOGLE_API_USE_MTLS_ENDPOINT is + # "never". + with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "never"}): + with mock.patch.object(transport_class, '__init__') as patched: + patched.return_value = None + client = client_class(transport=transport_name) + patched.assert_called_once_with( + credentials=None, + credentials_file=None, + host=client.DEFAULT_ENDPOINT, + scopes=None, + client_cert_source_for_mtls=None, + quota_project_id=None, + client_info=transports.base.DEFAULT_CLIENT_INFO, + always_use_jwt_access=True, + api_audience=None, + ) + + # Check the case api_endpoint is not provided and GOOGLE_API_USE_MTLS_ENDPOINT is + # "always". + with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "always"}): + with mock.patch.object(transport_class, '__init__') as patched: + patched.return_value = None + client = client_class(transport=transport_name) + patched.assert_called_once_with( + credentials=None, + credentials_file=None, + host=client.DEFAULT_MTLS_ENDPOINT, + scopes=None, + client_cert_source_for_mtls=None, + quota_project_id=None, + client_info=transports.base.DEFAULT_CLIENT_INFO, + always_use_jwt_access=True, + api_audience=None, + ) + + # Check the case api_endpoint is not provided and GOOGLE_API_USE_MTLS_ENDPOINT has + # unsupported value. + with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "Unsupported"}): + with pytest.raises(MutualTLSChannelError): + client = client_class(transport=transport_name) + + # Check the case GOOGLE_API_USE_CLIENT_CERTIFICATE has unsupported value. + with mock.patch.dict(os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": "Unsupported"}): + with pytest.raises(ValueError): + client = client_class(transport=transport_name) + + # Check the case quota_project_id is provided + options = client_options.ClientOptions(quota_project_id="octopus") + with mock.patch.object(transport_class, '__init__') as patched: + patched.return_value = None + client = client_class(client_options=options, transport=transport_name) + patched.assert_called_once_with( + credentials=None, + credentials_file=None, + host=client.DEFAULT_ENDPOINT, + scopes=None, + client_cert_source_for_mtls=None, + quota_project_id="octopus", + client_info=transports.base.DEFAULT_CLIENT_INFO, + always_use_jwt_access=True, + api_audience=None, + ) + # Check the case api_endpoint is provided + options = client_options.ClientOptions(api_audience="https://language.googleapis.com") + with mock.patch.object(transport_class, '__init__') as patched: + patched.return_value = None + client = client_class(client_options=options, transport=transport_name) + patched.assert_called_once_with( + credentials=None, + credentials_file=None, + host=client.DEFAULT_ENDPOINT, + scopes=None, + client_cert_source_for_mtls=None, + quota_project_id=None, + client_info=transports.base.DEFAULT_CLIENT_INFO, + always_use_jwt_access=True, + api_audience="https://language.googleapis.com" + ) + +@pytest.mark.parametrize("client_class,transport_class,transport_name,use_client_cert_env", [ + (CertificateAuthorityServiceClient, transports.CertificateAuthorityServiceGrpcTransport, "grpc", "true"), + (CertificateAuthorityServiceAsyncClient, transports.CertificateAuthorityServiceGrpcAsyncIOTransport, "grpc_asyncio", "true"), + (CertificateAuthorityServiceClient, transports.CertificateAuthorityServiceGrpcTransport, "grpc", "false"), + (CertificateAuthorityServiceAsyncClient, transports.CertificateAuthorityServiceGrpcAsyncIOTransport, "grpc_asyncio", "false"), +]) +@mock.patch.object(CertificateAuthorityServiceClient, "DEFAULT_ENDPOINT", modify_default_endpoint(CertificateAuthorityServiceClient)) +@mock.patch.object(CertificateAuthorityServiceAsyncClient, "DEFAULT_ENDPOINT", modify_default_endpoint(CertificateAuthorityServiceAsyncClient)) +@mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "auto"}) +def test_certificate_authority_service_client_mtls_env_auto(client_class, transport_class, transport_name, use_client_cert_env): + # This tests the endpoint autoswitch behavior. Endpoint is autoswitched to the default + # mtls endpoint, if GOOGLE_API_USE_CLIENT_CERTIFICATE is "true" and client cert exists. + + # Check the case client_cert_source is provided. Whether client cert is used depends on + # GOOGLE_API_USE_CLIENT_CERTIFICATE value. + with mock.patch.dict(os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": use_client_cert_env}): + options = client_options.ClientOptions(client_cert_source=client_cert_source_callback) + with mock.patch.object(transport_class, '__init__') as patched: + patched.return_value = None + client = client_class(client_options=options, transport=transport_name) + + if use_client_cert_env == "false": + expected_client_cert_source = None + expected_host = client.DEFAULT_ENDPOINT + else: + expected_client_cert_source = client_cert_source_callback + expected_host = client.DEFAULT_MTLS_ENDPOINT + + patched.assert_called_once_with( + credentials=None, + credentials_file=None, + host=expected_host, + scopes=None, + client_cert_source_for_mtls=expected_client_cert_source, + quota_project_id=None, + client_info=transports.base.DEFAULT_CLIENT_INFO, + always_use_jwt_access=True, + api_audience=None, + ) + + # Check the case ADC client cert is provided. Whether client cert is used depends on + # GOOGLE_API_USE_CLIENT_CERTIFICATE value. + with mock.patch.dict(os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": use_client_cert_env}): + with mock.patch.object(transport_class, '__init__') as patched: + with mock.patch('google.auth.transport.mtls.has_default_client_cert_source', return_value=True): + with mock.patch('google.auth.transport.mtls.default_client_cert_source', return_value=client_cert_source_callback): + if use_client_cert_env == "false": + expected_host = client.DEFAULT_ENDPOINT + expected_client_cert_source = None + else: + expected_host = client.DEFAULT_MTLS_ENDPOINT + expected_client_cert_source = client_cert_source_callback + + patched.return_value = None + client = client_class(transport=transport_name) + patched.assert_called_once_with( + credentials=None, + credentials_file=None, + host=expected_host, + scopes=None, + client_cert_source_for_mtls=expected_client_cert_source, + quota_project_id=None, + client_info=transports.base.DEFAULT_CLIENT_INFO, + always_use_jwt_access=True, + api_audience=None, + ) + + # Check the case client_cert_source and ADC client cert are not provided. + with mock.patch.dict(os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": use_client_cert_env}): + with mock.patch.object(transport_class, '__init__') as patched: + with mock.patch("google.auth.transport.mtls.has_default_client_cert_source", return_value=False): + patched.return_value = None + client = client_class(transport=transport_name) + patched.assert_called_once_with( + credentials=None, + credentials_file=None, + host=client.DEFAULT_ENDPOINT, + scopes=None, + client_cert_source_for_mtls=None, + quota_project_id=None, + client_info=transports.base.DEFAULT_CLIENT_INFO, + always_use_jwt_access=True, + api_audience=None, + ) + + +@pytest.mark.parametrize("client_class", [ + CertificateAuthorityServiceClient, CertificateAuthorityServiceAsyncClient +]) +@mock.patch.object(CertificateAuthorityServiceClient, "DEFAULT_ENDPOINT", modify_default_endpoint(CertificateAuthorityServiceClient)) +@mock.patch.object(CertificateAuthorityServiceAsyncClient, "DEFAULT_ENDPOINT", modify_default_endpoint(CertificateAuthorityServiceAsyncClient)) +def test_certificate_authority_service_client_get_mtls_endpoint_and_cert_source(client_class): + mock_client_cert_source = mock.Mock() + + # Test the case GOOGLE_API_USE_CLIENT_CERTIFICATE is "true". + with mock.patch.dict(os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": "true"}): + mock_api_endpoint = "foo" + options = client_options.ClientOptions(client_cert_source=mock_client_cert_source, api_endpoint=mock_api_endpoint) + api_endpoint, cert_source = client_class.get_mtls_endpoint_and_cert_source(options) + assert api_endpoint == mock_api_endpoint + assert cert_source == mock_client_cert_source + + # Test the case GOOGLE_API_USE_CLIENT_CERTIFICATE is "false". + with mock.patch.dict(os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": "false"}): + mock_client_cert_source = mock.Mock() + mock_api_endpoint = "foo" + options = client_options.ClientOptions(client_cert_source=mock_client_cert_source, api_endpoint=mock_api_endpoint) + api_endpoint, cert_source = client_class.get_mtls_endpoint_and_cert_source(options) + assert api_endpoint == mock_api_endpoint + assert cert_source is None + + # Test the case GOOGLE_API_USE_MTLS_ENDPOINT is "never". + with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "never"}): + api_endpoint, cert_source = client_class.get_mtls_endpoint_and_cert_source() + assert api_endpoint == client_class.DEFAULT_ENDPOINT + assert cert_source is None + + # Test the case GOOGLE_API_USE_MTLS_ENDPOINT is "always". + with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "always"}): + api_endpoint, cert_source = client_class.get_mtls_endpoint_and_cert_source() + assert api_endpoint == client_class.DEFAULT_MTLS_ENDPOINT + assert cert_source is None + + # Test the case GOOGLE_API_USE_MTLS_ENDPOINT is "auto" and default cert doesn't exist. + with mock.patch.dict(os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": "true"}): + with mock.patch('google.auth.transport.mtls.has_default_client_cert_source', return_value=False): + api_endpoint, cert_source = client_class.get_mtls_endpoint_and_cert_source() + assert api_endpoint == client_class.DEFAULT_ENDPOINT + assert cert_source is None + + # Test the case GOOGLE_API_USE_MTLS_ENDPOINT is "auto" and default cert exists. + with mock.patch.dict(os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": "true"}): + with mock.patch('google.auth.transport.mtls.has_default_client_cert_source', return_value=True): + with mock.patch('google.auth.transport.mtls.default_client_cert_source', return_value=mock_client_cert_source): + api_endpoint, cert_source = client_class.get_mtls_endpoint_and_cert_source() + assert api_endpoint == client_class.DEFAULT_MTLS_ENDPOINT + assert cert_source == mock_client_cert_source + + +@pytest.mark.parametrize("client_class,transport_class,transport_name", [ + (CertificateAuthorityServiceClient, transports.CertificateAuthorityServiceGrpcTransport, "grpc"), + (CertificateAuthorityServiceAsyncClient, transports.CertificateAuthorityServiceGrpcAsyncIOTransport, "grpc_asyncio"), +]) +def test_certificate_authority_service_client_client_options_scopes(client_class, transport_class, transport_name): + # Check the case scopes are provided. + options = client_options.ClientOptions( + scopes=["1", "2"], + ) + with mock.patch.object(transport_class, '__init__') as patched: + patched.return_value = None + client = client_class(client_options=options, transport=transport_name) + patched.assert_called_once_with( + credentials=None, + credentials_file=None, + host=client.DEFAULT_ENDPOINT, + scopes=["1", "2"], + client_cert_source_for_mtls=None, + quota_project_id=None, + client_info=transports.base.DEFAULT_CLIENT_INFO, + always_use_jwt_access=True, + api_audience=None, + ) + +@pytest.mark.parametrize("client_class,transport_class,transport_name,grpc_helpers", [ + (CertificateAuthorityServiceClient, transports.CertificateAuthorityServiceGrpcTransport, "grpc", grpc_helpers), + (CertificateAuthorityServiceAsyncClient, transports.CertificateAuthorityServiceGrpcAsyncIOTransport, "grpc_asyncio", grpc_helpers_async), +]) +def test_certificate_authority_service_client_client_options_credentials_file(client_class, transport_class, transport_name, grpc_helpers): + # Check the case credentials file is provided. + options = client_options.ClientOptions( + credentials_file="credentials.json" + ) + + with mock.patch.object(transport_class, '__init__') as patched: + patched.return_value = None + client = client_class(client_options=options, transport=transport_name) + patched.assert_called_once_with( + credentials=None, + credentials_file="credentials.json", + host=client.DEFAULT_ENDPOINT, + scopes=None, + client_cert_source_for_mtls=None, + quota_project_id=None, + client_info=transports.base.DEFAULT_CLIENT_INFO, + always_use_jwt_access=True, + api_audience=None, + ) + +def test_certificate_authority_service_client_client_options_from_dict(): + with mock.patch('google.cloud.security.privateca_v1beta1.services.certificate_authority_service.transports.CertificateAuthorityServiceGrpcTransport.__init__') as grpc_transport: + grpc_transport.return_value = None + client = CertificateAuthorityServiceClient( + client_options={'api_endpoint': 'squid.clam.whelk'} + ) + grpc_transport.assert_called_once_with( + credentials=None, + credentials_file=None, + host="squid.clam.whelk", + scopes=None, + client_cert_source_for_mtls=None, + quota_project_id=None, + client_info=transports.base.DEFAULT_CLIENT_INFO, + always_use_jwt_access=True, + api_audience=None, + ) + + +@pytest.mark.parametrize("client_class,transport_class,transport_name,grpc_helpers", [ + (CertificateAuthorityServiceClient, transports.CertificateAuthorityServiceGrpcTransport, "grpc", grpc_helpers), + (CertificateAuthorityServiceAsyncClient, transports.CertificateAuthorityServiceGrpcAsyncIOTransport, "grpc_asyncio", grpc_helpers_async), +]) +def test_certificate_authority_service_client_create_channel_credentials_file(client_class, transport_class, transport_name, grpc_helpers): + # Check the case credentials file is provided. + options = client_options.ClientOptions( + credentials_file="credentials.json" + ) + + with mock.patch.object(transport_class, '__init__') as patched: + patched.return_value = None + client = client_class(client_options=options, transport=transport_name) + patched.assert_called_once_with( + credentials=None, + credentials_file="credentials.json", + host=client.DEFAULT_ENDPOINT, + scopes=None, + client_cert_source_for_mtls=None, + quota_project_id=None, + client_info=transports.base.DEFAULT_CLIENT_INFO, + always_use_jwt_access=True, + api_audience=None, + ) + + # test that the credentials from file are saved and used as the credentials. + with mock.patch.object( + google.auth, "load_credentials_from_file", autospec=True + ) as load_creds, mock.patch.object( + google.auth, "default", autospec=True + ) as adc, mock.patch.object( + grpc_helpers, "create_channel" + ) as create_channel: + creds = ga_credentials.AnonymousCredentials() + file_creds = ga_credentials.AnonymousCredentials() + load_creds.return_value = (file_creds, None) + adc.return_value = (creds, None) + client = client_class(client_options=options, transport=transport_name) + create_channel.assert_called_with( + "privateca.googleapis.com:443", + credentials=file_creds, + credentials_file=None, + quota_project_id=None, + default_scopes=( + 'https://www.googleapis.com/auth/cloud-platform', +), + scopes=None, + default_host="privateca.googleapis.com", + ssl_credentials=None, + options=[ + ("grpc.max_send_message_length", -1), + ("grpc.max_receive_message_length", -1), + ], + ) + + +@pytest.mark.parametrize("request_type", [ + service.CreateCertificateRequest, + dict, +]) +def test_create_certificate(request_type, transport: str = 'grpc'): + client = CertificateAuthorityServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.create_certificate), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = resources.Certificate( + name='name_value', + pem_certificate='pem_certificate_value', + 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'] + + +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=ga_credentials.AnonymousCredentials(), + transport='grpc', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.create_certificate), + '__call__') as call: + client.create_certificate() + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == service.CreateCertificateRequest() + +@pytest.mark.asyncio +async def test_create_certificate_async(transport: str = 'grpc_asyncio', request_type=service.CreateCertificateRequest): + client = CertificateAuthorityServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.create_certificate), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(resources.Certificate( + name='name_value', + pem_certificate='pem_certificate_value', + 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'] + + +@pytest.mark.asyncio +async def test_create_certificate_async_from_dict(): + await test_create_certificate_async(request_type=dict) + + +def test_create_certificate_field_headers(): + client = CertificateAuthorityServiceClient( + 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. + with mock.patch.object( + 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. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ( + 'x-goog-request-params', + 'parent=parent_value', + ) in kw['metadata'] + + +@pytest.mark.asyncio +async def test_create_certificate_field_headers_async(): + client = CertificateAuthorityServiceAsyncClient( + 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. + with mock.patch.object( + type(client.transport.create_certificate), + '__call__') as call: + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(resources.Certificate()) + 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] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ( + 'x-goog-request-params', + 'parent=parent_value', + ) in kw['metadata'] + + +def test_create_certificate_flattened(): + client = CertificateAuthorityServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.create_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.create_certificate( + parent='parent_value', + certificate=resources.Certificate(name='name_value'), + certificate_id='certificate_id_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] + arg = args[0].parent + mock_val = 'parent_value' + assert arg == mock_val + arg = args[0].certificate + mock_val = resources.Certificate(name='name_value') + assert arg == mock_val + arg = args[0].certificate_id + mock_val = 'certificate_id_value' + assert arg == mock_val + + +def test_create_certificate_flattened_error(): + client = CertificateAuthorityServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + client.create_certificate( + service.CreateCertificateRequest(), + parent='parent_value', + certificate=resources.Certificate(name='name_value'), + certificate_id='certificate_id_value', + ) + +@pytest.mark.asyncio +async def test_create_certificate_flattened_async(): + client = CertificateAuthorityServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.create_certificate), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = resources.Certificate() + + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(resources.Certificate()) + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + response = await client.create_certificate( + parent='parent_value', + certificate=resources.Certificate(name='name_value'), + certificate_id='certificate_id_value', + ) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + arg = args[0].parent + mock_val = 'parent_value' + assert arg == mock_val + arg = args[0].certificate + mock_val = resources.Certificate(name='name_value') + assert arg == mock_val + arg = args[0].certificate_id + mock_val = 'certificate_id_value' + assert arg == mock_val + +@pytest.mark.asyncio +async def test_create_certificate_flattened_error_async(): + client = CertificateAuthorityServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + await client.create_certificate( + service.CreateCertificateRequest(), + parent='parent_value', + certificate=resources.Certificate(name='name_value'), + certificate_id='certificate_id_value', + ) + + +@pytest.mark.parametrize("request_type", [ + service.GetCertificateRequest, + dict, +]) +def test_get_certificate(request_type, transport: str = 'grpc'): + client = CertificateAuthorityServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # 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( + name='name_value', + pem_certificate='pem_certificate_value', + 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'] + + +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=ga_credentials.AnonymousCredentials(), + transport='grpc', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.get_certificate), + '__call__') as call: + client.get_certificate() + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == service.GetCertificateRequest() + +@pytest.mark.asyncio +async def test_get_certificate_async(transport: str = 'grpc_asyncio', request_type=service.GetCertificateRequest): + client = CertificateAuthorityServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # 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 =grpc_helpers_async.FakeUnaryUnaryCall(resources.Certificate( + name='name_value', + pem_certificate='pem_certificate_value', + 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'] + + +@pytest.mark.asyncio +async def test_get_certificate_async_from_dict(): + await test_get_certificate_async(request_type=dict) + + +def test_get_certificate_field_headers(): + client = CertificateAuthorityServiceClient( + 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. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ( + 'x-goog-request-params', + 'name=name_value', + ) in kw['metadata'] + + +@pytest.mark.asyncio +async def test_get_certificate_field_headers_async(): + client = CertificateAuthorityServiceAsyncClient( + 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 = grpc_helpers_async.FakeUnaryUnaryCall(resources.Certificate()) + 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] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ( + 'x-goog-request-params', + 'name=name_value', + ) in kw['metadata'] + + +def test_get_certificate_flattened(): + client = CertificateAuthorityServiceClient( + 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', + ) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + arg = args[0].name + mock_val = 'name_value' + assert arg == mock_val + + +def test_get_certificate_flattened_error(): + client = CertificateAuthorityServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + client.get_certificate( + service.GetCertificateRequest(), + name='name_value', + ) + +@pytest.mark.asyncio +async def test_get_certificate_flattened_async(): + client = CertificateAuthorityServiceAsyncClient( + 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.return_value = grpc_helpers_async.FakeUnaryUnaryCall(resources.Certificate()) + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + response = await client.get_certificate( + name='name_value', + ) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + arg = args[0].name + mock_val = 'name_value' + assert arg == mock_val + +@pytest.mark.asyncio +async def test_get_certificate_flattened_error_async(): + client = CertificateAuthorityServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + await client.get_certificate( + service.GetCertificateRequest(), + name='name_value', + ) + + +@pytest.mark.parametrize("request_type", [ + service.ListCertificatesRequest, + dict, +]) +def test_list_certificates(request_type, transport: str = 'grpc'): + client = CertificateAuthorityServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_certificates), + '__call__') as call: + # Designate an appropriate return value for the call. + 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'] + + +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=ga_credentials.AnonymousCredentials(), + transport='grpc', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_certificates), + '__call__') as call: + client.list_certificates() + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == service.ListCertificatesRequest() + +@pytest.mark.asyncio +async def test_list_certificates_async(transport: str = 'grpc_asyncio', request_type=service.ListCertificatesRequest): + client = CertificateAuthorityServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_certificates), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(service.ListCertificatesResponse( + next_page_token='next_page_token_value', + 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'] + + +@pytest.mark.asyncio +async def test_list_certificates_async_from_dict(): + await test_list_certificates_async(request_type=dict) + + +def test_list_certificates_field_headers(): + client = CertificateAuthorityServiceClient( + 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. + with mock.patch.object( + 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. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ( + 'x-goog-request-params', + 'parent=parent_value', + ) in kw['metadata'] + + +@pytest.mark.asyncio +async def test_list_certificates_field_headers_async(): + client = CertificateAuthorityServiceAsyncClient( + 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. + with mock.patch.object( + type(client.transport.list_certificates), + '__call__') as call: + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(service.ListCertificatesResponse()) + 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] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ( + 'x-goog-request-params', + 'parent=parent_value', + ) in kw['metadata'] + + +def test_list_certificates_flattened(): + client = CertificateAuthorityServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_certificates), + '__call__') 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', + ) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + arg = args[0].parent + mock_val = 'parent_value' + assert arg == mock_val + + +def test_list_certificates_flattened_error(): + client = CertificateAuthorityServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + client.list_certificates( + service.ListCertificatesRequest(), + parent='parent_value', + ) + +@pytest.mark.asyncio +async def test_list_certificates_flattened_async(): + client = CertificateAuthorityServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_certificates), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = service.ListCertificatesResponse() + + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(service.ListCertificatesResponse()) + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + response = await client.list_certificates( + parent='parent_value', + ) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + arg = args[0].parent + mock_val = 'parent_value' + assert arg == mock_val + +@pytest.mark.asyncio +async def test_list_certificates_flattened_error_async(): + client = CertificateAuthorityServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + await client.list_certificates( + service.ListCertificatesRequest(), + parent='parent_value', + ) + + +def test_list_certificates_pager(transport_name: str = "grpc"): + client = CertificateAuthorityServiceClient( + credentials=ga_credentials.AnonymousCredentials, + transport=transport_name, + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_certificates), + '__call__') as call: + # Set the response to a series of pages. + call.side_effect = ( + service.ListCertificatesResponse( + certificates=[ + resources.Certificate(), + resources.Certificate(), + resources.Certificate(), + ], + next_page_token='abc', + ), + service.ListCertificatesResponse( + certificates=[], + next_page_token='def', + ), + service.ListCertificatesResponse( + certificates=[ + resources.Certificate(), + ], + next_page_token='ghi', + ), + service.ListCertificatesResponse( + certificates=[ + resources.Certificate(), + resources.Certificate(), + ], + ), + RuntimeError, + ) + + metadata = () + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata(( + ('parent', ''), + )), + ) + pager = client.list_certificates(request={}) + + assert pager._metadata == metadata + + results = list(pager) + assert len(results) == 6 + assert all(isinstance(i, resources.Certificate) + for i in results) +def test_list_certificates_pages(transport_name: str = "grpc"): + client = CertificateAuthorityServiceClient( + credentials=ga_credentials.AnonymousCredentials, + transport=transport_name, + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_certificates), + '__call__') as call: + # Set the response to a series of pages. + call.side_effect = ( + service.ListCertificatesResponse( + certificates=[ + resources.Certificate(), + resources.Certificate(), + resources.Certificate(), + ], + next_page_token='abc', + ), + service.ListCertificatesResponse( + certificates=[], + next_page_token='def', + ), + service.ListCertificatesResponse( + certificates=[ + resources.Certificate(), + ], + next_page_token='ghi', + ), + service.ListCertificatesResponse( + certificates=[ + resources.Certificate(), + resources.Certificate(), + ], + ), + RuntimeError, + ) + pages = list(client.list_certificates(request={}).pages) + for page_, token in zip(pages, ['abc','def','ghi', '']): + assert page_.raw_page.next_page_token == token + +@pytest.mark.asyncio +async def test_list_certificates_async_pager(): + client = CertificateAuthorityServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials, + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_certificates), + '__call__', new_callable=mock.AsyncMock) as call: + # Set the response to a series of pages. + call.side_effect = ( + service.ListCertificatesResponse( + certificates=[ + resources.Certificate(), + resources.Certificate(), + resources.Certificate(), + ], + next_page_token='abc', + ), + service.ListCertificatesResponse( + certificates=[], + next_page_token='def', + ), + service.ListCertificatesResponse( + certificates=[ + resources.Certificate(), + ], + next_page_token='ghi', + ), + service.ListCertificatesResponse( + certificates=[ + resources.Certificate(), + resources.Certificate(), + ], + ), + RuntimeError, + ) + async_pager = await client.list_certificates(request={},) + assert async_pager.next_page_token == 'abc' + responses = [] + async for response in async_pager: # pragma: no branch + responses.append(response) + + assert len(responses) == 6 + assert all(isinstance(i, resources.Certificate) + for i in responses) + + +@pytest.mark.asyncio +async def test_list_certificates_async_pages(): + client = CertificateAuthorityServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials, + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_certificates), + '__call__', new_callable=mock.AsyncMock) as call: + # Set the response to a series of pages. + call.side_effect = ( + service.ListCertificatesResponse( + certificates=[ + resources.Certificate(), + resources.Certificate(), + resources.Certificate(), + ], + next_page_token='abc', + ), + service.ListCertificatesResponse( + certificates=[], + next_page_token='def', + ), + service.ListCertificatesResponse( + certificates=[ + resources.Certificate(), + ], + next_page_token='ghi', + ), + service.ListCertificatesResponse( + certificates=[ + resources.Certificate(), + resources.Certificate(), + ], + ), + RuntimeError, + ) + pages = [] + async for page_ in (await client.list_certificates(request={})).pages: # pragma: no branch + pages.append(page_) + for page_, token in zip(pages, ['abc','def','ghi', '']): + assert page_.raw_page.next_page_token == token + +@pytest.mark.parametrize("request_type", [ + service.RevokeCertificateRequest, + dict, +]) +def test_revoke_certificate(request_type, transport: str = 'grpc'): + client = CertificateAuthorityServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.revoke_certificate), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = resources.Certificate( + name='name_value', + pem_certificate='pem_certificate_value', + 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'] + + +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=ga_credentials.AnonymousCredentials(), + transport='grpc', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.revoke_certificate), + '__call__') as call: + client.revoke_certificate() + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == service.RevokeCertificateRequest() + +@pytest.mark.asyncio +async def test_revoke_certificate_async(transport: str = 'grpc_asyncio', request_type=service.RevokeCertificateRequest): + client = CertificateAuthorityServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.revoke_certificate), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(resources.Certificate( + name='name_value', + pem_certificate='pem_certificate_value', + 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'] + + +@pytest.mark.asyncio +async def test_revoke_certificate_async_from_dict(): + await test_revoke_certificate_async(request_type=dict) + + +def test_revoke_certificate_field_headers(): + client = CertificateAuthorityServiceClient( + 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. + with mock.patch.object( + 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. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ( + 'x-goog-request-params', + 'name=name_value', + ) in kw['metadata'] + + +@pytest.mark.asyncio +async def test_revoke_certificate_field_headers_async(): + client = CertificateAuthorityServiceAsyncClient( + 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. + with mock.patch.object( + type(client.transport.revoke_certificate), + '__call__') as call: + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(resources.Certificate()) + 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] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ( + 'x-goog-request-params', + 'name=name_value', + ) in kw['metadata'] + + +def test_revoke_certificate_flattened(): + client = CertificateAuthorityServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.revoke_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.revoke_certificate( + name='name_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] + arg = args[0].name + mock_val = 'name_value' + assert arg == mock_val + + +def test_revoke_certificate_flattened_error(): + client = CertificateAuthorityServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + client.revoke_certificate( + service.RevokeCertificateRequest(), + name='name_value', + ) + +@pytest.mark.asyncio +async def test_revoke_certificate_flattened_async(): + client = CertificateAuthorityServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.revoke_certificate), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = resources.Certificate() + + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(resources.Certificate()) + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + response = await client.revoke_certificate( + name='name_value', + ) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + arg = args[0].name + mock_val = 'name_value' + assert arg == mock_val + +@pytest.mark.asyncio +async def test_revoke_certificate_flattened_error_async(): + client = CertificateAuthorityServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + await client.revoke_certificate( + service.RevokeCertificateRequest(), + name='name_value', + ) + + +@pytest.mark.parametrize("request_type", [ + service.UpdateCertificateRequest, + dict, +]) +def test_update_certificate(request_type, transport: str = 'grpc'): + client = CertificateAuthorityServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.update_certificate), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = resources.Certificate( + name='name_value', + pem_certificate='pem_certificate_value', + 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'] + + +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=ga_credentials.AnonymousCredentials(), + transport='grpc', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.update_certificate), + '__call__') as call: + client.update_certificate() + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == service.UpdateCertificateRequest() + +@pytest.mark.asyncio +async def test_update_certificate_async(transport: str = 'grpc_asyncio', request_type=service.UpdateCertificateRequest): + client = CertificateAuthorityServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.update_certificate), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(resources.Certificate( + name='name_value', + pem_certificate='pem_certificate_value', + 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'] + + +@pytest.mark.asyncio +async def test_update_certificate_async_from_dict(): + await test_update_certificate_async(request_type=dict) + + +def test_update_certificate_field_headers(): + client = CertificateAuthorityServiceClient( + 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 = 'name_value' + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + 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. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ( + 'x-goog-request-params', + 'certificate.name=name_value', + ) in kw['metadata'] + + +@pytest.mark.asyncio +async def test_update_certificate_field_headers_async(): + client = CertificateAuthorityServiceAsyncClient( + 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 = 'name_value' + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.update_certificate), + '__call__') as call: + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(resources.Certificate()) + 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] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ( + 'x-goog-request-params', + 'certificate.name=name_value', + ) in kw['metadata'] + + +def test_update_certificate_flattened(): + client = CertificateAuthorityServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.update_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.update_certificate( + certificate=resources.Certificate(name='name_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] + arg = args[0].certificate + mock_val = resources.Certificate(name='name_value') + assert arg == mock_val + arg = args[0].update_mask + mock_val = field_mask_pb2.FieldMask(paths=['paths_value']) + assert arg == mock_val + + +def test_update_certificate_flattened_error(): + client = CertificateAuthorityServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + client.update_certificate( + service.UpdateCertificateRequest(), + certificate=resources.Certificate(name='name_value'), + update_mask=field_mask_pb2.FieldMask(paths=['paths_value']), + ) + +@pytest.mark.asyncio +async def test_update_certificate_flattened_async(): + client = CertificateAuthorityServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.update_certificate), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = resources.Certificate() + + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(resources.Certificate()) + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + response = await client.update_certificate( + certificate=resources.Certificate(name='name_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] + arg = args[0].certificate + mock_val = resources.Certificate(name='name_value') + assert arg == mock_val + arg = args[0].update_mask + mock_val = field_mask_pb2.FieldMask(paths=['paths_value']) + assert arg == mock_val + +@pytest.mark.asyncio +async def test_update_certificate_flattened_error_async(): + client = CertificateAuthorityServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + await client.update_certificate( + service.UpdateCertificateRequest(), + certificate=resources.Certificate(name='name_value'), + update_mask=field_mask_pb2.FieldMask(paths=['paths_value']), + ) + + +@pytest.mark.parametrize("request_type", [ + service.ActivateCertificateAuthorityRequest, + dict, +]) +def test_activate_certificate_authority(request_type, transport: str = 'grpc'): + client = CertificateAuthorityServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.activate_certificate_authority), + '__call__') 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. + assert isinstance(response, future.Future) + + +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=ga_credentials.AnonymousCredentials(), + transport='grpc', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.activate_certificate_authority), + '__call__') as call: + client.activate_certificate_authority() + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == service.ActivateCertificateAuthorityRequest() + +@pytest.mark.asyncio +async def test_activate_certificate_authority_async(transport: str = 'grpc_asyncio', request_type=service.ActivateCertificateAuthorityRequest): + client = CertificateAuthorityServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.activate_certificate_authority), + '__call__') as call: + # Designate an appropriate return value for the call. + 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. + assert isinstance(response, future.Future) + + +@pytest.mark.asyncio +async def test_activate_certificate_authority_async_from_dict(): + await test_activate_certificate_authority_async(request_type=dict) + + +def test_activate_certificate_authority_field_headers(): + client = CertificateAuthorityServiceClient( + 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. + with mock.patch.object( + 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. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ( + 'x-goog-request-params', + 'name=name_value', + ) in kw['metadata'] + + +@pytest.mark.asyncio +async def test_activate_certificate_authority_field_headers_async(): + client = CertificateAuthorityServiceAsyncClient( + 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. + with mock.patch.object( + type(client.transport.activate_certificate_authority), + '__call__') as call: + 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. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ( + 'x-goog-request-params', + 'name=name_value', + ) in kw['metadata'] + + +def test_activate_certificate_authority_flattened(): + client = CertificateAuthorityServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.activate_certificate_authority), + '__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.activate_certificate_authority( + name='name_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] + arg = args[0].name + mock_val = 'name_value' + assert arg == mock_val + + +def test_activate_certificate_authority_flattened_error(): + client = CertificateAuthorityServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + client.activate_certificate_authority( + service.ActivateCertificateAuthorityRequest(), + name='name_value', + ) + +@pytest.mark.asyncio +async def test_activate_certificate_authority_flattened_async(): + client = CertificateAuthorityServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.activate_certificate_authority), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = operations_pb2.Operation(name='operations/op') + + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + operations_pb2.Operation(name='operations/spam') + ) + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + response = await client.activate_certificate_authority( + name='name_value', + ) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + arg = args[0].name + mock_val = 'name_value' + assert arg == mock_val + +@pytest.mark.asyncio +async def test_activate_certificate_authority_flattened_error_async(): + client = CertificateAuthorityServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + await client.activate_certificate_authority( + service.ActivateCertificateAuthorityRequest(), + name='name_value', + ) + + +@pytest.mark.parametrize("request_type", [ + service.CreateCertificateAuthorityRequest, + dict, +]) +def test_create_certificate_authority(request_type, transport: str = 'grpc'): + client = CertificateAuthorityServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.create_certificate_authority), + '__call__') 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. + assert isinstance(response, future.Future) + + +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=ga_credentials.AnonymousCredentials(), + transport='grpc', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.create_certificate_authority), + '__call__') as call: + client.create_certificate_authority() + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == service.CreateCertificateAuthorityRequest() + +@pytest.mark.asyncio +async def test_create_certificate_authority_async(transport: str = 'grpc_asyncio', request_type=service.CreateCertificateAuthorityRequest): + client = CertificateAuthorityServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.create_certificate_authority), + '__call__') as call: + # Designate an appropriate return value for the call. + 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. + assert isinstance(response, future.Future) + + +@pytest.mark.asyncio +async def test_create_certificate_authority_async_from_dict(): + await test_create_certificate_authority_async(request_type=dict) + + +def test_create_certificate_authority_field_headers(): + client = CertificateAuthorityServiceClient( + 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. + with mock.patch.object( + 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. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ( + 'x-goog-request-params', + 'parent=parent_value', + ) in kw['metadata'] + + +@pytest.mark.asyncio +async def test_create_certificate_authority_field_headers_async(): + client = CertificateAuthorityServiceAsyncClient( + 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. + with mock.patch.object( + type(client.transport.create_certificate_authority), + '__call__') as call: + 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. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ( + 'x-goog-request-params', + 'parent=parent_value', + ) in kw['metadata'] + + +def test_create_certificate_authority_flattened(): + client = CertificateAuthorityServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.create_certificate_authority), + '__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_certificate_authority( + parent='parent_value', + certificate_authority=resources.CertificateAuthority(name='name_value'), + certificate_authority_id='certificate_authority_id_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] + arg = args[0].parent + mock_val = 'parent_value' + assert arg == mock_val + arg = args[0].certificate_authority + mock_val = resources.CertificateAuthority(name='name_value') + assert arg == mock_val + arg = args[0].certificate_authority_id + mock_val = 'certificate_authority_id_value' + assert arg == mock_val + + +def test_create_certificate_authority_flattened_error(): + client = CertificateAuthorityServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + client.create_certificate_authority( + service.CreateCertificateAuthorityRequest(), + parent='parent_value', + certificate_authority=resources.CertificateAuthority(name='name_value'), + certificate_authority_id='certificate_authority_id_value', + ) + +@pytest.mark.asyncio +async def test_create_certificate_authority_flattened_async(): + client = CertificateAuthorityServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.create_certificate_authority), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = operations_pb2.Operation(name='operations/op') + + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + operations_pb2.Operation(name='operations/spam') + ) + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + response = await client.create_certificate_authority( + parent='parent_value', + certificate_authority=resources.CertificateAuthority(name='name_value'), + certificate_authority_id='certificate_authority_id_value', + ) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + arg = args[0].parent + mock_val = 'parent_value' + assert arg == mock_val + arg = args[0].certificate_authority + mock_val = resources.CertificateAuthority(name='name_value') + assert arg == mock_val + arg = args[0].certificate_authority_id + mock_val = 'certificate_authority_id_value' + assert arg == mock_val + +@pytest.mark.asyncio +async def test_create_certificate_authority_flattened_error_async(): + client = CertificateAuthorityServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + await client.create_certificate_authority( + service.CreateCertificateAuthorityRequest(), + parent='parent_value', + certificate_authority=resources.CertificateAuthority(name='name_value'), + certificate_authority_id='certificate_authority_id_value', + ) + + +@pytest.mark.parametrize("request_type", [ + service.DisableCertificateAuthorityRequest, + dict, +]) +def test_disable_certificate_authority(request_type, transport: str = 'grpc'): + client = CertificateAuthorityServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.disable_certificate_authority), + '__call__') 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. + assert isinstance(response, future.Future) + + +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=ga_credentials.AnonymousCredentials(), + transport='grpc', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.disable_certificate_authority), + '__call__') as call: + client.disable_certificate_authority() + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == service.DisableCertificateAuthorityRequest() + +@pytest.mark.asyncio +async def test_disable_certificate_authority_async(transport: str = 'grpc_asyncio', request_type=service.DisableCertificateAuthorityRequest): + client = CertificateAuthorityServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.disable_certificate_authority), + '__call__') as call: + # Designate an appropriate return value for the call. + 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. + assert isinstance(response, future.Future) + + +@pytest.mark.asyncio +async def test_disable_certificate_authority_async_from_dict(): + await test_disable_certificate_authority_async(request_type=dict) + + +def test_disable_certificate_authority_field_headers(): + client = CertificateAuthorityServiceClient( + 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. + with mock.patch.object( + 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. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ( + 'x-goog-request-params', + 'name=name_value', + ) in kw['metadata'] + + +@pytest.mark.asyncio +async def test_disable_certificate_authority_field_headers_async(): + client = CertificateAuthorityServiceAsyncClient( + 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. + with mock.patch.object( + type(client.transport.disable_certificate_authority), + '__call__') as call: + 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. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ( + 'x-goog-request-params', + 'name=name_value', + ) in kw['metadata'] + + +def test_disable_certificate_authority_flattened(): + client = CertificateAuthorityServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.disable_certificate_authority), + '__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.disable_certificate_authority( + name='name_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] + arg = args[0].name + mock_val = 'name_value' + assert arg == mock_val + + +def test_disable_certificate_authority_flattened_error(): + client = CertificateAuthorityServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + client.disable_certificate_authority( + service.DisableCertificateAuthorityRequest(), + name='name_value', + ) + +@pytest.mark.asyncio +async def test_disable_certificate_authority_flattened_async(): + client = CertificateAuthorityServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.disable_certificate_authority), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = operations_pb2.Operation(name='operations/op') + + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + operations_pb2.Operation(name='operations/spam') + ) + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + response = await client.disable_certificate_authority( + name='name_value', + ) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + arg = args[0].name + mock_val = 'name_value' + assert arg == mock_val + +@pytest.mark.asyncio +async def test_disable_certificate_authority_flattened_error_async(): + client = CertificateAuthorityServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + await client.disable_certificate_authority( + service.DisableCertificateAuthorityRequest(), + name='name_value', + ) + + +@pytest.mark.parametrize("request_type", [ + service.EnableCertificateAuthorityRequest, + dict, +]) +def test_enable_certificate_authority(request_type, transport: str = 'grpc'): + client = CertificateAuthorityServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.enable_certificate_authority), + '__call__') 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. + assert isinstance(response, future.Future) + + +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=ga_credentials.AnonymousCredentials(), + transport='grpc', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.enable_certificate_authority), + '__call__') as call: + client.enable_certificate_authority() + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == service.EnableCertificateAuthorityRequest() + +@pytest.mark.asyncio +async def test_enable_certificate_authority_async(transport: str = 'grpc_asyncio', request_type=service.EnableCertificateAuthorityRequest): + client = CertificateAuthorityServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.enable_certificate_authority), + '__call__') as call: + # Designate an appropriate return value for the call. + 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. + assert isinstance(response, future.Future) + + +@pytest.mark.asyncio +async def test_enable_certificate_authority_async_from_dict(): + await test_enable_certificate_authority_async(request_type=dict) + + +def test_enable_certificate_authority_field_headers(): + client = CertificateAuthorityServiceClient( + 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. + with mock.patch.object( + 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. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ( + 'x-goog-request-params', + 'name=name_value', + ) in kw['metadata'] + + +@pytest.mark.asyncio +async def test_enable_certificate_authority_field_headers_async(): + client = CertificateAuthorityServiceAsyncClient( + 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. + with mock.patch.object( + type(client.transport.enable_certificate_authority), + '__call__') as call: + 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. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ( + 'x-goog-request-params', + 'name=name_value', + ) in kw['metadata'] + + +def test_enable_certificate_authority_flattened(): + client = CertificateAuthorityServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.enable_certificate_authority), + '__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.enable_certificate_authority( + name='name_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] + arg = args[0].name + mock_val = 'name_value' + assert arg == mock_val + + +def test_enable_certificate_authority_flattened_error(): + client = CertificateAuthorityServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + client.enable_certificate_authority( + service.EnableCertificateAuthorityRequest(), + name='name_value', + ) + +@pytest.mark.asyncio +async def test_enable_certificate_authority_flattened_async(): + client = CertificateAuthorityServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.enable_certificate_authority), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = operations_pb2.Operation(name='operations/op') + + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + operations_pb2.Operation(name='operations/spam') + ) + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + response = await client.enable_certificate_authority( + name='name_value', + ) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + arg = args[0].name + mock_val = 'name_value' + assert arg == mock_val + +@pytest.mark.asyncio +async def test_enable_certificate_authority_flattened_error_async(): + client = CertificateAuthorityServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + await client.enable_certificate_authority( + service.EnableCertificateAuthorityRequest(), + name='name_value', + ) + + +@pytest.mark.parametrize("request_type", [ + service.FetchCertificateAuthorityCsrRequest, + dict, +]) +def test_fetch_certificate_authority_csr(request_type, transport: str = 'grpc'): + client = CertificateAuthorityServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.fetch_certificate_authority_csr), + '__call__') as call: + # Designate an appropriate return value for the call. + 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' + + +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=ga_credentials.AnonymousCredentials(), + transport='grpc', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.fetch_certificate_authority_csr), + '__call__') as call: + client.fetch_certificate_authority_csr() + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == service.FetchCertificateAuthorityCsrRequest() + +@pytest.mark.asyncio +async def test_fetch_certificate_authority_csr_async(transport: str = 'grpc_asyncio', request_type=service.FetchCertificateAuthorityCsrRequest): + client = CertificateAuthorityServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.fetch_certificate_authority_csr), + '__call__') as call: + # Designate an appropriate return value for the call. + 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' + + +@pytest.mark.asyncio +async def test_fetch_certificate_authority_csr_async_from_dict(): + await test_fetch_certificate_authority_csr_async(request_type=dict) + + +def test_fetch_certificate_authority_csr_field_headers(): + client = CertificateAuthorityServiceClient( + 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. + with mock.patch.object( + 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. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ( + 'x-goog-request-params', + 'name=name_value', + ) in kw['metadata'] + + +@pytest.mark.asyncio +async def test_fetch_certificate_authority_csr_field_headers_async(): + client = CertificateAuthorityServiceAsyncClient( + 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. + with mock.patch.object( + type(client.transport.fetch_certificate_authority_csr), + '__call__') as call: + 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. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ( + 'x-goog-request-params', + 'name=name_value', + ) in kw['metadata'] + + +def test_fetch_certificate_authority_csr_flattened(): + client = CertificateAuthorityServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.fetch_certificate_authority_csr), + '__call__') 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', + ) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + arg = args[0].name + mock_val = 'name_value' + assert arg == mock_val + + +def test_fetch_certificate_authority_csr_flattened_error(): + client = CertificateAuthorityServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + client.fetch_certificate_authority_csr( + service.FetchCertificateAuthorityCsrRequest(), + name='name_value', + ) + +@pytest.mark.asyncio +async def test_fetch_certificate_authority_csr_flattened_async(): + client = CertificateAuthorityServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.fetch_certificate_authority_csr), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = service.FetchCertificateAuthorityCsrResponse() + + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(service.FetchCertificateAuthorityCsrResponse()) + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + response = await client.fetch_certificate_authority_csr( + name='name_value', + ) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + arg = args[0].name + mock_val = 'name_value' + assert arg == mock_val + +@pytest.mark.asyncio +async def test_fetch_certificate_authority_csr_flattened_error_async(): + client = CertificateAuthorityServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + await client.fetch_certificate_authority_csr( + service.FetchCertificateAuthorityCsrRequest(), + name='name_value', + ) + + +@pytest.mark.parametrize("request_type", [ + service.GetCertificateAuthorityRequest, + dict, +]) +def test_get_certificate_authority(request_type, transport: str = 'grpc'): + client = CertificateAuthorityServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.get_certificate_authority), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = resources.CertificateAuthority( + name='name_value', + type_=resources.CertificateAuthority.Type.SELF_SIGNED, + tier=resources.CertificateAuthority.Tier.ENTERPRISE, + state=resources.CertificateAuthority.State.ENABLED, + 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' + + +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=ga_credentials.AnonymousCredentials(), + transport='grpc', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.get_certificate_authority), + '__call__') as call: + client.get_certificate_authority() + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == service.GetCertificateAuthorityRequest() + +@pytest.mark.asyncio +async def test_get_certificate_authority_async(transport: str = 'grpc_asyncio', request_type=service.GetCertificateAuthorityRequest): + client = CertificateAuthorityServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.get_certificate_authority), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(resources.CertificateAuthority( + name='name_value', + type_=resources.CertificateAuthority.Type.SELF_SIGNED, + tier=resources.CertificateAuthority.Tier.ENTERPRISE, + state=resources.CertificateAuthority.State.ENABLED, + pem_ca_certificates=['pem_ca_certificates_value'], + 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' + + +@pytest.mark.asyncio +async def test_get_certificate_authority_async_from_dict(): + await test_get_certificate_authority_async(request_type=dict) + + +def test_get_certificate_authority_field_headers(): + client = CertificateAuthorityServiceClient( + 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. + with mock.patch.object( + 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. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ( + 'x-goog-request-params', + 'name=name_value', + ) in kw['metadata'] + + +@pytest.mark.asyncio +async def test_get_certificate_authority_field_headers_async(): + client = CertificateAuthorityServiceAsyncClient( + 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. + with mock.patch.object( + type(client.transport.get_certificate_authority), + '__call__') as call: + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(resources.CertificateAuthority()) + 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] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ( + 'x-goog-request-params', + 'name=name_value', + ) in kw['metadata'] + + +def test_get_certificate_authority_flattened(): + client = CertificateAuthorityServiceClient( + 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_authority), + '__call__') 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', + ) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + arg = args[0].name + mock_val = 'name_value' + assert arg == mock_val + + +def test_get_certificate_authority_flattened_error(): + client = CertificateAuthorityServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + client.get_certificate_authority( + service.GetCertificateAuthorityRequest(), + name='name_value', + ) + +@pytest.mark.asyncio +async def test_get_certificate_authority_flattened_async(): + client = CertificateAuthorityServiceAsyncClient( + 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_authority), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = resources.CertificateAuthority() + + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(resources.CertificateAuthority()) + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + response = await client.get_certificate_authority( + name='name_value', + ) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + arg = args[0].name + mock_val = 'name_value' + assert arg == mock_val + +@pytest.mark.asyncio +async def test_get_certificate_authority_flattened_error_async(): + client = CertificateAuthorityServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + await client.get_certificate_authority( + service.GetCertificateAuthorityRequest(), + name='name_value', + ) + + +@pytest.mark.parametrize("request_type", [ + service.ListCertificateAuthoritiesRequest, + dict, +]) +def test_list_certificate_authorities(request_type, transport: str = 'grpc'): + client = CertificateAuthorityServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_certificate_authorities), + '__call__') as call: + # Designate an appropriate return value for the call. + 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'] + + +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=ga_credentials.AnonymousCredentials(), + transport='grpc', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_certificate_authorities), + '__call__') as call: + client.list_certificate_authorities() + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == service.ListCertificateAuthoritiesRequest() + +@pytest.mark.asyncio +async def test_list_certificate_authorities_async(transport: str = 'grpc_asyncio', request_type=service.ListCertificateAuthoritiesRequest): + client = CertificateAuthorityServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_certificate_authorities), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(service.ListCertificateAuthoritiesResponse( + next_page_token='next_page_token_value', + 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'] + + +@pytest.mark.asyncio +async def test_list_certificate_authorities_async_from_dict(): + await test_list_certificate_authorities_async(request_type=dict) + + +def test_list_certificate_authorities_field_headers(): + client = CertificateAuthorityServiceClient( + 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. + with mock.patch.object( + 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. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ( + 'x-goog-request-params', + 'parent=parent_value', + ) in kw['metadata'] + + +@pytest.mark.asyncio +async def test_list_certificate_authorities_field_headers_async(): + client = CertificateAuthorityServiceAsyncClient( + 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. + with mock.patch.object( + type(client.transport.list_certificate_authorities), + '__call__') as call: + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(service.ListCertificateAuthoritiesResponse()) + 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] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ( + 'x-goog-request-params', + 'parent=parent_value', + ) in kw['metadata'] + + +def test_list_certificate_authorities_flattened(): + client = CertificateAuthorityServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_certificate_authorities), + '__call__') 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', + ) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + arg = args[0].parent + mock_val = 'parent_value' + assert arg == mock_val + + +def test_list_certificate_authorities_flattened_error(): + client = CertificateAuthorityServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + client.list_certificate_authorities( + service.ListCertificateAuthoritiesRequest(), + parent='parent_value', + ) + +@pytest.mark.asyncio +async def test_list_certificate_authorities_flattened_async(): + client = CertificateAuthorityServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_certificate_authorities), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = service.ListCertificateAuthoritiesResponse() + + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(service.ListCertificateAuthoritiesResponse()) + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + response = await client.list_certificate_authorities( + parent='parent_value', + ) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + arg = args[0].parent + mock_val = 'parent_value' + assert arg == mock_val + +@pytest.mark.asyncio +async def test_list_certificate_authorities_flattened_error_async(): + client = CertificateAuthorityServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + await client.list_certificate_authorities( + service.ListCertificateAuthoritiesRequest(), + parent='parent_value', + ) + + +def test_list_certificate_authorities_pager(transport_name: str = "grpc"): + client = CertificateAuthorityServiceClient( + credentials=ga_credentials.AnonymousCredentials, + transport=transport_name, + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_certificate_authorities), + '__call__') as call: + # Set the response to a series of pages. + call.side_effect = ( + service.ListCertificateAuthoritiesResponse( + certificate_authorities=[ + resources.CertificateAuthority(), + resources.CertificateAuthority(), + resources.CertificateAuthority(), + ], + next_page_token='abc', + ), + service.ListCertificateAuthoritiesResponse( + certificate_authorities=[], + next_page_token='def', + ), + service.ListCertificateAuthoritiesResponse( + certificate_authorities=[ + resources.CertificateAuthority(), + ], + next_page_token='ghi', + ), + service.ListCertificateAuthoritiesResponse( + certificate_authorities=[ + resources.CertificateAuthority(), + resources.CertificateAuthority(), + ], + ), + RuntimeError, + ) + + metadata = () + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata(( + ('parent', ''), + )), + ) + pager = client.list_certificate_authorities(request={}) + + assert pager._metadata == metadata + + results = list(pager) + assert len(results) == 6 + assert all(isinstance(i, resources.CertificateAuthority) + for i in results) +def test_list_certificate_authorities_pages(transport_name: str = "grpc"): + client = CertificateAuthorityServiceClient( + credentials=ga_credentials.AnonymousCredentials, + transport=transport_name, + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_certificate_authorities), + '__call__') as call: + # Set the response to a series of pages. + call.side_effect = ( + service.ListCertificateAuthoritiesResponse( + certificate_authorities=[ + resources.CertificateAuthority(), + resources.CertificateAuthority(), + resources.CertificateAuthority(), + ], + next_page_token='abc', + ), + service.ListCertificateAuthoritiesResponse( + certificate_authorities=[], + next_page_token='def', + ), + service.ListCertificateAuthoritiesResponse( + certificate_authorities=[ + resources.CertificateAuthority(), + ], + next_page_token='ghi', + ), + service.ListCertificateAuthoritiesResponse( + certificate_authorities=[ + resources.CertificateAuthority(), + resources.CertificateAuthority(), + ], + ), + RuntimeError, + ) + pages = list(client.list_certificate_authorities(request={}).pages) + for page_, token in zip(pages, ['abc','def','ghi', '']): + assert page_.raw_page.next_page_token == token + +@pytest.mark.asyncio +async def test_list_certificate_authorities_async_pager(): + client = CertificateAuthorityServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials, + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_certificate_authorities), + '__call__', new_callable=mock.AsyncMock) as call: + # Set the response to a series of pages. + call.side_effect = ( + service.ListCertificateAuthoritiesResponse( + certificate_authorities=[ + resources.CertificateAuthority(), + resources.CertificateAuthority(), + resources.CertificateAuthority(), + ], + next_page_token='abc', + ), + service.ListCertificateAuthoritiesResponse( + certificate_authorities=[], + next_page_token='def', + ), + service.ListCertificateAuthoritiesResponse( + certificate_authorities=[ + resources.CertificateAuthority(), + ], + next_page_token='ghi', + ), + service.ListCertificateAuthoritiesResponse( + certificate_authorities=[ + resources.CertificateAuthority(), + resources.CertificateAuthority(), + ], + ), + RuntimeError, + ) + async_pager = await client.list_certificate_authorities(request={},) + assert async_pager.next_page_token == 'abc' + responses = [] + async for response in async_pager: # pragma: no branch + responses.append(response) + + assert len(responses) == 6 + assert all(isinstance(i, resources.CertificateAuthority) + for i in responses) + + +@pytest.mark.asyncio +async def test_list_certificate_authorities_async_pages(): + client = CertificateAuthorityServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials, + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_certificate_authorities), + '__call__', new_callable=mock.AsyncMock) as call: + # Set the response to a series of pages. + call.side_effect = ( + service.ListCertificateAuthoritiesResponse( + certificate_authorities=[ + resources.CertificateAuthority(), + resources.CertificateAuthority(), + resources.CertificateAuthority(), + ], + next_page_token='abc', + ), + service.ListCertificateAuthoritiesResponse( + certificate_authorities=[], + next_page_token='def', + ), + service.ListCertificateAuthoritiesResponse( + certificate_authorities=[ + resources.CertificateAuthority(), + ], + next_page_token='ghi', + ), + service.ListCertificateAuthoritiesResponse( + certificate_authorities=[ + resources.CertificateAuthority(), + resources.CertificateAuthority(), + ], + ), + RuntimeError, + ) + pages = [] + async for page_ in (await client.list_certificate_authorities(request={})).pages: # pragma: no branch + pages.append(page_) + for page_, token in zip(pages, ['abc','def','ghi', '']): + assert page_.raw_page.next_page_token == token + +@pytest.mark.parametrize("request_type", [ + service.RestoreCertificateAuthorityRequest, + dict, +]) +def test_restore_certificate_authority(request_type, transport: str = 'grpc'): + client = CertificateAuthorityServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.restore_certificate_authority), + '__call__') 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. + assert isinstance(response, future.Future) + + +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=ga_credentials.AnonymousCredentials(), + transport='grpc', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.restore_certificate_authority), + '__call__') as call: + client.restore_certificate_authority() + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == service.RestoreCertificateAuthorityRequest() + +@pytest.mark.asyncio +async def test_restore_certificate_authority_async(transport: str = 'grpc_asyncio', request_type=service.RestoreCertificateAuthorityRequest): + client = CertificateAuthorityServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.restore_certificate_authority), + '__call__') as call: + # Designate an appropriate return value for the call. + 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. + assert isinstance(response, future.Future) + + +@pytest.mark.asyncio +async def test_restore_certificate_authority_async_from_dict(): + await test_restore_certificate_authority_async(request_type=dict) + + +def test_restore_certificate_authority_field_headers(): + client = CertificateAuthorityServiceClient( + 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. + with mock.patch.object( + 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. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ( + 'x-goog-request-params', + 'name=name_value', + ) in kw['metadata'] + + +@pytest.mark.asyncio +async def test_restore_certificate_authority_field_headers_async(): + client = CertificateAuthorityServiceAsyncClient( + 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. + with mock.patch.object( + type(client.transport.restore_certificate_authority), + '__call__') as call: + 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. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ( + 'x-goog-request-params', + 'name=name_value', + ) in kw['metadata'] + + +def test_restore_certificate_authority_flattened(): + client = CertificateAuthorityServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.restore_certificate_authority), + '__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.restore_certificate_authority( + name='name_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] + arg = args[0].name + mock_val = 'name_value' + assert arg == mock_val + + +def test_restore_certificate_authority_flattened_error(): + client = CertificateAuthorityServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + client.restore_certificate_authority( + service.RestoreCertificateAuthorityRequest(), + name='name_value', + ) + +@pytest.mark.asyncio +async def test_restore_certificate_authority_flattened_async(): + client = CertificateAuthorityServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.restore_certificate_authority), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = operations_pb2.Operation(name='operations/op') + + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + operations_pb2.Operation(name='operations/spam') + ) + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + response = await client.restore_certificate_authority( + name='name_value', + ) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + arg = args[0].name + mock_val = 'name_value' + assert arg == mock_val + +@pytest.mark.asyncio +async def test_restore_certificate_authority_flattened_error_async(): + client = CertificateAuthorityServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + await client.restore_certificate_authority( + service.RestoreCertificateAuthorityRequest(), + name='name_value', + ) + + +@pytest.mark.parametrize("request_type", [ + service.ScheduleDeleteCertificateAuthorityRequest, + dict, +]) +def test_schedule_delete_certificate_authority(request_type, transport: str = 'grpc'): + client = CertificateAuthorityServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.schedule_delete_certificate_authority), + '__call__') 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. + assert isinstance(response, future.Future) + + +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=ga_credentials.AnonymousCredentials(), + transport='grpc', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.schedule_delete_certificate_authority), + '__call__') as call: + client.schedule_delete_certificate_authority() + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == service.ScheduleDeleteCertificateAuthorityRequest() + +@pytest.mark.asyncio +async def test_schedule_delete_certificate_authority_async(transport: str = 'grpc_asyncio', request_type=service.ScheduleDeleteCertificateAuthorityRequest): + client = CertificateAuthorityServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.schedule_delete_certificate_authority), + '__call__') as call: + # Designate an appropriate return value for the call. + 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. + assert isinstance(response, future.Future) + + +@pytest.mark.asyncio +async def test_schedule_delete_certificate_authority_async_from_dict(): + await test_schedule_delete_certificate_authority_async(request_type=dict) + + +def test_schedule_delete_certificate_authority_field_headers(): + client = CertificateAuthorityServiceClient( + 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. + with mock.patch.object( + 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. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ( + 'x-goog-request-params', + 'name=name_value', + ) in kw['metadata'] + + +@pytest.mark.asyncio +async def test_schedule_delete_certificate_authority_field_headers_async(): + client = CertificateAuthorityServiceAsyncClient( + 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. + with mock.patch.object( + type(client.transport.schedule_delete_certificate_authority), + '__call__') as call: + 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. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ( + 'x-goog-request-params', + 'name=name_value', + ) in kw['metadata'] + + +def test_schedule_delete_certificate_authority_flattened(): + client = CertificateAuthorityServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.schedule_delete_certificate_authority), + '__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.schedule_delete_certificate_authority( + name='name_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] + arg = args[0].name + mock_val = 'name_value' + assert arg == mock_val + + +def test_schedule_delete_certificate_authority_flattened_error(): + client = CertificateAuthorityServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + client.schedule_delete_certificate_authority( + service.ScheduleDeleteCertificateAuthorityRequest(), + name='name_value', + ) + +@pytest.mark.asyncio +async def test_schedule_delete_certificate_authority_flattened_async(): + client = CertificateAuthorityServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.schedule_delete_certificate_authority), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = operations_pb2.Operation(name='operations/op') + + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + operations_pb2.Operation(name='operations/spam') + ) + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + response = await client.schedule_delete_certificate_authority( + name='name_value', + ) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + arg = args[0].name + mock_val = 'name_value' + assert arg == mock_val + +@pytest.mark.asyncio +async def test_schedule_delete_certificate_authority_flattened_error_async(): + client = CertificateAuthorityServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + await client.schedule_delete_certificate_authority( + service.ScheduleDeleteCertificateAuthorityRequest(), + name='name_value', + ) + + +@pytest.mark.parametrize("request_type", [ + service.UpdateCertificateAuthorityRequest, + dict, +]) +def test_update_certificate_authority(request_type, transport: str = 'grpc'): + client = CertificateAuthorityServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.update_certificate_authority), + '__call__') 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. + assert isinstance(response, future.Future) + + +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=ga_credentials.AnonymousCredentials(), + transport='grpc', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.update_certificate_authority), + '__call__') as call: + client.update_certificate_authority() + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == service.UpdateCertificateAuthorityRequest() + +@pytest.mark.asyncio +async def test_update_certificate_authority_async(transport: str = 'grpc_asyncio', request_type=service.UpdateCertificateAuthorityRequest): + client = CertificateAuthorityServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.update_certificate_authority), + '__call__') as call: + # Designate an appropriate return value for the call. + 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. + assert isinstance(response, future.Future) + + +@pytest.mark.asyncio +async def test_update_certificate_authority_async_from_dict(): + await test_update_certificate_authority_async(request_type=dict) + + +def test_update_certificate_authority_field_headers(): + client = CertificateAuthorityServiceClient( + 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 = 'name_value' + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + 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. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ( + 'x-goog-request-params', + 'certificate_authority.name=name_value', + ) in kw['metadata'] + + +@pytest.mark.asyncio +async def test_update_certificate_authority_field_headers_async(): + client = CertificateAuthorityServiceAsyncClient( + 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 = 'name_value' + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.update_certificate_authority), + '__call__') as call: + 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. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ( + 'x-goog-request-params', + 'certificate_authority.name=name_value', + ) in kw['metadata'] + + +def test_update_certificate_authority_flattened(): + client = CertificateAuthorityServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.update_certificate_authority), + '__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_certificate_authority( + certificate_authority=resources.CertificateAuthority(name='name_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] + arg = args[0].certificate_authority + mock_val = resources.CertificateAuthority(name='name_value') + assert arg == mock_val + arg = args[0].update_mask + mock_val = field_mask_pb2.FieldMask(paths=['paths_value']) + assert arg == mock_val + + +def test_update_certificate_authority_flattened_error(): + client = CertificateAuthorityServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + client.update_certificate_authority( + service.UpdateCertificateAuthorityRequest(), + certificate_authority=resources.CertificateAuthority(name='name_value'), + update_mask=field_mask_pb2.FieldMask(paths=['paths_value']), + ) + +@pytest.mark.asyncio +async def test_update_certificate_authority_flattened_async(): + client = CertificateAuthorityServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.update_certificate_authority), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = operations_pb2.Operation(name='operations/op') + + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + operations_pb2.Operation(name='operations/spam') + ) + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + response = await client.update_certificate_authority( + certificate_authority=resources.CertificateAuthority(name='name_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] + arg = args[0].certificate_authority + mock_val = resources.CertificateAuthority(name='name_value') + assert arg == mock_val + arg = args[0].update_mask + mock_val = field_mask_pb2.FieldMask(paths=['paths_value']) + assert arg == mock_val + +@pytest.mark.asyncio +async def test_update_certificate_authority_flattened_error_async(): + client = CertificateAuthorityServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + await client.update_certificate_authority( + service.UpdateCertificateAuthorityRequest(), + certificate_authority=resources.CertificateAuthority(name='name_value'), + update_mask=field_mask_pb2.FieldMask(paths=['paths_value']), + ) + + +@pytest.mark.parametrize("request_type", [ + service.GetCertificateRevocationListRequest, + dict, +]) +def test_get_certificate_revocation_list(request_type, transport: str = 'grpc'): + client = CertificateAuthorityServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.get_certificate_revocation_list), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = resources.CertificateRevocationList( + name='name_value', + sequence_number=1601, + pem_crl='pem_crl_value', + 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 + + +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=ga_credentials.AnonymousCredentials(), + transport='grpc', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.get_certificate_revocation_list), + '__call__') as call: + client.get_certificate_revocation_list() + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == service.GetCertificateRevocationListRequest() + +@pytest.mark.asyncio +async def test_get_certificate_revocation_list_async(transport: str = 'grpc_asyncio', request_type=service.GetCertificateRevocationListRequest): + client = CertificateAuthorityServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.get_certificate_revocation_list), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(resources.CertificateRevocationList( + name='name_value', + sequence_number=1601, + pem_crl='pem_crl_value', + access_url='access_url_value', + 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 + + +@pytest.mark.asyncio +async def test_get_certificate_revocation_list_async_from_dict(): + await test_get_certificate_revocation_list_async(request_type=dict) + + +def test_get_certificate_revocation_list_field_headers(): + client = CertificateAuthorityServiceClient( + 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. + with mock.patch.object( + 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. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ( + 'x-goog-request-params', + 'name=name_value', + ) in kw['metadata'] + + +@pytest.mark.asyncio +async def test_get_certificate_revocation_list_field_headers_async(): + client = CertificateAuthorityServiceAsyncClient( + 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. + with mock.patch.object( + type(client.transport.get_certificate_revocation_list), + '__call__') as call: + 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. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ( + 'x-goog-request-params', + 'name=name_value', + ) in kw['metadata'] + + +def test_get_certificate_revocation_list_flattened(): + client = CertificateAuthorityServiceClient( + 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_revocation_list), + '__call__') 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', + ) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + arg = args[0].name + mock_val = 'name_value' + assert arg == mock_val + + +def test_get_certificate_revocation_list_flattened_error(): + client = CertificateAuthorityServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + client.get_certificate_revocation_list( + service.GetCertificateRevocationListRequest(), + name='name_value', + ) + +@pytest.mark.asyncio +async def test_get_certificate_revocation_list_flattened_async(): + client = CertificateAuthorityServiceAsyncClient( + 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_revocation_list), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = resources.CertificateRevocationList() + + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(resources.CertificateRevocationList()) + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + response = await client.get_certificate_revocation_list( + name='name_value', + ) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + arg = args[0].name + mock_val = 'name_value' + assert arg == mock_val + +@pytest.mark.asyncio +async def test_get_certificate_revocation_list_flattened_error_async(): + client = CertificateAuthorityServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + await client.get_certificate_revocation_list( + service.GetCertificateRevocationListRequest(), + name='name_value', + ) + + +@pytest.mark.parametrize("request_type", [ + service.ListCertificateRevocationListsRequest, + dict, +]) +def test_list_certificate_revocation_lists(request_type, transport: str = 'grpc'): + client = CertificateAuthorityServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_certificate_revocation_lists), + '__call__') as call: + # Designate an appropriate return value for the call. + 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'] + + +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=ga_credentials.AnonymousCredentials(), + transport='grpc', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_certificate_revocation_lists), + '__call__') as call: + client.list_certificate_revocation_lists() + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == service.ListCertificateRevocationListsRequest() + +@pytest.mark.asyncio +async def test_list_certificate_revocation_lists_async(transport: str = 'grpc_asyncio', request_type=service.ListCertificateRevocationListsRequest): + client = CertificateAuthorityServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_certificate_revocation_lists), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(service.ListCertificateRevocationListsResponse( + next_page_token='next_page_token_value', + 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'] + + +@pytest.mark.asyncio +async def test_list_certificate_revocation_lists_async_from_dict(): + await test_list_certificate_revocation_lists_async(request_type=dict) + + +def test_list_certificate_revocation_lists_field_headers(): + client = CertificateAuthorityServiceClient( + 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. + with mock.patch.object( + 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. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ( + 'x-goog-request-params', + 'parent=parent_value', + ) in kw['metadata'] + + +@pytest.mark.asyncio +async def test_list_certificate_revocation_lists_field_headers_async(): + client = CertificateAuthorityServiceAsyncClient( + 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. + with mock.patch.object( + type(client.transport.list_certificate_revocation_lists), + '__call__') as call: + 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. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ( + 'x-goog-request-params', + 'parent=parent_value', + ) in kw['metadata'] + + +def test_list_certificate_revocation_lists_flattened(): + client = CertificateAuthorityServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_certificate_revocation_lists), + '__call__') 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', + ) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + arg = args[0].parent + mock_val = 'parent_value' + assert arg == mock_val + + +def test_list_certificate_revocation_lists_flattened_error(): + client = CertificateAuthorityServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + client.list_certificate_revocation_lists( + service.ListCertificateRevocationListsRequest(), + parent='parent_value', + ) + +@pytest.mark.asyncio +async def test_list_certificate_revocation_lists_flattened_async(): + client = CertificateAuthorityServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_certificate_revocation_lists), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = service.ListCertificateRevocationListsResponse() + + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(service.ListCertificateRevocationListsResponse()) + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + response = await client.list_certificate_revocation_lists( + parent='parent_value', + ) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + arg = args[0].parent + mock_val = 'parent_value' + assert arg == mock_val + +@pytest.mark.asyncio +async def test_list_certificate_revocation_lists_flattened_error_async(): + client = CertificateAuthorityServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + await client.list_certificate_revocation_lists( + service.ListCertificateRevocationListsRequest(), + parent='parent_value', + ) + + +def test_list_certificate_revocation_lists_pager(transport_name: str = "grpc"): + client = CertificateAuthorityServiceClient( + credentials=ga_credentials.AnonymousCredentials, + transport=transport_name, + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_certificate_revocation_lists), + '__call__') as call: + # Set the response to a series of pages. + call.side_effect = ( + service.ListCertificateRevocationListsResponse( + certificate_revocation_lists=[ + resources.CertificateRevocationList(), + resources.CertificateRevocationList(), + resources.CertificateRevocationList(), + ], + next_page_token='abc', + ), + service.ListCertificateRevocationListsResponse( + certificate_revocation_lists=[], + next_page_token='def', + ), + service.ListCertificateRevocationListsResponse( + certificate_revocation_lists=[ + resources.CertificateRevocationList(), + ], + next_page_token='ghi', + ), + service.ListCertificateRevocationListsResponse( + certificate_revocation_lists=[ + resources.CertificateRevocationList(), + resources.CertificateRevocationList(), + ], + ), + RuntimeError, + ) + + metadata = () + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata(( + ('parent', ''), + )), + ) + pager = client.list_certificate_revocation_lists(request={}) + + assert pager._metadata == metadata + + results = list(pager) + assert len(results) == 6 + assert all(isinstance(i, resources.CertificateRevocationList) + for i in results) +def test_list_certificate_revocation_lists_pages(transport_name: str = "grpc"): + client = CertificateAuthorityServiceClient( + credentials=ga_credentials.AnonymousCredentials, + transport=transport_name, + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_certificate_revocation_lists), + '__call__') as call: + # Set the response to a series of pages. + call.side_effect = ( + service.ListCertificateRevocationListsResponse( + certificate_revocation_lists=[ + resources.CertificateRevocationList(), + resources.CertificateRevocationList(), + resources.CertificateRevocationList(), + ], + next_page_token='abc', + ), + service.ListCertificateRevocationListsResponse( + certificate_revocation_lists=[], + next_page_token='def', + ), + service.ListCertificateRevocationListsResponse( + certificate_revocation_lists=[ + resources.CertificateRevocationList(), + ], + next_page_token='ghi', + ), + service.ListCertificateRevocationListsResponse( + certificate_revocation_lists=[ + resources.CertificateRevocationList(), + resources.CertificateRevocationList(), + ], + ), + RuntimeError, + ) + pages = list(client.list_certificate_revocation_lists(request={}).pages) + for page_, token in zip(pages, ['abc','def','ghi', '']): + assert page_.raw_page.next_page_token == token + +@pytest.mark.asyncio +async def test_list_certificate_revocation_lists_async_pager(): + client = CertificateAuthorityServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials, + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_certificate_revocation_lists), + '__call__', new_callable=mock.AsyncMock) as call: + # Set the response to a series of pages. + call.side_effect = ( + service.ListCertificateRevocationListsResponse( + certificate_revocation_lists=[ + resources.CertificateRevocationList(), + resources.CertificateRevocationList(), + resources.CertificateRevocationList(), + ], + next_page_token='abc', + ), + service.ListCertificateRevocationListsResponse( + certificate_revocation_lists=[], + next_page_token='def', + ), + service.ListCertificateRevocationListsResponse( + certificate_revocation_lists=[ + resources.CertificateRevocationList(), + ], + next_page_token='ghi', + ), + service.ListCertificateRevocationListsResponse( + certificate_revocation_lists=[ + resources.CertificateRevocationList(), + resources.CertificateRevocationList(), + ], + ), + RuntimeError, + ) + async_pager = await client.list_certificate_revocation_lists(request={},) + assert async_pager.next_page_token == 'abc' + responses = [] + async for response in async_pager: # pragma: no branch + responses.append(response) + + assert len(responses) == 6 + assert all(isinstance(i, resources.CertificateRevocationList) + for i in responses) + + +@pytest.mark.asyncio +async def test_list_certificate_revocation_lists_async_pages(): + client = CertificateAuthorityServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials, + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_certificate_revocation_lists), + '__call__', new_callable=mock.AsyncMock) as call: + # Set the response to a series of pages. + call.side_effect = ( + service.ListCertificateRevocationListsResponse( + certificate_revocation_lists=[ + resources.CertificateRevocationList(), + resources.CertificateRevocationList(), + resources.CertificateRevocationList(), + ], + next_page_token='abc', + ), + service.ListCertificateRevocationListsResponse( + certificate_revocation_lists=[], + next_page_token='def', + ), + service.ListCertificateRevocationListsResponse( + certificate_revocation_lists=[ + resources.CertificateRevocationList(), + ], + next_page_token='ghi', + ), + service.ListCertificateRevocationListsResponse( + certificate_revocation_lists=[ + resources.CertificateRevocationList(), + resources.CertificateRevocationList(), + ], + ), + RuntimeError, + ) + pages = [] + async for page_ in (await client.list_certificate_revocation_lists(request={})).pages: # pragma: no branch + pages.append(page_) + for page_, token in zip(pages, ['abc','def','ghi', '']): + assert page_.raw_page.next_page_token == token + +@pytest.mark.parametrize("request_type", [ + service.UpdateCertificateRevocationListRequest, + dict, +]) +def test_update_certificate_revocation_list(request_type, transport: str = 'grpc'): + client = CertificateAuthorityServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.update_certificate_revocation_list), + '__call__') 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. + assert isinstance(response, future.Future) + + +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=ga_credentials.AnonymousCredentials(), + transport='grpc', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.update_certificate_revocation_list), + '__call__') as call: + client.update_certificate_revocation_list() + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == service.UpdateCertificateRevocationListRequest() + +@pytest.mark.asyncio +async def test_update_certificate_revocation_list_async(transport: str = 'grpc_asyncio', request_type=service.UpdateCertificateRevocationListRequest): + client = CertificateAuthorityServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.update_certificate_revocation_list), + '__call__') as call: + # Designate an appropriate return value for the call. + 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. + assert isinstance(response, future.Future) + + +@pytest.mark.asyncio +async def test_update_certificate_revocation_list_async_from_dict(): + await test_update_certificate_revocation_list_async(request_type=dict) + + +def test_update_certificate_revocation_list_field_headers(): + client = CertificateAuthorityServiceClient( + 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 = 'name_value' + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + 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. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ( + 'x-goog-request-params', + 'certificate_revocation_list.name=name_value', + ) in kw['metadata'] + + +@pytest.mark.asyncio +async def test_update_certificate_revocation_list_field_headers_async(): + client = CertificateAuthorityServiceAsyncClient( + 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 = 'name_value' + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.update_certificate_revocation_list), + '__call__') as call: + 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. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ( + 'x-goog-request-params', + 'certificate_revocation_list.name=name_value', + ) in kw['metadata'] + + +def test_update_certificate_revocation_list_flattened(): + client = CertificateAuthorityServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.update_certificate_revocation_list), + '__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_certificate_revocation_list( + certificate_revocation_list=resources.CertificateRevocationList(name='name_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] + arg = args[0].certificate_revocation_list + mock_val = resources.CertificateRevocationList(name='name_value') + assert arg == mock_val + arg = args[0].update_mask + mock_val = field_mask_pb2.FieldMask(paths=['paths_value']) + assert arg == mock_val + + +def test_update_certificate_revocation_list_flattened_error(): + client = CertificateAuthorityServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + client.update_certificate_revocation_list( + service.UpdateCertificateRevocationListRequest(), + certificate_revocation_list=resources.CertificateRevocationList(name='name_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=ga_credentials.AnonymousCredentials(), + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.update_certificate_revocation_list), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = operations_pb2.Operation(name='operations/op') + + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + operations_pb2.Operation(name='operations/spam') + ) + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + response = await client.update_certificate_revocation_list( + certificate_revocation_list=resources.CertificateRevocationList(name='name_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] + arg = args[0].certificate_revocation_list + mock_val = resources.CertificateRevocationList(name='name_value') + assert arg == mock_val + arg = args[0].update_mask + mock_val = field_mask_pb2.FieldMask(paths=['paths_value']) + assert arg == mock_val + +@pytest.mark.asyncio +async def test_update_certificate_revocation_list_flattened_error_async(): + client = CertificateAuthorityServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + await client.update_certificate_revocation_list( + service.UpdateCertificateRevocationListRequest(), + certificate_revocation_list=resources.CertificateRevocationList(name='name_value'), + update_mask=field_mask_pb2.FieldMask(paths=['paths_value']), + ) + + +@pytest.mark.parametrize("request_type", [ + service.GetReusableConfigRequest, + dict, +]) +def test_get_reusable_config(request_type, transport: str = 'grpc'): + client = CertificateAuthorityServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.get_reusable_config), + '__call__') as call: + # Designate an appropriate return value for the call. + 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' + + +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=ga_credentials.AnonymousCredentials(), + transport='grpc', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.get_reusable_config), + '__call__') as call: + client.get_reusable_config() + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == service.GetReusableConfigRequest() + +@pytest.mark.asyncio +async def test_get_reusable_config_async(transport: str = 'grpc_asyncio', request_type=service.GetReusableConfigRequest): + client = CertificateAuthorityServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.get_reusable_config), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(resources.ReusableConfig( + 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' + + +@pytest.mark.asyncio +async def test_get_reusable_config_async_from_dict(): + await test_get_reusable_config_async(request_type=dict) + + +def test_get_reusable_config_field_headers(): + client = CertificateAuthorityServiceClient( + 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. + with mock.patch.object( + 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. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ( + 'x-goog-request-params', + 'name=name_value', + ) in kw['metadata'] + + +@pytest.mark.asyncio +async def test_get_reusable_config_field_headers_async(): + client = CertificateAuthorityServiceAsyncClient( + 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. + with mock.patch.object( + type(client.transport.get_reusable_config), + '__call__') as call: + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(resources.ReusableConfig()) + 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] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ( + 'x-goog-request-params', + 'name=name_value', + ) in kw['metadata'] + + +def test_get_reusable_config_flattened(): + client = CertificateAuthorityServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.get_reusable_config), + '__call__') 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', + ) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + arg = args[0].name + mock_val = 'name_value' + assert arg == mock_val + + +def test_get_reusable_config_flattened_error(): + client = CertificateAuthorityServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + client.get_reusable_config( + service.GetReusableConfigRequest(), + name='name_value', + ) + +@pytest.mark.asyncio +async def test_get_reusable_config_flattened_async(): + client = CertificateAuthorityServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.get_reusable_config), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = resources.ReusableConfig() + + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(resources.ReusableConfig()) + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + response = await client.get_reusable_config( + name='name_value', + ) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + arg = args[0].name + mock_val = 'name_value' + assert arg == mock_val + +@pytest.mark.asyncio +async def test_get_reusable_config_flattened_error_async(): + client = CertificateAuthorityServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + await client.get_reusable_config( + service.GetReusableConfigRequest(), + name='name_value', + ) + + +@pytest.mark.parametrize("request_type", [ + service.ListReusableConfigsRequest, + dict, +]) +def test_list_reusable_configs(request_type, transport: str = 'grpc'): + client = CertificateAuthorityServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_reusable_configs), + '__call__') as call: + # Designate an appropriate return value for the call. + 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'] + + +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=ga_credentials.AnonymousCredentials(), + transport='grpc', + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_reusable_configs), + '__call__') as call: + client.list_reusable_configs() + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == service.ListReusableConfigsRequest() + +@pytest.mark.asyncio +async def test_list_reusable_configs_async(transport: str = 'grpc_asyncio', request_type=service.ListReusableConfigsRequest): + client = CertificateAuthorityServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_reusable_configs), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(service.ListReusableConfigsResponse( + next_page_token='next_page_token_value', + 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'] + + +@pytest.mark.asyncio +async def test_list_reusable_configs_async_from_dict(): + await test_list_reusable_configs_async(request_type=dict) + + +def test_list_reusable_configs_field_headers(): + client = CertificateAuthorityServiceClient( + 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. + with mock.patch.object( + 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. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ( + 'x-goog-request-params', + 'parent=parent_value', + ) in kw['metadata'] + + +@pytest.mark.asyncio +async def test_list_reusable_configs_field_headers_async(): + client = CertificateAuthorityServiceAsyncClient( + 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. + with mock.patch.object( + type(client.transport.list_reusable_configs), + '__call__') as call: + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(service.ListReusableConfigsResponse()) + 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] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ( + 'x-goog-request-params', + 'parent=parent_value', + ) in kw['metadata'] + + +def test_list_reusable_configs_flattened(): + client = CertificateAuthorityServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_reusable_configs), + '__call__') 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', + ) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + arg = args[0].parent + mock_val = 'parent_value' + assert arg == mock_val + + +def test_list_reusable_configs_flattened_error(): + client = CertificateAuthorityServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + client.list_reusable_configs( + service.ListReusableConfigsRequest(), + parent='parent_value', + ) + +@pytest.mark.asyncio +async def test_list_reusable_configs_flattened_async(): + client = CertificateAuthorityServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_reusable_configs), + '__call__') as call: + # Designate an appropriate return value for the call. + call.return_value = service.ListReusableConfigsResponse() + + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(service.ListReusableConfigsResponse()) + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + response = await client.list_reusable_configs( + parent='parent_value', + ) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + arg = args[0].parent + mock_val = 'parent_value' + assert arg == mock_val + +@pytest.mark.asyncio +async def test_list_reusable_configs_flattened_error_async(): + client = CertificateAuthorityServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + await client.list_reusable_configs( + service.ListReusableConfigsRequest(), + parent='parent_value', + ) + + +def test_list_reusable_configs_pager(transport_name: str = "grpc"): + client = CertificateAuthorityServiceClient( + credentials=ga_credentials.AnonymousCredentials, + transport=transport_name, + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_reusable_configs), + '__call__') as call: + # Set the response to a series of pages. + call.side_effect = ( + service.ListReusableConfigsResponse( + reusable_configs=[ + resources.ReusableConfig(), + resources.ReusableConfig(), + resources.ReusableConfig(), + ], + next_page_token='abc', + ), + service.ListReusableConfigsResponse( + reusable_configs=[], + next_page_token='def', + ), + service.ListReusableConfigsResponse( + reusable_configs=[ + resources.ReusableConfig(), + ], + next_page_token='ghi', + ), + service.ListReusableConfigsResponse( + reusable_configs=[ + resources.ReusableConfig(), + resources.ReusableConfig(), + ], + ), + RuntimeError, + ) + + metadata = () + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata(( + ('parent', ''), + )), + ) + pager = client.list_reusable_configs(request={}) + + assert pager._metadata == metadata + + results = list(pager) + assert len(results) == 6 + assert all(isinstance(i, resources.ReusableConfig) + for i in results) +def test_list_reusable_configs_pages(transport_name: str = "grpc"): + client = CertificateAuthorityServiceClient( + credentials=ga_credentials.AnonymousCredentials, + transport=transport_name, + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_reusable_configs), + '__call__') as call: + # Set the response to a series of pages. + call.side_effect = ( + service.ListReusableConfigsResponse( + reusable_configs=[ + resources.ReusableConfig(), + resources.ReusableConfig(), + resources.ReusableConfig(), + ], + next_page_token='abc', + ), + service.ListReusableConfigsResponse( + reusable_configs=[], + next_page_token='def', + ), + service.ListReusableConfigsResponse( + reusable_configs=[ + resources.ReusableConfig(), + ], + next_page_token='ghi', + ), + service.ListReusableConfigsResponse( + reusable_configs=[ + resources.ReusableConfig(), + resources.ReusableConfig(), + ], + ), + RuntimeError, + ) + pages = list(client.list_reusable_configs(request={}).pages) + for page_, token in zip(pages, ['abc','def','ghi', '']): + assert page_.raw_page.next_page_token == token + +@pytest.mark.asyncio +async def test_list_reusable_configs_async_pager(): + client = CertificateAuthorityServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials, + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_reusable_configs), + '__call__', new_callable=mock.AsyncMock) as call: + # Set the response to a series of pages. + call.side_effect = ( + service.ListReusableConfigsResponse( + reusable_configs=[ + resources.ReusableConfig(), + resources.ReusableConfig(), + resources.ReusableConfig(), + ], + next_page_token='abc', + ), + service.ListReusableConfigsResponse( + reusable_configs=[], + next_page_token='def', + ), + service.ListReusableConfigsResponse( + reusable_configs=[ + resources.ReusableConfig(), + ], + next_page_token='ghi', + ), + service.ListReusableConfigsResponse( + reusable_configs=[ + resources.ReusableConfig(), + resources.ReusableConfig(), + ], + ), + RuntimeError, + ) + async_pager = await client.list_reusable_configs(request={},) + assert async_pager.next_page_token == 'abc' + responses = [] + async for response in async_pager: # pragma: no branch + responses.append(response) + + assert len(responses) == 6 + assert all(isinstance(i, resources.ReusableConfig) + for i in responses) + + +@pytest.mark.asyncio +async def test_list_reusable_configs_async_pages(): + client = CertificateAuthorityServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials, + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_reusable_configs), + '__call__', new_callable=mock.AsyncMock) as call: + # Set the response to a series of pages. + call.side_effect = ( + service.ListReusableConfigsResponse( + reusable_configs=[ + resources.ReusableConfig(), + resources.ReusableConfig(), + resources.ReusableConfig(), + ], + next_page_token='abc', + ), + service.ListReusableConfigsResponse( + reusable_configs=[], + next_page_token='def', + ), + service.ListReusableConfigsResponse( + reusable_configs=[ + resources.ReusableConfig(), + ], + next_page_token='ghi', + ), + service.ListReusableConfigsResponse( + reusable_configs=[ + resources.ReusableConfig(), + resources.ReusableConfig(), + ], + ), + RuntimeError, + ) + pages = [] + async for page_ in (await client.list_reusable_configs(request={})).pages: # pragma: no branch + pages.append(page_) + for page_, token in zip(pages, ['abc','def','ghi', '']): + assert page_.raw_page.next_page_token == token + + +def test_credentials_transport_error(): + # It is an error to provide credentials and a transport instance. + transport = transports.CertificateAuthorityServiceGrpcTransport( + credentials=ga_credentials.AnonymousCredentials(), + ) + with pytest.raises(ValueError): + client = CertificateAuthorityServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # It is an error to provide a credentials file and a transport instance. + transport = transports.CertificateAuthorityServiceGrpcTransport( + credentials=ga_credentials.AnonymousCredentials(), + ) + with pytest.raises(ValueError): + client = CertificateAuthorityServiceClient( + client_options={"credentials_file": "credentials.json"}, + transport=transport, + ) + + # It is an error to provide an api_key and a transport instance. + transport = transports.CertificateAuthorityServiceGrpcTransport( + credentials=ga_credentials.AnonymousCredentials(), + ) + options = client_options.ClientOptions() + options.api_key = "api_key" + with pytest.raises(ValueError): + client = CertificateAuthorityServiceClient( + client_options=options, + transport=transport, + ) + + # It is an error to provide an api_key and a credential. + options = mock.Mock() + options.api_key = "api_key" + with pytest.raises(ValueError): + client = CertificateAuthorityServiceClient( + client_options=options, + credentials=ga_credentials.AnonymousCredentials() + ) + + # It is an error to provide scopes and a transport instance. + transport = transports.CertificateAuthorityServiceGrpcTransport( + credentials=ga_credentials.AnonymousCredentials(), + ) + with pytest.raises(ValueError): + client = CertificateAuthorityServiceClient( + client_options={"scopes": ["1", "2"]}, + transport=transport, + ) + + +def test_transport_instance(): + # A client may be instantiated with a custom transport instance. + transport = transports.CertificateAuthorityServiceGrpcTransport( + credentials=ga_credentials.AnonymousCredentials(), + ) + client = CertificateAuthorityServiceClient(transport=transport) + assert client.transport is transport + +def test_transport_get_channel(): + # A client may be instantiated with a custom transport instance. + transport = transports.CertificateAuthorityServiceGrpcTransport( + credentials=ga_credentials.AnonymousCredentials(), + ) + channel = transport.grpc_channel + assert channel + + transport = transports.CertificateAuthorityServiceGrpcAsyncIOTransport( + credentials=ga_credentials.AnonymousCredentials(), + ) + channel = transport.grpc_channel + assert channel + +@pytest.mark.parametrize("transport_class", [ + transports.CertificateAuthorityServiceGrpcTransport, + transports.CertificateAuthorityServiceGrpcAsyncIOTransport, +]) +def test_transport_adc(transport_class): + # Test default credentials are used if not provided. + with mock.patch.object(google.auth, 'default') as adc: + adc.return_value = (ga_credentials.AnonymousCredentials(), None) + transport_class() + adc.assert_called_once() + +@pytest.mark.parametrize("transport_name", [ + "grpc", +]) +def test_transport_kind(transport_name): + transport = CertificateAuthorityServiceClient.get_transport_class(transport_name)( + credentials=ga_credentials.AnonymousCredentials(), + ) + assert transport.kind == transport_name + +def test_transport_grpc_default(): + # A client should use the gRPC transport by default. + client = CertificateAuthorityServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + assert isinstance( + client.transport, + transports.CertificateAuthorityServiceGrpcTransport, + ) + +def test_certificate_authority_service_base_transport_error(): + # Passing both a credentials object and credentials_file should raise an error + with pytest.raises(core_exceptions.DuplicateCredentialArgs): + transport = transports.CertificateAuthorityServiceTransport( + credentials=ga_credentials.AnonymousCredentials(), + credentials_file="credentials.json" + ) + + +def test_certificate_authority_service_base_transport(): + # Instantiate the base transport. + with mock.patch('google.cloud.security.privateca_v1beta1.services.certificate_authority_service.transports.CertificateAuthorityServiceTransport.__init__') as Transport: + Transport.return_value = None + transport = transports.CertificateAuthorityServiceTransport( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Every method on the transport should just blindly + # raise NotImplementedError. + methods = ( + 'create_certificate', + 'get_certificate', + 'list_certificates', + 'revoke_certificate', + 'update_certificate', + 'activate_certificate_authority', + 'create_certificate_authority', + 'disable_certificate_authority', + 'enable_certificate_authority', + 'fetch_certificate_authority_csr', + 'get_certificate_authority', + 'list_certificate_authorities', + 'restore_certificate_authority', + 'schedule_delete_certificate_authority', + 'update_certificate_authority', + 'get_certificate_revocation_list', + 'list_certificate_revocation_lists', + 'update_certificate_revocation_list', + 'get_reusable_config', + 'list_reusable_configs', + ) + for method in methods: + with pytest.raises(NotImplementedError): + getattr(transport, method)(request=object()) + + with pytest.raises(NotImplementedError): + transport.close() + + # Additionally, the LRO client (a property) should + # also raise NotImplementedError + with pytest.raises(NotImplementedError): + transport.operations_client + + # Catch all for all remaining methods and properties + remainder = [ + 'kind', + ] + for r in remainder: + with pytest.raises(NotImplementedError): + getattr(transport, r)() + + +def test_certificate_authority_service_base_transport_with_credentials_file(): + # 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", + ) + load_creds.assert_called_once_with("credentials.json", + scopes=None, + default_scopes=( + 'https://www.googleapis.com/auth/cloud-platform', +), + quota_project_id="octopus", + ) + + +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(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 = (ga_credentials.AnonymousCredentials(), None) + transport = transports.CertificateAuthorityServiceTransport() + adc.assert_called_once() + + +def test_certificate_authority_service_auth_adc(): + # 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=None, + default_scopes=( + 'https://www.googleapis.com/auth/cloud-platform', +), + quota_project_id=None, + ) + + +@pytest.mark.parametrize( + "transport_class", + [ + transports.CertificateAuthorityServiceGrpcTransport, + transports.CertificateAuthorityServiceGrpcAsyncIOTransport, + ], +) +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(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, + ], +) +def test_certificate_authority_service_transport_auth_gdch_credentials(transport_class): + host = 'https://language.com' + api_audience_tests = [None, 'https://language2.com'] + api_audience_expect = [host, 'https://language2.com'] + for t, e in zip(api_audience_tests, api_audience_expect): + with mock.patch.object(google.auth, 'default', autospec=True) as adc: + gdch_mock = mock.MagicMock() + type(gdch_mock).with_gdch_audience = mock.PropertyMock(return_value=gdch_mock) + adc.return_value = (gdch_mock, None) + transport_class(host=host, api_audience=t) + gdch_mock.with_gdch_audience.assert_called_once_with( + e + ) + + +@pytest.mark.parametrize( + "transport_class,grpc_helpers", + [ + (transports.CertificateAuthorityServiceGrpcTransport, grpc_helpers), + (transports.CertificateAuthorityServiceGrpcAsyncIOTransport, grpc_helpers_async) + ], +) +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", [transports.CertificateAuthorityServiceGrpcTransport, transports.CertificateAuthorityServiceGrpcAsyncIOTransport]) +def test_certificate_authority_service_grpc_transport_client_cert_source_for_mtls( + transport_class +): + cred = ga_credentials.AnonymousCredentials() + + # Check ssl_channel_credentials is used if provided. + with mock.patch.object(transport_class, "create_channel") as mock_create_channel: + mock_ssl_channel_creds = mock.Mock() + transport_class( + host="squid.clam.whelk", + credentials=cred, + ssl_channel_credentials=mock_ssl_channel_creds + ) + mock_create_channel.assert_called_once_with( + "squid.clam.whelk:443", + credentials=cred, + credentials_file=None, + scopes=None, + ssl_credentials=mock_ssl_channel_creds, + quota_project_id=None, + options=[ + ("grpc.max_send_message_length", -1), + ("grpc.max_receive_message_length", -1), + ], + ) + + # Check if ssl_channel_credentials is not provided, then client_cert_source_for_mtls + # is used. + with mock.patch.object(transport_class, "create_channel", return_value=mock.Mock()): + with mock.patch("grpc.ssl_channel_credentials") as mock_ssl_cred: + transport_class( + credentials=cred, + client_cert_source_for_mtls=client_cert_source_callback + ) + expected_cert, expected_key = client_cert_source_callback() + mock_ssl_cred.assert_called_once_with( + certificate_chain=expected_cert, + private_key=expected_key + ) + + +@pytest.mark.parametrize("transport_name", [ + "grpc", + "grpc_asyncio", +]) +def test_certificate_authority_service_host_no_port(transport_name): + client = CertificateAuthorityServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + client_options=client_options.ClientOptions(api_endpoint='privateca.googleapis.com'), + transport=transport_name, + ) + assert client.transport._host == ( + 'privateca.googleapis.com:443' + ) + +@pytest.mark.parametrize("transport_name", [ + "grpc", + "grpc_asyncio", +]) +def test_certificate_authority_service_host_with_port(transport_name): + client = CertificateAuthorityServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + client_options=client_options.ClientOptions(api_endpoint='privateca.googleapis.com:8000'), + transport=transport_name, + ) + assert client.transport._host == ( + 'privateca.googleapis.com:8000' + ) + +def test_certificate_authority_service_grpc_transport_channel(): + channel = grpc.secure_channel('http://localhost/', grpc.local_channel_credentials()) + + # Check that channel is used if provided. + transport = transports.CertificateAuthorityServiceGrpcTransport( + host="squid.clam.whelk", + channel=channel, + ) + assert transport.grpc_channel == channel + assert transport._host == "squid.clam.whelk:443" + assert transport._ssl_channel_credentials == None + + +def test_certificate_authority_service_grpc_asyncio_transport_channel(): + channel = aio.secure_channel('http://localhost/', grpc.local_channel_credentials()) + + # Check that channel is used if provided. + transport = transports.CertificateAuthorityServiceGrpcAsyncIOTransport( + host="squid.clam.whelk", + channel=channel, + ) + assert transport.grpc_channel == channel + assert transport._host == "squid.clam.whelk:443" + assert transport._ssl_channel_credentials == None + + +# Remove this test when deprecated arguments (api_mtls_endpoint, client_cert_source) are +# removed from grpc/grpc_asyncio transport constructor. +@pytest.mark.parametrize("transport_class", [transports.CertificateAuthorityServiceGrpcTransport, transports.CertificateAuthorityServiceGrpcAsyncIOTransport]) +def test_certificate_authority_service_transport_channel_mtls_with_client_cert_source( + transport_class +): + with mock.patch("grpc.ssl_channel_credentials", autospec=True) as grpc_ssl_channel_cred: + with mock.patch.object(transport_class, "create_channel") as grpc_create_channel: + mock_ssl_cred = mock.Mock() + grpc_ssl_channel_cred.return_value = mock_ssl_cred + + mock_grpc_channel = mock.Mock() + grpc_create_channel.return_value = mock_grpc_channel + + cred = ga_credentials.AnonymousCredentials() + with pytest.warns(DeprecationWarning): + with mock.patch.object(google.auth, 'default') as adc: + adc.return_value = (cred, None) + transport = transport_class( + host="squid.clam.whelk", + api_mtls_endpoint="mtls.squid.clam.whelk", + client_cert_source=client_cert_source_callback, + ) + adc.assert_called_once() + + grpc_ssl_channel_cred.assert_called_once_with( + certificate_chain=b"cert bytes", private_key=b"key bytes" + ) + grpc_create_channel.assert_called_once_with( + "mtls.squid.clam.whelk:443", + credentials=cred, + credentials_file=None, + scopes=None, + ssl_credentials=mock_ssl_cred, + quota_project_id=None, + options=[ + ("grpc.max_send_message_length", -1), + ("grpc.max_receive_message_length", -1), + ], + ) + assert transport.grpc_channel == mock_grpc_channel + assert transport._ssl_channel_credentials == mock_ssl_cred + + +# Remove this test when deprecated arguments (api_mtls_endpoint, client_cert_source) are +# removed from grpc/grpc_asyncio transport constructor. +@pytest.mark.parametrize("transport_class", [transports.CertificateAuthorityServiceGrpcTransport, transports.CertificateAuthorityServiceGrpcAsyncIOTransport]) +def test_certificate_authority_service_transport_channel_mtls_with_adc( + transport_class +): + mock_ssl_cred = mock.Mock() + with mock.patch.multiple( + "google.auth.transport.grpc.SslCredentials", + __init__=mock.Mock(return_value=None), + ssl_credentials=mock.PropertyMock(return_value=mock_ssl_cred), + ): + with mock.patch.object(transport_class, "create_channel") as grpc_create_channel: + mock_grpc_channel = mock.Mock() + grpc_create_channel.return_value = mock_grpc_channel + mock_cred = mock.Mock() + + with pytest.warns(DeprecationWarning): + transport = transport_class( + host="squid.clam.whelk", + credentials=mock_cred, + api_mtls_endpoint="mtls.squid.clam.whelk", + client_cert_source=None, + ) + + grpc_create_channel.assert_called_once_with( + "mtls.squid.clam.whelk:443", + credentials=mock_cred, + credentials_file=None, + scopes=None, + ssl_credentials=mock_ssl_cred, + quota_project_id=None, + options=[ + ("grpc.max_send_message_length", -1), + ("grpc.max_receive_message_length", -1), + ], + ) + assert transport.grpc_channel == mock_grpc_channel + + +def test_certificate_authority_service_grpc_lro_client(): + client = CertificateAuthorityServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + transport='grpc', + ) + transport = client.transport + + # Ensure that we have a api-core operations client. + assert isinstance( + transport.operations_client, + operations_v1.OperationsClient, + ) + + # Ensure that subsequent calls to the property send the exact same object. + assert transport.operations_client is transport.operations_client + + +def test_certificate_authority_service_grpc_lro_async_client(): + client = CertificateAuthorityServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + transport='grpc_asyncio', + ) + transport = client.transport + + # Ensure that we have a api-core operations client. + assert isinstance( + transport.operations_client, + operations_v1.OperationsAsyncClient, + ) + + # Ensure that subsequent calls to the property send the exact same object. + assert transport.operations_client is transport.operations_client + + +def test_certificate_path(): + project = "squid" + location = "clam" + certificate_authority = "whelk" + certificate = "octopus" + expected = "projects/{project}/locations/{location}/certificateAuthorities/{certificate_authority}/certificates/{certificate}".format(project=project, location=location, certificate_authority=certificate_authority, certificate=certificate, ) + actual = CertificateAuthorityServiceClient.certificate_path(project, location, certificate_authority, certificate) + assert expected == actual + + +def test_parse_certificate_path(): + expected = { + "project": "oyster", + "location": "nudibranch", + "certificate_authority": "cuttlefish", + "certificate": "mussel", + } + path = CertificateAuthorityServiceClient.certificate_path(**expected) + + # Check that the path construction is reversible. + actual = CertificateAuthorityServiceClient.parse_certificate_path(path) + assert expected == actual + +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, ) + actual = CertificateAuthorityServiceClient.certificate_authority_path(project, location, certificate_authority) + assert expected == actual + + +def test_parse_certificate_authority_path(): + expected = { + "project": "abalone", + "location": "squid", + "certificate_authority": "clam", + } + path = CertificateAuthorityServiceClient.certificate_authority_path(**expected) + + # Check that the path construction is reversible. + actual = CertificateAuthorityServiceClient.parse_certificate_authority_path(path) + assert expected == actual + +def test_certificate_revocation_list_path(): + project = "whelk" + 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, certificate_authority=certificate_authority, certificate_revocation_list=certificate_revocation_list, ) + actual = CertificateAuthorityServiceClient.certificate_revocation_list_path(project, location, certificate_authority, certificate_revocation_list) + assert expected == actual + + +def test_parse_certificate_revocation_list_path(): + expected = { + "project": "cuttlefish", + "location": "mussel", + "certificate_authority": "winkle", + "certificate_revocation_list": "nautilus", + } + path = CertificateAuthorityServiceClient.certificate_revocation_list_path(**expected) + + # Check that the path construction is reversible. + actual = CertificateAuthorityServiceClient.parse_certificate_revocation_list_path(path) + assert expected == actual + +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, ) + actual = CertificateAuthorityServiceClient.reusable_config_path(project, location, reusable_config) + assert expected == actual + + +def test_parse_reusable_config_path(): + expected = { + "project": "clam", + "location": "whelk", + "reusable_config": "octopus", + } + path = CertificateAuthorityServiceClient.reusable_config_path(**expected) + + # Check that the path construction is reversible. + actual = CertificateAuthorityServiceClient.parse_reusable_config_path(path) + assert expected == actual + +def test_common_billing_account_path(): + billing_account = "oyster" + expected = "billingAccounts/{billing_account}".format(billing_account=billing_account, ) + actual = CertificateAuthorityServiceClient.common_billing_account_path(billing_account) + assert expected == actual + + +def test_parse_common_billing_account_path(): + expected = { + "billing_account": "nudibranch", + } + path = CertificateAuthorityServiceClient.common_billing_account_path(**expected) + + # Check that the path construction is reversible. + actual = CertificateAuthorityServiceClient.parse_common_billing_account_path(path) + assert expected == actual + +def test_common_folder_path(): + folder = "cuttlefish" + expected = "folders/{folder}".format(folder=folder, ) + actual = CertificateAuthorityServiceClient.common_folder_path(folder) + assert expected == actual + + +def test_parse_common_folder_path(): + expected = { + "folder": "mussel", + } + path = CertificateAuthorityServiceClient.common_folder_path(**expected) + + # Check that the path construction is reversible. + actual = CertificateAuthorityServiceClient.parse_common_folder_path(path) + assert expected == actual + +def test_common_organization_path(): + organization = "winkle" + expected = "organizations/{organization}".format(organization=organization, ) + actual = CertificateAuthorityServiceClient.common_organization_path(organization) + assert expected == actual + + +def test_parse_common_organization_path(): + expected = { + "organization": "nautilus", + } + path = CertificateAuthorityServiceClient.common_organization_path(**expected) + + # Check that the path construction is reversible. + actual = CertificateAuthorityServiceClient.parse_common_organization_path(path) + assert expected == actual + +def test_common_project_path(): + project = "scallop" + expected = "projects/{project}".format(project=project, ) + actual = CertificateAuthorityServiceClient.common_project_path(project) + assert expected == actual + + +def test_parse_common_project_path(): + expected = { + "project": "abalone", + } + path = CertificateAuthorityServiceClient.common_project_path(**expected) + + # Check that the path construction is reversible. + actual = CertificateAuthorityServiceClient.parse_common_project_path(path) + assert expected == actual + +def test_common_location_path(): + project = "squid" + location = "clam" + expected = "projects/{project}/locations/{location}".format(project=project, location=location, ) + actual = CertificateAuthorityServiceClient.common_location_path(project, location) + assert expected == actual + + +def test_parse_common_location_path(): + expected = { + "project": "whelk", + "location": "octopus", + } + path = CertificateAuthorityServiceClient.common_location_path(**expected) + + # Check that the path construction is reversible. + actual = CertificateAuthorityServiceClient.parse_common_location_path(path) + assert expected == actual + + +def test_client_with_default_client_info(): + client_info = gapic_v1.client_info.ClientInfo() + + with mock.patch.object(transports.CertificateAuthorityServiceTransport, '_prep_wrapped_messages') as prep: + client = CertificateAuthorityServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + client_info=client_info, + ) + prep.assert_called_once_with(client_info) + + with mock.patch.object(transports.CertificateAuthorityServiceTransport, '_prep_wrapped_messages') as prep: + transport_class = CertificateAuthorityServiceClient.get_transport_class() + transport = transport_class( + credentials=ga_credentials.AnonymousCredentials(), + client_info=client_info, + ) + prep.assert_called_once_with(client_info) + +@pytest.mark.asyncio +async def test_transport_close_async(): + client = CertificateAuthorityServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc_asyncio", + ) + with mock.patch.object(type(getattr(client.transport, "grpc_channel")), "close") as close: + async with client: + close.assert_not_called() + close.assert_called_once() + + +def test_transport_close(): + transports = { + "grpc": "_grpc_channel", + } + + for transport, close_name in transports.items(): + client = CertificateAuthorityServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport + ) + with mock.patch.object(type(getattr(client.transport, close_name)), "close") as close: + with client: + close.assert_not_called() + close.assert_called_once() + +def test_client_ctx(): + transports = [ + 'grpc', + ] + for transport in transports: + client = CertificateAuthorityServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport + ) + # Test client calls underlying transport. + with mock.patch.object(type(client.transport), "close") as close: + close.assert_not_called() + with client: + pass + close.assert_called() + +@pytest.mark.parametrize("client_class,transport_class", [ + (CertificateAuthorityServiceClient, transports.CertificateAuthorityServiceGrpcTransport), + (CertificateAuthorityServiceAsyncClient, transports.CertificateAuthorityServiceGrpcAsyncIOTransport), +]) +def test_api_key_credentials(client_class, transport_class): + with mock.patch.object( + google.auth._default, "get_api_key_credentials", create=True + ) as get_api_key_credentials: + mock_cred = mock.Mock() + get_api_key_credentials.return_value = mock_cred + options = client_options.ClientOptions() + options.api_key = "api_key" + with mock.patch.object(transport_class, "__init__") as patched: + patched.return_value = None + client = client_class(client_options=options) + patched.assert_called_once_with( + credentials=mock_cred, + credentials_file=None, + host=client.DEFAULT_ENDPOINT, + scopes=None, + client_cert_source_for_mtls=None, + quota_project_id=None, + client_info=transports.base.DEFAULT_CLIENT_INFO, + always_use_jwt_access=True, + api_audience=None, + ) From d31f964aad2fb8cc81f03acff1ffe8904bffac51 Mon Sep 17 00:00:00 2001 From: Owl Bot Date: Tue, 24 Jan 2023 19:14:25 +0000 Subject: [PATCH 2/2] =?UTF-8?q?=F0=9F=A6=89=20Updates=20from=20OwlBot=20po?= =?UTF-8?q?st-processor?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md --- .coveragerc | 1 + .../cloud/security/privateca_v1/__init__.py | 2 +- .../security/privateca_v1beta1/__init__.py | 2 +- owl-bot-staging/v1/.coveragerc | 13 - owl-bot-staging/v1/.flake8 | 33 - owl-bot-staging/v1/MANIFEST.in | 2 - owl-bot-staging/v1/README.rst | 49 - owl-bot-staging/v1/docs/conf.py | 376 - owl-bot-staging/v1/docs/index.rst | 7 - .../certificate_authority_service.rst | 10 - .../v1/docs/privateca_v1/services.rst | 6 - .../v1/docs/privateca_v1/types.rst | 6 - .../cloud/security/privateca/__init__.py | 139 - .../cloud/security/privateca/gapic_version.py | 16 - .../google/cloud/security/privateca/py.typed | 2 - .../cloud/security/privateca_v1/__init__.py | 140 - .../security/privateca_v1/gapic_metadata.json | 313 - .../security/privateca_v1/gapic_version.py | 16 - .../cloud/security/privateca_v1/py.typed | 2 - .../privateca_v1/services/__init__.py | 15 - .../certificate_authority_service/__init__.py | 22 - .../async_client.py | 3752 ------- .../certificate_authority_service/client.py | 3990 ------- .../certificate_authority_service/pagers.py | 624 -- .../transports/__init__.py | 33 - .../transports/base.py | 548 - .../transports/grpc.py | 1071 -- .../transports/grpc_asyncio.py | 1070 -- .../security/privateca_v1/types/__init__.py | 134 - .../security/privateca_v1/types/resources.py | 2179 ---- .../security/privateca_v1/types/service.py | 1671 --- owl-bot-staging/v1/mypy.ini | 3 - owl-bot-staging/v1/noxfile.py | 184 - ...ce_activate_certificate_authority_async.py | 61 - ...ice_activate_certificate_authority_sync.py | 61 - ..._authority_service_create_ca_pool_async.py | 61 - ...e_authority_service_create_ca_pool_sync.py | 61 - ...hority_service_create_certificate_async.py | 56 - ...vice_create_certificate_authority_async.py | 62 - ...rvice_create_certificate_authority_sync.py | 62 - ...thority_service_create_certificate_sync.py | 56 - ...rvice_create_certificate_template_async.py | 57 - ...ervice_create_certificate_template_sync.py | 57 - ..._authority_service_delete_ca_pool_async.py | 56 - ...e_authority_service_delete_ca_pool_sync.py | 56 - ...vice_delete_certificate_authority_async.py | 56 - ...rvice_delete_certificate_authority_sync.py | 56 - ...rvice_delete_certificate_template_async.py | 56 - ...ervice_delete_certificate_template_sync.py | 56 - ...ice_disable_certificate_authority_async.py | 56 - ...vice_disable_certificate_authority_sync.py | 56 - ...vice_enable_certificate_authority_async.py | 56 - ...rvice_enable_certificate_authority_sync.py | 56 - ..._authority_service_fetch_ca_certs_async.py | 52 - ...e_authority_service_fetch_ca_certs_sync.py | 52 - ...e_fetch_certificate_authority_csr_async.py | 52 - ...ce_fetch_certificate_authority_csr_sync.py | 52 - ...ate_authority_service_get_ca_pool_async.py | 52 - ...cate_authority_service_get_ca_pool_sync.py | 52 - ...authority_service_get_certificate_async.py | 52 - ...service_get_certificate_authority_async.py | 52 - ..._service_get_certificate_authority_sync.py | 52 - ...e_get_certificate_revocation_list_async.py | 52 - ...ce_get_certificate_revocation_list_sync.py | 52 - ..._authority_service_get_certificate_sync.py | 52 - ..._service_get_certificate_template_async.py | 52 - ...y_service_get_certificate_template_sync.py | 52 - ...e_authority_service_list_ca_pools_async.py | 53 - ...te_authority_service_list_ca_pools_sync.py | 53 - ...vice_list_certificate_authorities_async.py | 53 - ...rvice_list_certificate_authorities_sync.py | 53 - ...list_certificate_revocation_lists_async.py | 53 - ..._list_certificate_revocation_lists_sync.py | 53 - ...ervice_list_certificate_templates_async.py | 53 - ...service_list_certificate_templates_sync.py | 53 - ...thority_service_list_certificates_async.py | 53 - ...uthority_service_list_certificates_sync.py | 53 - ...hority_service_revoke_certificate_async.py | 53 - ...thority_service_revoke_certificate_sync.py | 53 - ...ce_undelete_certificate_authority_async.py | 56 - ...ice_undelete_certificate_authority_sync.py | 56 - ..._authority_service_update_ca_pool_async.py | 59 - ...e_authority_service_update_ca_pool_sync.py | 59 - ...hority_service_update_certificate_async.py | 55 - ...vice_update_certificate_authority_async.py | 60 - ...rvice_update_certificate_authority_sync.py | 60 - ...pdate_certificate_revocation_list_async.py | 55 - ...update_certificate_revocation_list_sync.py | 55 - ...thority_service_update_certificate_sync.py | 55 - ...rvice_update_certificate_template_async.py | 55 - ...ervice_update_certificate_template_sync.py | 55 - ...ta_google.cloud.security.privateca.v1.json | 4788 --------- .../v1/scripts/fixup_privateca_v1_keywords.py | 204 - owl-bot-staging/v1/setup.py | 92 - .../v1/testing/constraints-3.10.txt | 6 - .../v1/testing/constraints-3.11.txt | 6 - .../v1/testing/constraints-3.12.txt | 6 - .../v1/testing/constraints-3.7.txt | 9 - .../v1/testing/constraints-3.8.txt | 6 - .../v1/testing/constraints-3.9.txt | 6 - owl-bot-staging/v1/tests/__init__.py | 16 - owl-bot-staging/v1/tests/unit/__init__.py | 16 - .../v1/tests/unit/gapic/__init__.py | 16 - .../tests/unit/gapic/privateca_v1/__init__.py | 16 - .../test_certificate_authority_service.py | 9247 ----------------- owl-bot-staging/v1beta1/.coveragerc | 13 - owl-bot-staging/v1beta1/.flake8 | 33 - owl-bot-staging/v1beta1/MANIFEST.in | 2 - owl-bot-staging/v1beta1/README.rst | 49 - owl-bot-staging/v1beta1/docs/conf.py | 376 - owl-bot-staging/v1beta1/docs/index.rst | 7 - .../certificate_authority_service.rst | 10 - .../docs/privateca_v1beta1/services.rst | 6 - .../v1beta1/docs/privateca_v1beta1/types.rst | 6 - .../cloud/security/privateca/__init__.py | 111 - .../cloud/security/privateca/gapic_version.py | 16 - .../google/cloud/security/privateca/py.typed | 2 - .../security/privateca_v1beta1/__init__.py | 112 - .../privateca_v1beta1/gapic_metadata.json | 223 - .../privateca_v1beta1/gapic_version.py | 16 - .../cloud/security/privateca_v1beta1/py.typed | 2 - .../privateca_v1beta1/services/__init__.py | 15 - .../certificate_authority_service/__init__.py | 22 - .../async_client.py | 2618 ----- .../certificate_authority_service/client.py | 2847 ----- .../certificate_authority_service/pagers.py | 503 - .../transports/__init__.py | 33 - .../transports/base.py | 422 - .../transports/grpc.py | 830 -- .../transports/grpc_asyncio.py | 829 -- .../privateca_v1beta1/types/__init__.py | 106 - .../privateca_v1beta1/types/resources.py | 1861 ---- .../privateca_v1beta1/types/service.py | 1124 -- owl-bot-staging/v1beta1/mypy.ini | 3 - owl-bot-staging/v1beta1/noxfile.py | 184 - ...ce_activate_certificate_authority_async.py | 61 - ...ice_activate_certificate_authority_sync.py | 61 - ...hority_service_create_certificate_async.py | 56 - ...vice_create_certificate_authority_async.py | 64 - ...rvice_create_certificate_authority_sync.py | 64 - ...thority_service_create_certificate_sync.py | 56 - ...ice_disable_certificate_authority_async.py | 56 - ...vice_disable_certificate_authority_sync.py | 56 - ...vice_enable_certificate_authority_async.py | 56 - ...rvice_enable_certificate_authority_sync.py | 56 - ...e_fetch_certificate_authority_csr_async.py | 52 - ...ce_fetch_certificate_authority_csr_sync.py | 52 - ...authority_service_get_certificate_async.py | 52 - ...service_get_certificate_authority_async.py | 52 - ..._service_get_certificate_authority_sync.py | 52 - ...e_get_certificate_revocation_list_async.py | 52 - ...ce_get_certificate_revocation_list_sync.py | 52 - ..._authority_service_get_certificate_sync.py | 52 - ...ority_service_get_reusable_config_async.py | 52 - ...hority_service_get_reusable_config_sync.py | 52 - ...vice_list_certificate_authorities_async.py | 53 - ...rvice_list_certificate_authorities_sync.py | 53 - ...list_certificate_revocation_lists_async.py | 53 - ..._list_certificate_revocation_lists_sync.py | 53 - ...thority_service_list_certificates_async.py | 53 - ...uthority_service_list_certificates_sync.py | 53 - ...ity_service_list_reusable_configs_async.py | 53 - ...rity_service_list_reusable_configs_sync.py | 53 - ...ice_restore_certificate_authority_async.py | 56 - ...vice_restore_certificate_authority_sync.py | 56 - ...hority_service_revoke_certificate_async.py | 53 - ...thority_service_revoke_certificate_sync.py | 53 - ...dule_delete_certificate_authority_async.py | 56 - ...edule_delete_certificate_authority_sync.py | 56 - ...hority_service_update_certificate_async.py | 55 - ...vice_update_certificate_authority_async.py | 62 - ...rvice_update_certificate_authority_sync.py | 62 - ...pdate_certificate_revocation_list_async.py | 55 - ...update_certificate_revocation_list_sync.py | 55 - ...thority_service_update_certificate_sync.py | 55 - ...ogle.cloud.security.privateca.v1beta1.json | 3291 ------ .../fixup_privateca_v1beta1_keywords.py | 195 - owl-bot-staging/v1beta1/setup.py | 92 - .../v1beta1/testing/constraints-3.10.txt | 6 - .../v1beta1/testing/constraints-3.11.txt | 6 - .../v1beta1/testing/constraints-3.12.txt | 6 - .../v1beta1/testing/constraints-3.7.txt | 9 - .../v1beta1/testing/constraints-3.8.txt | 6 - .../v1beta1/testing/constraints-3.9.txt | 6 - owl-bot-staging/v1beta1/tests/__init__.py | 16 - .../v1beta1/tests/unit/__init__.py | 16 - .../v1beta1/tests/unit/gapic/__init__.py | 16 - .../unit/gapic/privateca_v1beta1/__init__.py | 16 - .../test_certificate_authority_service.py | 6833 ------------ ...ta_google.cloud.security.privateca.v1.json | 2 +- ...ogle.cloud.security.privateca.v1beta1.json | 2 +- 191 files changed, 5 insertions(+), 59161 deletions(-) delete mode 100644 owl-bot-staging/v1/.coveragerc delete mode 100644 owl-bot-staging/v1/.flake8 delete mode 100644 owl-bot-staging/v1/MANIFEST.in delete mode 100644 owl-bot-staging/v1/README.rst delete mode 100644 owl-bot-staging/v1/docs/conf.py delete mode 100644 owl-bot-staging/v1/docs/index.rst delete mode 100644 owl-bot-staging/v1/docs/privateca_v1/certificate_authority_service.rst delete mode 100644 owl-bot-staging/v1/docs/privateca_v1/services.rst delete mode 100644 owl-bot-staging/v1/docs/privateca_v1/types.rst delete mode 100644 owl-bot-staging/v1/google/cloud/security/privateca/__init__.py delete mode 100644 owl-bot-staging/v1/google/cloud/security/privateca/gapic_version.py delete mode 100644 owl-bot-staging/v1/google/cloud/security/privateca/py.typed delete mode 100644 owl-bot-staging/v1/google/cloud/security/privateca_v1/__init__.py delete mode 100644 owl-bot-staging/v1/google/cloud/security/privateca_v1/gapic_metadata.json delete mode 100644 owl-bot-staging/v1/google/cloud/security/privateca_v1/gapic_version.py delete mode 100644 owl-bot-staging/v1/google/cloud/security/privateca_v1/py.typed delete mode 100644 owl-bot-staging/v1/google/cloud/security/privateca_v1/services/__init__.py delete mode 100644 owl-bot-staging/v1/google/cloud/security/privateca_v1/services/certificate_authority_service/__init__.py delete mode 100644 owl-bot-staging/v1/google/cloud/security/privateca_v1/services/certificate_authority_service/async_client.py delete mode 100644 owl-bot-staging/v1/google/cloud/security/privateca_v1/services/certificate_authority_service/client.py delete mode 100644 owl-bot-staging/v1/google/cloud/security/privateca_v1/services/certificate_authority_service/pagers.py delete mode 100644 owl-bot-staging/v1/google/cloud/security/privateca_v1/services/certificate_authority_service/transports/__init__.py delete mode 100644 owl-bot-staging/v1/google/cloud/security/privateca_v1/services/certificate_authority_service/transports/base.py delete mode 100644 owl-bot-staging/v1/google/cloud/security/privateca_v1/services/certificate_authority_service/transports/grpc.py delete mode 100644 owl-bot-staging/v1/google/cloud/security/privateca_v1/services/certificate_authority_service/transports/grpc_asyncio.py delete mode 100644 owl-bot-staging/v1/google/cloud/security/privateca_v1/types/__init__.py delete mode 100644 owl-bot-staging/v1/google/cloud/security/privateca_v1/types/resources.py delete mode 100644 owl-bot-staging/v1/google/cloud/security/privateca_v1/types/service.py delete mode 100644 owl-bot-staging/v1/mypy.ini delete mode 100644 owl-bot-staging/v1/noxfile.py delete mode 100644 owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_activate_certificate_authority_async.py delete mode 100644 owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_activate_certificate_authority_sync.py delete mode 100644 owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_create_ca_pool_async.py delete mode 100644 owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_create_ca_pool_sync.py delete mode 100644 owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_create_certificate_async.py delete mode 100644 owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_create_certificate_authority_async.py delete mode 100644 owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_create_certificate_authority_sync.py delete mode 100644 owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_create_certificate_sync.py delete mode 100644 owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_create_certificate_template_async.py delete mode 100644 owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_create_certificate_template_sync.py delete mode 100644 owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_delete_ca_pool_async.py delete mode 100644 owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_delete_ca_pool_sync.py delete mode 100644 owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_delete_certificate_authority_async.py delete mode 100644 owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_delete_certificate_authority_sync.py delete mode 100644 owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_delete_certificate_template_async.py delete mode 100644 owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_delete_certificate_template_sync.py delete mode 100644 owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_disable_certificate_authority_async.py delete mode 100644 owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_disable_certificate_authority_sync.py delete mode 100644 owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_enable_certificate_authority_async.py delete mode 100644 owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_enable_certificate_authority_sync.py delete mode 100644 owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_fetch_ca_certs_async.py delete mode 100644 owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_fetch_ca_certs_sync.py delete mode 100644 owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_fetch_certificate_authority_csr_async.py delete mode 100644 owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_fetch_certificate_authority_csr_sync.py delete mode 100644 owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_get_ca_pool_async.py delete mode 100644 owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_get_ca_pool_sync.py delete mode 100644 owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_get_certificate_async.py delete mode 100644 owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_get_certificate_authority_async.py delete mode 100644 owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_get_certificate_authority_sync.py delete mode 100644 owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_get_certificate_revocation_list_async.py delete mode 100644 owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_get_certificate_revocation_list_sync.py delete mode 100644 owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_get_certificate_sync.py delete mode 100644 owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_get_certificate_template_async.py delete mode 100644 owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_get_certificate_template_sync.py delete mode 100644 owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_list_ca_pools_async.py delete mode 100644 owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_list_ca_pools_sync.py delete mode 100644 owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_list_certificate_authorities_async.py delete mode 100644 owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_list_certificate_authorities_sync.py delete mode 100644 owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_list_certificate_revocation_lists_async.py delete mode 100644 owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_list_certificate_revocation_lists_sync.py delete mode 100644 owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_list_certificate_templates_async.py delete mode 100644 owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_list_certificate_templates_sync.py delete mode 100644 owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_list_certificates_async.py delete mode 100644 owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_list_certificates_sync.py delete mode 100644 owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_revoke_certificate_async.py delete mode 100644 owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_revoke_certificate_sync.py delete mode 100644 owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_undelete_certificate_authority_async.py delete mode 100644 owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_undelete_certificate_authority_sync.py delete mode 100644 owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_update_ca_pool_async.py delete mode 100644 owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_update_ca_pool_sync.py delete mode 100644 owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_update_certificate_async.py delete mode 100644 owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_update_certificate_authority_async.py delete mode 100644 owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_update_certificate_authority_sync.py delete mode 100644 owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_update_certificate_revocation_list_async.py delete mode 100644 owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_update_certificate_revocation_list_sync.py delete mode 100644 owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_update_certificate_sync.py delete mode 100644 owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_update_certificate_template_async.py delete mode 100644 owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_update_certificate_template_sync.py delete mode 100644 owl-bot-staging/v1/samples/generated_samples/snippet_metadata_google.cloud.security.privateca.v1.json delete mode 100644 owl-bot-staging/v1/scripts/fixup_privateca_v1_keywords.py delete mode 100644 owl-bot-staging/v1/setup.py delete mode 100644 owl-bot-staging/v1/testing/constraints-3.10.txt delete mode 100644 owl-bot-staging/v1/testing/constraints-3.11.txt delete mode 100644 owl-bot-staging/v1/testing/constraints-3.12.txt delete mode 100644 owl-bot-staging/v1/testing/constraints-3.7.txt delete mode 100644 owl-bot-staging/v1/testing/constraints-3.8.txt delete mode 100644 owl-bot-staging/v1/testing/constraints-3.9.txt delete mode 100644 owl-bot-staging/v1/tests/__init__.py delete mode 100644 owl-bot-staging/v1/tests/unit/__init__.py delete mode 100644 owl-bot-staging/v1/tests/unit/gapic/__init__.py delete mode 100644 owl-bot-staging/v1/tests/unit/gapic/privateca_v1/__init__.py delete mode 100644 owl-bot-staging/v1/tests/unit/gapic/privateca_v1/test_certificate_authority_service.py delete mode 100644 owl-bot-staging/v1beta1/.coveragerc delete mode 100644 owl-bot-staging/v1beta1/.flake8 delete mode 100644 owl-bot-staging/v1beta1/MANIFEST.in delete mode 100644 owl-bot-staging/v1beta1/README.rst delete mode 100644 owl-bot-staging/v1beta1/docs/conf.py delete mode 100644 owl-bot-staging/v1beta1/docs/index.rst delete mode 100644 owl-bot-staging/v1beta1/docs/privateca_v1beta1/certificate_authority_service.rst delete mode 100644 owl-bot-staging/v1beta1/docs/privateca_v1beta1/services.rst delete mode 100644 owl-bot-staging/v1beta1/docs/privateca_v1beta1/types.rst delete mode 100644 owl-bot-staging/v1beta1/google/cloud/security/privateca/__init__.py delete mode 100644 owl-bot-staging/v1beta1/google/cloud/security/privateca/gapic_version.py delete mode 100644 owl-bot-staging/v1beta1/google/cloud/security/privateca/py.typed delete mode 100644 owl-bot-staging/v1beta1/google/cloud/security/privateca_v1beta1/__init__.py delete mode 100644 owl-bot-staging/v1beta1/google/cloud/security/privateca_v1beta1/gapic_metadata.json delete mode 100644 owl-bot-staging/v1beta1/google/cloud/security/privateca_v1beta1/gapic_version.py delete mode 100644 owl-bot-staging/v1beta1/google/cloud/security/privateca_v1beta1/py.typed delete mode 100644 owl-bot-staging/v1beta1/google/cloud/security/privateca_v1beta1/services/__init__.py delete mode 100644 owl-bot-staging/v1beta1/google/cloud/security/privateca_v1beta1/services/certificate_authority_service/__init__.py delete mode 100644 owl-bot-staging/v1beta1/google/cloud/security/privateca_v1beta1/services/certificate_authority_service/async_client.py delete mode 100644 owl-bot-staging/v1beta1/google/cloud/security/privateca_v1beta1/services/certificate_authority_service/client.py delete mode 100644 owl-bot-staging/v1beta1/google/cloud/security/privateca_v1beta1/services/certificate_authority_service/pagers.py delete mode 100644 owl-bot-staging/v1beta1/google/cloud/security/privateca_v1beta1/services/certificate_authority_service/transports/__init__.py delete mode 100644 owl-bot-staging/v1beta1/google/cloud/security/privateca_v1beta1/services/certificate_authority_service/transports/base.py delete mode 100644 owl-bot-staging/v1beta1/google/cloud/security/privateca_v1beta1/services/certificate_authority_service/transports/grpc.py delete mode 100644 owl-bot-staging/v1beta1/google/cloud/security/privateca_v1beta1/services/certificate_authority_service/transports/grpc_asyncio.py delete mode 100644 owl-bot-staging/v1beta1/google/cloud/security/privateca_v1beta1/types/__init__.py delete mode 100644 owl-bot-staging/v1beta1/google/cloud/security/privateca_v1beta1/types/resources.py delete mode 100644 owl-bot-staging/v1beta1/google/cloud/security/privateca_v1beta1/types/service.py delete mode 100644 owl-bot-staging/v1beta1/mypy.ini delete mode 100644 owl-bot-staging/v1beta1/noxfile.py delete mode 100644 owl-bot-staging/v1beta1/samples/generated_samples/privateca_v1beta1_generated_certificate_authority_service_activate_certificate_authority_async.py delete mode 100644 owl-bot-staging/v1beta1/samples/generated_samples/privateca_v1beta1_generated_certificate_authority_service_activate_certificate_authority_sync.py delete mode 100644 owl-bot-staging/v1beta1/samples/generated_samples/privateca_v1beta1_generated_certificate_authority_service_create_certificate_async.py delete mode 100644 owl-bot-staging/v1beta1/samples/generated_samples/privateca_v1beta1_generated_certificate_authority_service_create_certificate_authority_async.py delete mode 100644 owl-bot-staging/v1beta1/samples/generated_samples/privateca_v1beta1_generated_certificate_authority_service_create_certificate_authority_sync.py delete mode 100644 owl-bot-staging/v1beta1/samples/generated_samples/privateca_v1beta1_generated_certificate_authority_service_create_certificate_sync.py delete mode 100644 owl-bot-staging/v1beta1/samples/generated_samples/privateca_v1beta1_generated_certificate_authority_service_disable_certificate_authority_async.py delete mode 100644 owl-bot-staging/v1beta1/samples/generated_samples/privateca_v1beta1_generated_certificate_authority_service_disable_certificate_authority_sync.py delete mode 100644 owl-bot-staging/v1beta1/samples/generated_samples/privateca_v1beta1_generated_certificate_authority_service_enable_certificate_authority_async.py delete mode 100644 owl-bot-staging/v1beta1/samples/generated_samples/privateca_v1beta1_generated_certificate_authority_service_enable_certificate_authority_sync.py delete mode 100644 owl-bot-staging/v1beta1/samples/generated_samples/privateca_v1beta1_generated_certificate_authority_service_fetch_certificate_authority_csr_async.py delete mode 100644 owl-bot-staging/v1beta1/samples/generated_samples/privateca_v1beta1_generated_certificate_authority_service_fetch_certificate_authority_csr_sync.py delete mode 100644 owl-bot-staging/v1beta1/samples/generated_samples/privateca_v1beta1_generated_certificate_authority_service_get_certificate_async.py delete mode 100644 owl-bot-staging/v1beta1/samples/generated_samples/privateca_v1beta1_generated_certificate_authority_service_get_certificate_authority_async.py delete mode 100644 owl-bot-staging/v1beta1/samples/generated_samples/privateca_v1beta1_generated_certificate_authority_service_get_certificate_authority_sync.py delete mode 100644 owl-bot-staging/v1beta1/samples/generated_samples/privateca_v1beta1_generated_certificate_authority_service_get_certificate_revocation_list_async.py delete mode 100644 owl-bot-staging/v1beta1/samples/generated_samples/privateca_v1beta1_generated_certificate_authority_service_get_certificate_revocation_list_sync.py delete mode 100644 owl-bot-staging/v1beta1/samples/generated_samples/privateca_v1beta1_generated_certificate_authority_service_get_certificate_sync.py delete mode 100644 owl-bot-staging/v1beta1/samples/generated_samples/privateca_v1beta1_generated_certificate_authority_service_get_reusable_config_async.py delete mode 100644 owl-bot-staging/v1beta1/samples/generated_samples/privateca_v1beta1_generated_certificate_authority_service_get_reusable_config_sync.py delete mode 100644 owl-bot-staging/v1beta1/samples/generated_samples/privateca_v1beta1_generated_certificate_authority_service_list_certificate_authorities_async.py delete mode 100644 owl-bot-staging/v1beta1/samples/generated_samples/privateca_v1beta1_generated_certificate_authority_service_list_certificate_authorities_sync.py delete mode 100644 owl-bot-staging/v1beta1/samples/generated_samples/privateca_v1beta1_generated_certificate_authority_service_list_certificate_revocation_lists_async.py delete mode 100644 owl-bot-staging/v1beta1/samples/generated_samples/privateca_v1beta1_generated_certificate_authority_service_list_certificate_revocation_lists_sync.py delete mode 100644 owl-bot-staging/v1beta1/samples/generated_samples/privateca_v1beta1_generated_certificate_authority_service_list_certificates_async.py delete mode 100644 owl-bot-staging/v1beta1/samples/generated_samples/privateca_v1beta1_generated_certificate_authority_service_list_certificates_sync.py delete mode 100644 owl-bot-staging/v1beta1/samples/generated_samples/privateca_v1beta1_generated_certificate_authority_service_list_reusable_configs_async.py delete mode 100644 owl-bot-staging/v1beta1/samples/generated_samples/privateca_v1beta1_generated_certificate_authority_service_list_reusable_configs_sync.py delete mode 100644 owl-bot-staging/v1beta1/samples/generated_samples/privateca_v1beta1_generated_certificate_authority_service_restore_certificate_authority_async.py delete mode 100644 owl-bot-staging/v1beta1/samples/generated_samples/privateca_v1beta1_generated_certificate_authority_service_restore_certificate_authority_sync.py delete mode 100644 owl-bot-staging/v1beta1/samples/generated_samples/privateca_v1beta1_generated_certificate_authority_service_revoke_certificate_async.py delete mode 100644 owl-bot-staging/v1beta1/samples/generated_samples/privateca_v1beta1_generated_certificate_authority_service_revoke_certificate_sync.py delete mode 100644 owl-bot-staging/v1beta1/samples/generated_samples/privateca_v1beta1_generated_certificate_authority_service_schedule_delete_certificate_authority_async.py delete mode 100644 owl-bot-staging/v1beta1/samples/generated_samples/privateca_v1beta1_generated_certificate_authority_service_schedule_delete_certificate_authority_sync.py delete mode 100644 owl-bot-staging/v1beta1/samples/generated_samples/privateca_v1beta1_generated_certificate_authority_service_update_certificate_async.py delete mode 100644 owl-bot-staging/v1beta1/samples/generated_samples/privateca_v1beta1_generated_certificate_authority_service_update_certificate_authority_async.py delete mode 100644 owl-bot-staging/v1beta1/samples/generated_samples/privateca_v1beta1_generated_certificate_authority_service_update_certificate_authority_sync.py delete mode 100644 owl-bot-staging/v1beta1/samples/generated_samples/privateca_v1beta1_generated_certificate_authority_service_update_certificate_revocation_list_async.py delete mode 100644 owl-bot-staging/v1beta1/samples/generated_samples/privateca_v1beta1_generated_certificate_authority_service_update_certificate_revocation_list_sync.py delete mode 100644 owl-bot-staging/v1beta1/samples/generated_samples/privateca_v1beta1_generated_certificate_authority_service_update_certificate_sync.py delete mode 100644 owl-bot-staging/v1beta1/samples/generated_samples/snippet_metadata_google.cloud.security.privateca.v1beta1.json delete mode 100644 owl-bot-staging/v1beta1/scripts/fixup_privateca_v1beta1_keywords.py delete mode 100644 owl-bot-staging/v1beta1/setup.py delete mode 100644 owl-bot-staging/v1beta1/testing/constraints-3.10.txt delete mode 100644 owl-bot-staging/v1beta1/testing/constraints-3.11.txt delete mode 100644 owl-bot-staging/v1beta1/testing/constraints-3.12.txt delete mode 100644 owl-bot-staging/v1beta1/testing/constraints-3.7.txt delete mode 100644 owl-bot-staging/v1beta1/testing/constraints-3.8.txt delete mode 100644 owl-bot-staging/v1beta1/testing/constraints-3.9.txt delete mode 100644 owl-bot-staging/v1beta1/tests/__init__.py delete mode 100644 owl-bot-staging/v1beta1/tests/unit/__init__.py delete mode 100644 owl-bot-staging/v1beta1/tests/unit/gapic/__init__.py delete mode 100644 owl-bot-staging/v1beta1/tests/unit/gapic/privateca_v1beta1/__init__.py delete mode 100644 owl-bot-staging/v1beta1/tests/unit/gapic/privateca_v1beta1/test_certificate_authority_service.py diff --git a/.coveragerc b/.coveragerc index 422581a..eeab431 100644 --- a/.coveragerc +++ b/.coveragerc @@ -5,6 +5,7 @@ branch = True show_missing = True omit = google/cloud/security/privateca/__init__.py + google/cloud/security/privateca/gapic_version.py exclude_lines = # Re-enable the standard pragma pragma: NO COVER diff --git a/google/cloud/security/privateca_v1/__init__.py b/google/cloud/security/privateca_v1/__init__.py index 30932ac..313174b 100644 --- a/google/cloud/security/privateca_v1/__init__.py +++ b/google/cloud/security/privateca_v1/__init__.py @@ -13,7 +13,7 @@ # See the License for the specific language governing permissions and # limitations under the License. # -from google.cloud.security.privateca import gapic_version as package_version +from google.cloud.security.privateca_v1 import gapic_version as package_version __version__ = package_version.__version__ diff --git a/google/cloud/security/privateca_v1beta1/__init__.py b/google/cloud/security/privateca_v1beta1/__init__.py index 43ace52..a04f5ac 100644 --- a/google/cloud/security/privateca_v1beta1/__init__.py +++ b/google/cloud/security/privateca_v1beta1/__init__.py @@ -13,7 +13,7 @@ # See the License for the specific language governing permissions and # limitations under the License. # -from google.cloud.security.privateca import gapic_version as package_version +from google.cloud.security.privateca_v1beta1 import gapic_version as package_version __version__ = package_version.__version__ diff --git a/owl-bot-staging/v1/.coveragerc b/owl-bot-staging/v1/.coveragerc deleted file mode 100644 index eeab431..0000000 --- a/owl-bot-staging/v1/.coveragerc +++ /dev/null @@ -1,13 +0,0 @@ -[run] -branch = True - -[report] -show_missing = True -omit = - google/cloud/security/privateca/__init__.py - google/cloud/security/privateca/gapic_version.py -exclude_lines = - # Re-enable the standard pragma - pragma: NO COVER - # Ignore debug-only repr - def __repr__ diff --git a/owl-bot-staging/v1/.flake8 b/owl-bot-staging/v1/.flake8 deleted file mode 100644 index 29227d4..0000000 --- a/owl-bot-staging/v1/.flake8 +++ /dev/null @@ -1,33 +0,0 @@ -# -*- 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 -# -# https://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. - -# Generated by synthtool. DO NOT EDIT! -[flake8] -ignore = E203, E266, E501, W503 -exclude = - # Exclude generated code. - **/proto/** - **/gapic/** - **/services/** - **/types/** - *_pb2.py - - # Standard linting exemptions. - **/.nox/** - __pycache__, - .git, - *.pyc, - conf.py diff --git a/owl-bot-staging/v1/MANIFEST.in b/owl-bot-staging/v1/MANIFEST.in deleted file mode 100644 index 3b6449c..0000000 --- a/owl-bot-staging/v1/MANIFEST.in +++ /dev/null @@ -1,2 +0,0 @@ -recursive-include google/cloud/security/privateca *.py -recursive-include google/cloud/security/privateca_v1 *.py diff --git a/owl-bot-staging/v1/README.rst b/owl-bot-staging/v1/README.rst deleted file mode 100644 index d1e676b..0000000 --- a/owl-bot-staging/v1/README.rst +++ /dev/null @@ -1,49 +0,0 @@ -Python Client for Google Cloud Security Privateca API -================================================= - -Quick Start ------------ - -In order to use this library, you first need to go through the following steps: - -1. `Select or create a Cloud Platform project.`_ -2. `Enable billing for your project.`_ -3. Enable the Google Cloud Security Privateca API. -4. `Setup Authentication.`_ - -.. _Select or create a Cloud Platform project.: https://console.cloud.google.com/project -.. _Enable billing for your project.: https://cloud.google.com/billing/docs/how-to/modify-project#enable_billing_for_a_project -.. _Setup Authentication.: https://googleapis.dev/python/google-api-core/latest/auth.html - -Installation -~~~~~~~~~~~~ - -Install this library in a `virtualenv`_ using pip. `virtualenv`_ is a tool to -create isolated Python environments. The basic problem it addresses is one of -dependencies and versions, and indirectly permissions. - -With `virtualenv`_, it's possible to install this library without needing system -install permissions, and without clashing with the installed system -dependencies. - -.. _`virtualenv`: https://virtualenv.pypa.io/en/latest/ - - -Mac/Linux -^^^^^^^^^ - -.. code-block:: console - - python3 -m venv - source /bin/activate - /bin/pip install /path/to/library - - -Windows -^^^^^^^ - -.. code-block:: console - - python3 -m venv - \Scripts\activate - \Scripts\pip.exe install \path\to\library diff --git a/owl-bot-staging/v1/docs/conf.py b/owl-bot-staging/v1/docs/conf.py deleted file mode 100644 index 529fb70..0000000 --- a/owl-bot-staging/v1/docs/conf.py +++ /dev/null @@ -1,376 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# -# google-cloud-private-ca documentation build configuration file -# -# This file is execfile()d with the current directory set to its -# containing dir. -# -# Note that not all possible configuration values are present in this -# autogenerated file. -# -# All configuration values have a default; values that are commented out -# serve to show the default. - -import sys -import os -import shlex - -# If extensions (or modules to document with autodoc) are in another directory, -# add these directories to sys.path here. If the directory is relative to the -# documentation root, use os.path.abspath to make it absolute, like shown here. -sys.path.insert(0, os.path.abspath("..")) - -__version__ = "0.1.0" - -# -- General configuration ------------------------------------------------ - -# If your documentation needs a minimal Sphinx version, state it here. -needs_sphinx = "4.0.1" - -# Add any Sphinx extension module names here, as strings. They can be -# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom -# ones. -extensions = [ - "sphinx.ext.autodoc", - "sphinx.ext.autosummary", - "sphinx.ext.intersphinx", - "sphinx.ext.coverage", - "sphinx.ext.napoleon", - "sphinx.ext.todo", - "sphinx.ext.viewcode", -] - -# autodoc/autosummary flags -autoclass_content = "both" -autodoc_default_flags = ["members"] -autosummary_generate = True - - -# Add any paths that contain templates here, relative to this directory. -templates_path = ["_templates"] - -# Allow markdown includes (so releases.md can include CHANGLEOG.md) -# http://www.sphinx-doc.org/en/master/markdown.html -source_parsers = {".md": "recommonmark.parser.CommonMarkParser"} - -# The suffix(es) of source filenames. -# You can specify multiple suffix as a list of string: -source_suffix = [".rst", ".md"] - -# The encoding of source files. -# source_encoding = 'utf-8-sig' - -# The root toctree document. -root_doc = "index" - -# General information about the project. -project = u"google-cloud-private-ca" -copyright = u"2022, Google, LLC" -author = u"Google APIs" # TODO: autogenerate this bit - -# The version info for the project you're documenting, acts as replacement for -# |version| and |release|, also used in various other places throughout the -# built documents. -# -# The full version, including alpha/beta/rc tags. -release = __version__ -# The short X.Y version. -version = ".".join(release.split(".")[0:2]) - -# The language for content autogenerated by Sphinx. Refer to documentation -# for a list of supported languages. -# -# This is also used if you do content translation via gettext catalogs. -# Usually you set "language" from the command line for these cases. -language = None - -# There are two options for replacing |today|: either, you set today to some -# non-false value, then it is used: -# today = '' -# Else, today_fmt is used as the format for a strftime call. -# today_fmt = '%B %d, %Y' - -# List of patterns, relative to source directory, that match files and -# directories to ignore when looking for source files. -exclude_patterns = ["_build"] - -# The reST default role (used for this markup: `text`) to use for all -# documents. -# default_role = None - -# If true, '()' will be appended to :func: etc. cross-reference text. -# add_function_parentheses = True - -# If true, the current module name will be prepended to all description -# unit titles (such as .. function::). -# add_module_names = True - -# If true, sectionauthor and moduleauthor directives will be shown in the -# output. They are ignored by default. -# show_authors = False - -# The name of the Pygments (syntax highlighting) style to use. -pygments_style = "sphinx" - -# A list of ignored prefixes for module index sorting. -# modindex_common_prefix = [] - -# If true, keep warnings as "system message" paragraphs in the built documents. -# keep_warnings = False - -# If true, `todo` and `todoList` produce output, else they produce nothing. -todo_include_todos = True - - -# -- Options for HTML output ---------------------------------------------- - -# The theme to use for HTML and HTML Help pages. See the documentation for -# a list of builtin themes. -html_theme = "alabaster" - -# Theme options are theme-specific and customize the look and feel of a theme -# further. For a list of options available for each theme, see the -# documentation. -html_theme_options = { - "description": "Google Cloud Security Client Libraries for Python", - "github_user": "googleapis", - "github_repo": "google-cloud-python", - "github_banner": True, - "font_family": "'Roboto', Georgia, sans", - "head_font_family": "'Roboto', Georgia, serif", - "code_font_family": "'Roboto Mono', 'Consolas', monospace", -} - -# Add any paths that contain custom themes here, relative to this directory. -# html_theme_path = [] - -# The name for this set of Sphinx documents. If None, it defaults to -# " v documentation". -# html_title = None - -# A shorter title for the navigation bar. Default is the same as html_title. -# html_short_title = None - -# The name of an image file (relative to this directory) to place at the top -# of the sidebar. -# html_logo = None - -# The name of an image file (within the static path) to use as favicon of the -# docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32 -# pixels large. -# html_favicon = None - -# Add any paths that contain custom static files (such as style sheets) here, -# relative to this directory. They are copied after the builtin static files, -# so a file named "default.css" will overwrite the builtin "default.css". -html_static_path = ["_static"] - -# Add any extra paths that contain custom files (such as robots.txt or -# .htaccess) here, relative to this directory. These files are copied -# directly to the root of the documentation. -# html_extra_path = [] - -# If not '', a 'Last updated on:' timestamp is inserted at every page bottom, -# using the given strftime format. -# html_last_updated_fmt = '%b %d, %Y' - -# If true, SmartyPants will be used to convert quotes and dashes to -# typographically correct entities. -# html_use_smartypants = True - -# Custom sidebar templates, maps document names to template names. -# html_sidebars = {} - -# Additional templates that should be rendered to pages, maps page names to -# template names. -# html_additional_pages = {} - -# If false, no module index is generated. -# html_domain_indices = True - -# If false, no index is generated. -# html_use_index = True - -# If true, the index is split into individual pages for each letter. -# html_split_index = False - -# If true, links to the reST sources are added to the pages. -# html_show_sourcelink = True - -# If true, "Created using Sphinx" is shown in the HTML footer. Default is True. -# html_show_sphinx = True - -# If true, "(C) Copyright ..." is shown in the HTML footer. Default is True. -# html_show_copyright = True - -# If true, an OpenSearch description file will be output, and all pages will -# contain a tag referring to it. The value of this option must be the -# base URL from which the finished HTML is served. -# html_use_opensearch = '' - -# This is the file name suffix for HTML files (e.g. ".xhtml"). -# html_file_suffix = None - -# Language to be used for generating the HTML full-text search index. -# Sphinx supports the following languages: -# 'da', 'de', 'en', 'es', 'fi', 'fr', 'hu', 'it', 'ja' -# 'nl', 'no', 'pt', 'ro', 'ru', 'sv', 'tr' -# html_search_language = 'en' - -# A dictionary with options for the search language support, empty by default. -# Now only 'ja' uses this config value -# html_search_options = {'type': 'default'} - -# The name of a javascript file (relative to the configuration directory) that -# implements a search results scorer. If empty, the default will be used. -# html_search_scorer = 'scorer.js' - -# Output file base name for HTML help builder. -htmlhelp_basename = "google-cloud-private-ca-doc" - -# -- Options for warnings ------------------------------------------------------ - - -suppress_warnings = [ - # Temporarily suppress this to avoid "more than one target found for - # cross-reference" warning, which are intractable for us to avoid while in - # a mono-repo. - # See https://github.com/sphinx-doc/sphinx/blob - # /2a65ffeef5c107c19084fabdd706cdff3f52d93c/sphinx/domains/python.py#L843 - "ref.python" -] - -# -- Options for LaTeX output --------------------------------------------- - -latex_elements = { - # The paper size ('letterpaper' or 'a4paper'). - # 'papersize': 'letterpaper', - # The font size ('10pt', '11pt' or '12pt'). - # 'pointsize': '10pt', - # Additional stuff for the LaTeX preamble. - # 'preamble': '', - # Latex figure (float) alignment - # 'figure_align': 'htbp', -} - -# Grouping the document tree into LaTeX files. List of tuples -# (source start file, target name, title, -# author, documentclass [howto, manual, or own class]). -latex_documents = [ - ( - root_doc, - "google-cloud-private-ca.tex", - u"google-cloud-private-ca Documentation", - author, - "manual", - ) -] - -# The name of an image file (relative to this directory) to place at the top of -# the title page. -# latex_logo = None - -# For "manual" documents, if this is true, then toplevel headings are parts, -# not chapters. -# latex_use_parts = False - -# If true, show page references after internal links. -# latex_show_pagerefs = False - -# If true, show URL addresses after external links. -# latex_show_urls = False - -# Documents to append as an appendix to all manuals. -# latex_appendices = [] - -# If false, no module index is generated. -# latex_domain_indices = True - - -# -- Options for manual page output --------------------------------------- - -# One entry per manual page. List of tuples -# (source start file, name, description, authors, manual section). -man_pages = [ - ( - root_doc, - "google-cloud-private-ca", - u"Google Cloud Security Privateca Documentation", - [author], - 1, - ) -] - -# If true, show URL addresses after external links. -# man_show_urls = False - - -# -- Options for Texinfo output ------------------------------------------- - -# Grouping the document tree into Texinfo files. List of tuples -# (source start file, target name, title, author, -# dir menu entry, description, category) -texinfo_documents = [ - ( - root_doc, - "google-cloud-private-ca", - u"google-cloud-private-ca Documentation", - author, - "google-cloud-private-ca", - "GAPIC library for Google Cloud Security Privateca API", - "APIs", - ) -] - -# Documents to append as an appendix to all manuals. -# texinfo_appendices = [] - -# If false, no module index is generated. -# texinfo_domain_indices = True - -# How to display URL addresses: 'footnote', 'no', or 'inline'. -# texinfo_show_urls = 'footnote' - -# If true, do not generate a @detailmenu in the "Top" node's menu. -# texinfo_no_detailmenu = False - - -# Example configuration for intersphinx: refer to the Python standard library. -intersphinx_mapping = { - "python": ("http://python.readthedocs.org/en/latest/", None), - "gax": ("https://gax-python.readthedocs.org/en/latest/", None), - "google-auth": ("https://google-auth.readthedocs.io/en/stable", None), - "google-gax": ("https://gax-python.readthedocs.io/en/latest/", None), - "google.api_core": ("https://googleapis.dev/python/google-api-core/latest/", None), - "grpc": ("https://grpc.io/grpc/python/", None), - "requests": ("http://requests.kennethreitz.org/en/stable/", None), - "proto": ("https://proto-plus-python.readthedocs.io/en/stable", None), - "protobuf": ("https://googleapis.dev/python/protobuf/latest/", None), -} - - -# Napoleon settings -napoleon_google_docstring = True -napoleon_numpy_docstring = True -napoleon_include_private_with_doc = False -napoleon_include_special_with_doc = True -napoleon_use_admonition_for_examples = False -napoleon_use_admonition_for_notes = False -napoleon_use_admonition_for_references = False -napoleon_use_ivar = False -napoleon_use_param = True -napoleon_use_rtype = True diff --git a/owl-bot-staging/v1/docs/index.rst b/owl-bot-staging/v1/docs/index.rst deleted file mode 100644 index eadcd6d..0000000 --- a/owl-bot-staging/v1/docs/index.rst +++ /dev/null @@ -1,7 +0,0 @@ -API Reference -------------- -.. toctree:: - :maxdepth: 2 - - privateca_v1/services - privateca_v1/types diff --git a/owl-bot-staging/v1/docs/privateca_v1/certificate_authority_service.rst b/owl-bot-staging/v1/docs/privateca_v1/certificate_authority_service.rst deleted file mode 100644 index 00601bc..0000000 --- a/owl-bot-staging/v1/docs/privateca_v1/certificate_authority_service.rst +++ /dev/null @@ -1,10 +0,0 @@ -CertificateAuthorityService ---------------------------------------------- - -.. automodule:: google.cloud.security.privateca_v1.services.certificate_authority_service - :members: - :inherited-members: - -.. automodule:: google.cloud.security.privateca_v1.services.certificate_authority_service.pagers - :members: - :inherited-members: diff --git a/owl-bot-staging/v1/docs/privateca_v1/services.rst b/owl-bot-staging/v1/docs/privateca_v1/services.rst deleted file mode 100644 index 6b8d380..0000000 --- a/owl-bot-staging/v1/docs/privateca_v1/services.rst +++ /dev/null @@ -1,6 +0,0 @@ -Services for Google Cloud Security Privateca v1 API -=================================================== -.. toctree:: - :maxdepth: 2 - - certificate_authority_service diff --git a/owl-bot-staging/v1/docs/privateca_v1/types.rst b/owl-bot-staging/v1/docs/privateca_v1/types.rst deleted file mode 100644 index feda2ff..0000000 --- a/owl-bot-staging/v1/docs/privateca_v1/types.rst +++ /dev/null @@ -1,6 +0,0 @@ -Types for Google Cloud Security Privateca v1 API -================================================ - -.. automodule:: google.cloud.security.privateca_v1.types - :members: - :show-inheritance: diff --git a/owl-bot-staging/v1/google/cloud/security/privateca/__init__.py b/owl-bot-staging/v1/google/cloud/security/privateca/__init__.py deleted file mode 100644 index 38ab9b6..0000000 --- a/owl-bot-staging/v1/google/cloud/security/privateca/__init__.py +++ /dev/null @@ -1,139 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -from google.cloud.security.privateca import gapic_version as package_version - -__version__ = package_version.__version__ - - -from google.cloud.security.privateca_v1.services.certificate_authority_service.client import CertificateAuthorityServiceClient -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_v1.types.service import CreateCaPoolRequest -from google.cloud.security.privateca_v1.types.service import CreateCertificateAuthorityRequest -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_v1.types.service import DeleteCertificateTemplateRequest -from google.cloud.security.privateca_v1.types.service import DisableCertificateAuthorityRequest -from google.cloud.security.privateca_v1.types.service import EnableCertificateAuthorityRequest -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_v1.types.service import FetchCertificateAuthorityCsrResponse -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_v1.types.service import GetCertificateRequest -from google.cloud.security.privateca_v1.types.service import GetCertificateRevocationListRequest -from google.cloud.security.privateca_v1.types.service import GetCertificateTemplateRequest -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_v1.types.service import ListCertificateAuthoritiesResponse -from google.cloud.security.privateca_v1.types.service import ListCertificateRevocationListsRequest -from google.cloud.security.privateca_v1.types.service import ListCertificateRevocationListsResponse -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_v1.types.service import ListCertificateTemplatesResponse -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_v1.types.service import UpdateCaPoolRequest -from google.cloud.security.privateca_v1.types.service import UpdateCertificateAuthorityRequest -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__ = ('CertificateAuthorityServiceClient', - 'CertificateAuthorityServiceAsyncClient', - 'CaPool', - 'Certificate', - 'CertificateAuthority', - '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', - 'GetCertificateTemplateRequest', - 'ListCaPoolsRequest', - 'ListCaPoolsResponse', - 'ListCertificateAuthoritiesRequest', - 'ListCertificateAuthoritiesResponse', - 'ListCertificateRevocationListsRequest', - 'ListCertificateRevocationListsResponse', - 'ListCertificatesRequest', - 'ListCertificatesResponse', - 'ListCertificateTemplatesRequest', - 'ListCertificateTemplatesResponse', - 'OperationMetadata', - 'RevokeCertificateRequest', - 'UndeleteCertificateAuthorityRequest', - 'UpdateCaPoolRequest', - 'UpdateCertificateAuthorityRequest', - 'UpdateCertificateRequest', - 'UpdateCertificateRevocationListRequest', - 'UpdateCertificateTemplateRequest', -) diff --git a/owl-bot-staging/v1/google/cloud/security/privateca/gapic_version.py b/owl-bot-staging/v1/google/cloud/security/privateca/gapic_version.py deleted file mode 100644 index 405b1ce..0000000 --- a/owl-bot-staging/v1/google/cloud/security/privateca/gapic_version.py +++ /dev/null @@ -1,16 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -__version__ = "0.1.0" # {x-release-please-version} diff --git a/owl-bot-staging/v1/google/cloud/security/privateca/py.typed b/owl-bot-staging/v1/google/cloud/security/privateca/py.typed deleted file mode 100644 index 2803606..0000000 --- a/owl-bot-staging/v1/google/cloud/security/privateca/py.typed +++ /dev/null @@ -1,2 +0,0 @@ -# Marker file for PEP 561. -# The google-cloud-private-ca package uses inline types. diff --git a/owl-bot-staging/v1/google/cloud/security/privateca_v1/__init__.py b/owl-bot-staging/v1/google/cloud/security/privateca_v1/__init__.py deleted file mode 100644 index eb16df3..0000000 --- a/owl-bot-staging/v1/google/cloud/security/privateca_v1/__init__.py +++ /dev/null @@ -1,140 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -from google.cloud.security.privateca_v1 import gapic_version as package_version - -__version__ = package_version.__version__ - - -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 -from .types.resources import CertificateConfig -from .types.resources import CertificateDescription -from .types.resources import CertificateExtensionConstraints -from .types.resources import CertificateIdentityConstraints -from .types.resources import CertificateRevocationList -from .types.resources import CertificateTemplate -from .types.resources import KeyUsage -from .types.resources import ObjectId -from .types.resources import PublicKey -from .types.resources import Subject -from .types.resources import SubjectAltNames -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 -from .types.service import CreateCertificateRequest -from .types.service import CreateCertificateTemplateRequest -from .types.service import DeleteCaPoolRequest -from .types.service import DeleteCertificateAuthorityRequest -from .types.service import DeleteCertificateTemplateRequest -from .types.service import DisableCertificateAuthorityRequest -from .types.service import EnableCertificateAuthorityRequest -from .types.service import FetchCaCertsRequest -from .types.service import FetchCaCertsResponse -from .types.service import FetchCertificateAuthorityCsrRequest -from .types.service import FetchCertificateAuthorityCsrResponse -from .types.service import GetCaPoolRequest -from .types.service import GetCertificateAuthorityRequest -from .types.service import GetCertificateRequest -from .types.service import GetCertificateRevocationListRequest -from .types.service import GetCertificateTemplateRequest -from .types.service import ListCaPoolsRequest -from .types.service import ListCaPoolsResponse -from .types.service import ListCertificateAuthoritiesRequest -from .types.service import ListCertificateAuthoritiesResponse -from .types.service import ListCertificateRevocationListsRequest -from .types.service import ListCertificateRevocationListsResponse -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 -from .types.service import UpdateCaPoolRequest -from .types.service import UpdateCertificateAuthorityRequest -from .types.service import UpdateCertificateRequest -from .types.service import UpdateCertificateRevocationListRequest -from .types.service import UpdateCertificateTemplateRequest - -__all__ = ( - 'CertificateAuthorityServiceAsyncClient', -'ActivateCertificateAuthorityRequest', -'CaPool', -'Certificate', -'CertificateAuthority', -'CertificateAuthorityServiceClient', -'CertificateConfig', -'CertificateDescription', -'CertificateExtensionConstraints', -'CertificateIdentityConstraints', -'CertificateRevocationList', -'CertificateTemplate', -'CreateCaPoolRequest', -'CreateCertificateAuthorityRequest', -'CreateCertificateRequest', -'CreateCertificateTemplateRequest', -'DeleteCaPoolRequest', -'DeleteCertificateAuthorityRequest', -'DeleteCertificateTemplateRequest', -'DisableCertificateAuthorityRequest', -'EnableCertificateAuthorityRequest', -'FetchCaCertsRequest', -'FetchCaCertsResponse', -'FetchCertificateAuthorityCsrRequest', -'FetchCertificateAuthorityCsrResponse', -'GetCaPoolRequest', -'GetCertificateAuthorityRequest', -'GetCertificateRequest', -'GetCertificateRevocationListRequest', -'GetCertificateTemplateRequest', -'KeyUsage', -'ListCaPoolsRequest', -'ListCaPoolsResponse', -'ListCertificateAuthoritiesRequest', -'ListCertificateAuthoritiesResponse', -'ListCertificateRevocationListsRequest', -'ListCertificateRevocationListsResponse', -'ListCertificateTemplatesRequest', -'ListCertificateTemplatesResponse', -'ListCertificatesRequest', -'ListCertificatesResponse', -'ObjectId', -'OperationMetadata', -'PublicKey', -'RevocationReason', -'RevokeCertificateRequest', -'Subject', -'SubjectAltNames', -'SubjectRequestMode', -'SubordinateConfig', -'UndeleteCertificateAuthorityRequest', -'UpdateCaPoolRequest', -'UpdateCertificateAuthorityRequest', -'UpdateCertificateRequest', -'UpdateCertificateRevocationListRequest', -'UpdateCertificateTemplateRequest', -'X509Extension', -'X509Parameters', -) diff --git a/owl-bot-staging/v1/google/cloud/security/privateca_v1/gapic_metadata.json b/owl-bot-staging/v1/google/cloud/security/privateca_v1/gapic_metadata.json deleted file mode 100644 index 9eb6757..0000000 --- a/owl-bot-staging/v1/google/cloud/security/privateca_v1/gapic_metadata.json +++ /dev/null @@ -1,313 +0,0 @@ - { - "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/owl-bot-staging/v1/google/cloud/security/privateca_v1/gapic_version.py b/owl-bot-staging/v1/google/cloud/security/privateca_v1/gapic_version.py deleted file mode 100644 index 405b1ce..0000000 --- a/owl-bot-staging/v1/google/cloud/security/privateca_v1/gapic_version.py +++ /dev/null @@ -1,16 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -__version__ = "0.1.0" # {x-release-please-version} diff --git a/owl-bot-staging/v1/google/cloud/security/privateca_v1/py.typed b/owl-bot-staging/v1/google/cloud/security/privateca_v1/py.typed deleted file mode 100644 index 2803606..0000000 --- a/owl-bot-staging/v1/google/cloud/security/privateca_v1/py.typed +++ /dev/null @@ -1,2 +0,0 @@ -# Marker file for PEP 561. -# The google-cloud-private-ca package uses inline types. diff --git a/owl-bot-staging/v1/google/cloud/security/privateca_v1/services/__init__.py b/owl-bot-staging/v1/google/cloud/security/privateca_v1/services/__init__.py deleted file mode 100644 index e8e1c38..0000000 --- a/owl-bot-staging/v1/google/cloud/security/privateca_v1/services/__init__.py +++ /dev/null @@ -1,15 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# diff --git a/owl-bot-staging/v1/google/cloud/security/privateca_v1/services/certificate_authority_service/__init__.py b/owl-bot-staging/v1/google/cloud/security/privateca_v1/services/certificate_authority_service/__init__.py deleted file mode 100644 index 713bfd9..0000000 --- a/owl-bot-staging/v1/google/cloud/security/privateca_v1/services/certificate_authority_service/__init__.py +++ /dev/null @@ -1,22 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -from .client import CertificateAuthorityServiceClient -from .async_client import CertificateAuthorityServiceAsyncClient - -__all__ = ( - 'CertificateAuthorityServiceClient', - 'CertificateAuthorityServiceAsyncClient', -) diff --git a/owl-bot-staging/v1/google/cloud/security/privateca_v1/services/certificate_authority_service/async_client.py b/owl-bot-staging/v1/google/cloud/security/privateca_v1/services/certificate_authority_service/async_client.py deleted file mode 100644 index f46cfa8..0000000 --- a/owl-bot-staging/v1/google/cloud/security/privateca_v1/services/certificate_authority_service/async_client.py +++ /dev/null @@ -1,3752 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -from collections import OrderedDict -import functools -import re -from typing import Dict, Mapping, MutableMapping, MutableSequence, Optional, Sequence, Tuple, Type, Union - -from google.cloud.security.privateca_v1 import gapic_version as package_version - -from google.api_core.client_options import ClientOptions -from google.api_core import exceptions as core_exceptions -from google.api_core import gapic_v1 -from google.api_core import retry as retries -from google.auth import credentials as ga_credentials # type: ignore -from google.oauth2 import service_account # type: ignore - -try: - OptionalRetry = Union[retries.Retry, gapic_v1.method._MethodDefault] -except AttributeError: # pragma: NO COVER - OptionalRetry = Union[retries.Retry, object] # type: ignore - -from google.api_core import operation # type: ignore -from google.api_core import operation_async # type: ignore -from google.cloud.security.privateca_v1.services.certificate_authority_service import pagers -from google.cloud.security.privateca_v1.types import resources -from google.cloud.security.privateca_v1.types import service -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 - - -class CertificateAuthorityServiceAsyncClient: - """[Certificate Authority - Service][google.cloud.security.privateca.v1.CertificateAuthorityService] - manages private certificate authorities and issued certificates. - """ - - _client: CertificateAuthorityServiceClient - - DEFAULT_ENDPOINT = CertificateAuthorityServiceClient.DEFAULT_ENDPOINT - DEFAULT_MTLS_ENDPOINT = CertificateAuthorityServiceClient.DEFAULT_MTLS_ENDPOINT - - ca_pool_path = staticmethod(CertificateAuthorityServiceClient.ca_pool_path) - parse_ca_pool_path = staticmethod(CertificateAuthorityServiceClient.parse_ca_pool_path) - certificate_path = staticmethod(CertificateAuthorityServiceClient.certificate_path) - parse_certificate_path = staticmethod(CertificateAuthorityServiceClient.parse_certificate_path) - certificate_authority_path = staticmethod(CertificateAuthorityServiceClient.certificate_authority_path) - parse_certificate_authority_path = staticmethod(CertificateAuthorityServiceClient.parse_certificate_authority_path) - certificate_revocation_list_path = staticmethod(CertificateAuthorityServiceClient.certificate_revocation_list_path) - parse_certificate_revocation_list_path = staticmethod(CertificateAuthorityServiceClient.parse_certificate_revocation_list_path) - certificate_template_path = staticmethod(CertificateAuthorityServiceClient.certificate_template_path) - 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) - parse_common_location_path = staticmethod(CertificateAuthorityServiceClient.parse_common_location_path) - - @classmethod - def from_service_account_info(cls, info: dict, *args, **kwargs): - """Creates an instance of this client using the provided credentials - info. - - Args: - info (dict): The service account private key info. - args: Additional arguments to pass to the constructor. - kwargs: Additional arguments to pass to the constructor. - - Returns: - CertificateAuthorityServiceAsyncClient: The constructed client. - """ - return CertificateAuthorityServiceClient.from_service_account_info.__func__(CertificateAuthorityServiceAsyncClient, info, *args, **kwargs) # type: ignore - - @classmethod - def from_service_account_file(cls, filename: str, *args, **kwargs): - """Creates an instance of this client using the provided credentials - file. - - Args: - filename (str): The path to the service account private key json - file. - args: Additional arguments to pass to the constructor. - kwargs: Additional arguments to pass to the constructor. - - Returns: - CertificateAuthorityServiceAsyncClient: The constructed client. - """ - return CertificateAuthorityServiceClient.from_service_account_file.__func__(CertificateAuthorityServiceAsyncClient, filename, *args, **kwargs) # type: ignore - - from_service_account_json = from_service_account_file - - @classmethod - def get_mtls_endpoint_and_cert_source(cls, client_options: Optional[ClientOptions] = None): - """Return the API endpoint and client cert source for mutual TLS. - - The client cert source is determined in the following order: - (1) if `GOOGLE_API_USE_CLIENT_CERTIFICATE` environment variable is not "true", the - client cert source is None. - (2) if `client_options.client_cert_source` is provided, use the provided one; if the - default client cert source exists, use the default one; otherwise the client cert - source is None. - - The API endpoint is determined in the following order: - (1) if `client_options.api_endpoint` if provided, use the provided one. - (2) if `GOOGLE_API_USE_CLIENT_CERTIFICATE` environment variable is "always", use the - default mTLS endpoint; if the environment variable is "never", use the default API - endpoint; otherwise if client cert source exists, use the default mTLS endpoint, otherwise - use the default API endpoint. - - More details can be found at https://google.aip.dev/auth/4114. - - Args: - client_options (google.api_core.client_options.ClientOptions): Custom options for the - client. Only the `api_endpoint` and `client_cert_source` properties may be used - in this method. - - Returns: - Tuple[str, Callable[[], Tuple[bytes, bytes]]]: returns the API endpoint and the - client cert source to use. - - Raises: - google.auth.exceptions.MutualTLSChannelError: If any errors happen. - """ - return CertificateAuthorityServiceClient.get_mtls_endpoint_and_cert_source(client_options) # type: ignore - - @property - def transport(self) -> CertificateAuthorityServiceTransport: - """Returns the transport used by the client instance. - - Returns: - CertificateAuthorityServiceTransport: The transport used by the client instance. - """ - return self._client.transport - - get_transport_class = functools.partial(type(CertificateAuthorityServiceClient).get_transport_class, type(CertificateAuthorityServiceClient)) - - def __init__(self, *, - credentials: Optional[ga_credentials.Credentials] = None, - transport: Union[str, CertificateAuthorityServiceTransport] = "grpc_asyncio", - client_options: Optional[ClientOptions] = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - ) -> None: - """Instantiates the certificate authority service client. - - Args: - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - transport (Union[str, ~.CertificateAuthorityServiceTransport]): The - transport to use. If set to None, a transport is chosen - automatically. - client_options (ClientOptions): Custom options for the client. It - won't take effect if a ``transport`` instance is provided. - (1) The ``api_endpoint`` property can be used to override the - default endpoint provided by the client. GOOGLE_API_USE_MTLS_ENDPOINT - environment variable can also be used to override the endpoint: - "always" (always use the default mTLS endpoint), "never" (always - use the default regular endpoint) and "auto" (auto switch to the - default mTLS endpoint if client certificate is present, this is - the default value). However, the ``api_endpoint`` property takes - precedence if provided. - (2) If GOOGLE_API_USE_CLIENT_CERTIFICATE environment variable - is "true", then the ``client_cert_source`` property can be used - to provide client certificate for mutual TLS transport. If - not provided, the default SSL client certificate will be used if - present. If GOOGLE_API_USE_CLIENT_CERTIFICATE is "false" or not - set, no client certificate will be used. - - Raises: - google.auth.exceptions.MutualTlsChannelError: If mutual TLS transport - creation failed for any reason. - """ - self._client = CertificateAuthorityServiceClient( - credentials=credentials, - transport=transport, - client_options=client_options, - client_info=client_info, - - ) - - async def create_certificate(self, - request: Optional[Union[service.CreateCertificateRequest, dict]] = None, - *, - parent: Optional[str] = None, - certificate: Optional[resources.Certificate] = None, - certificate_id: Optional[str] = None, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), - ) -> resources.Certificate: - r"""Create a new - [Certificate][google.cloud.security.privateca.v1.Certificate] in - a given Project, Location from a particular - [CaPool][google.cloud.security.privateca.v1.CaPool]. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud.security import privateca_v1 - - async def sample_create_certificate(): - # Create a client - client = privateca_v1.CertificateAuthorityServiceAsyncClient() - - # Initialize request argument(s) - certificate = privateca_v1.Certificate() - certificate.pem_csr = "pem_csr_value" - - request = privateca_v1.CreateCertificateRequest( - parent="parent_value", - certificate=certificate, - ) - - # Make the request - response = await client.create_certificate(request=request) - - # Handle the response - print(response) - - Args: - request (Optional[Union[google.cloud.security.privateca_v1.types.CreateCertificateRequest, dict]]): - The request object. Request message for - [CertificateAuthorityService.CreateCertificate][google.cloud.security.privateca.v1.CertificateAuthorityService.CreateCertificate]. - parent (:class:`str`): - Required. The resource name of the - [CaPool][google.cloud.security.privateca.v1.CaPool] - associated with the - [Certificate][google.cloud.security.privateca.v1.Certificate], - in the format ``projects/*/locations/*/caPools/*``. - - This corresponds to the ``parent`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - certificate (:class:`google.cloud.security.privateca_v1.types.Certificate`): - Required. A - [Certificate][google.cloud.security.privateca.v1.Certificate] - with initial field values. - - This corresponds to the ``certificate`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - certificate_id (:class:`str`): - Optional. It must be unique within a location and match - the regular expression ``[a-zA-Z0-9_-]{1,63}``. This - field is required when using a - [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority] - in the Enterprise [CertificateAuthority.Tier][], but is - optional and its value is ignored otherwise. - - 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. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.cloud.security.privateca_v1.types.Certificate: - A [Certificate][google.cloud.security.privateca.v1.Certificate] corresponds to a signed X.509 certificate issued by a - [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority]. - - """ - # Create or coerce a protobuf request object. - # Quick check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - has_flattened_params = any([parent, certificate, certificate_id]) - if request is not None and has_flattened_params: - raise ValueError("If the `request` argument is set, then none of " - "the individual field arguments should be set.") - - 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: - request.certificate = certificate - if certificate_id is not None: - request.certificate_id = certificate_id - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = gapic_v1.method_async.wrap_method( - self._client._transport.create_certificate, - default_timeout=None, - client_info=DEFAULT_CLIENT_INFO, - ) - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata(( - ("parent", request.parent), - )), - ) - - # Send the request. - response = await rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Done; return the response. - return response - - async def get_certificate(self, - request: Optional[Union[service.GetCertificateRequest, dict]] = None, - *, - name: Optional[str] = None, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), - ) -> resources.Certificate: - r"""Returns a - [Certificate][google.cloud.security.privateca.v1.Certificate]. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud.security import privateca_v1 - - async def sample_get_certificate(): - # Create a client - client = privateca_v1.CertificateAuthorityServiceAsyncClient() - - # Initialize request argument(s) - request = privateca_v1.GetCertificateRequest( - name="name_value", - ) - - # Make the request - response = await client.get_certificate(request=request) - - # Handle the response - print(response) - - Args: - request (Optional[Union[google.cloud.security.privateca_v1.types.GetCertificateRequest, dict]]): - The request object. Request message for - [CertificateAuthorityService.GetCertificate][google.cloud.security.privateca.v1.CertificateAuthorityService.GetCertificate]. - name (:class:`str`): - Required. The - [name][google.cloud.security.privateca.v1.Certificate.name] - of the - [Certificate][google.cloud.security.privateca.v1.Certificate] - to get. - - 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. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.cloud.security.privateca_v1.types.Certificate: - A [Certificate][google.cloud.security.privateca.v1.Certificate] corresponds to a signed X.509 certificate issued by a - [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority]. - - """ - # Create or coerce a protobuf request object. - # Quick check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - has_flattened_params = any([name]) - if request is not None and has_flattened_params: - raise ValueError("If the `request` argument is set, then none of " - "the individual field arguments should be set.") - - 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 - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = gapic_v1.method_async.wrap_method( - self._client._transport.get_certificate, - default_timeout=None, - client_info=DEFAULT_CLIENT_INFO, - ) - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata(( - ("name", request.name), - )), - ) - - # Send the request. - response = await rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Done; return the response. - return response - - async def list_certificates(self, - request: Optional[Union[service.ListCertificatesRequest, dict]] = None, - *, - parent: Optional[str] = None, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), - ) -> pagers.ListCertificatesAsyncPager: - r"""Lists - [Certificates][google.cloud.security.privateca.v1.Certificate]. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud.security import privateca_v1 - - async def sample_list_certificates(): - # Create a client - client = privateca_v1.CertificateAuthorityServiceAsyncClient() - - # Initialize request argument(s) - request = privateca_v1.ListCertificatesRequest( - parent="parent_value", - ) - - # Make the request - page_result = client.list_certificates(request=request) - - # Handle the response - async for response in page_result: - print(response) - - Args: - request (Optional[Union[google.cloud.security.privateca_v1.types.ListCertificatesRequest, dict]]): - The request object. Request message for - [CertificateAuthorityService.ListCertificates][google.cloud.security.privateca.v1.CertificateAuthorityService.ListCertificates]. - parent (:class:`str`): - Required. The resource name of the location associated - with the - [Certificates][google.cloud.security.privateca.v1.Certificate], - in the format ``projects/*/locations/*/caPools/*``. - - 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. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.cloud.security.privateca_v1.services.certificate_authority_service.pagers.ListCertificatesAsyncPager: - Response message for - [CertificateAuthorityService.ListCertificates][google.cloud.security.privateca.v1.CertificateAuthorityService.ListCertificates]. - - Iterating over this object will yield results and - resolve additional pages automatically. - - """ - # Create or coerce a protobuf request object. - # Quick check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - has_flattened_params = any([parent]) - if request is not None and has_flattened_params: - raise ValueError("If the `request` argument is set, then none of " - "the individual field arguments should be set.") - - 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 - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = gapic_v1.method_async.wrap_method( - self._client._transport.list_certificates, - default_timeout=None, - client_info=DEFAULT_CLIENT_INFO, - ) - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata(( - ("parent", request.parent), - )), - ) - - # Send the request. - response = await rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # This method is paged; wrap the response in a pager, which provides - # an `__aiter__` convenience method. - response = pagers.ListCertificatesAsyncPager( - method=rpc, - request=request, - response=response, - metadata=metadata, - ) - - # Done; return the response. - return response - - async def revoke_certificate(self, - request: Optional[Union[service.RevokeCertificateRequest, dict]] = None, - *, - name: Optional[str] = None, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), - ) -> resources.Certificate: - r"""Revoke a - [Certificate][google.cloud.security.privateca.v1.Certificate]. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud.security import privateca_v1 - - async def sample_revoke_certificate(): - # Create a client - client = privateca_v1.CertificateAuthorityServiceAsyncClient() - - # Initialize request argument(s) - request = privateca_v1.RevokeCertificateRequest( - name="name_value", - reason="ATTRIBUTE_AUTHORITY_COMPROMISE", - ) - - # Make the request - response = await client.revoke_certificate(request=request) - - # Handle the response - print(response) - - Args: - request (Optional[Union[google.cloud.security.privateca_v1.types.RevokeCertificateRequest, dict]]): - The request object. Request message for - [CertificateAuthorityService.RevokeCertificate][google.cloud.security.privateca.v1.CertificateAuthorityService.RevokeCertificate]. - name (:class:`str`): - Required. The resource name for this - [Certificate][google.cloud.security.privateca.v1.Certificate] - in the format - ``projects/*/locations/*/caPools/*/certificates/*``. - - 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. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.cloud.security.privateca_v1.types.Certificate: - A [Certificate][google.cloud.security.privateca.v1.Certificate] corresponds to a signed X.509 certificate issued by a - [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority]. - - """ - # Create or coerce a protobuf request object. - # Quick check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - has_flattened_params = any([name]) - if request is not None and has_flattened_params: - raise ValueError("If the `request` argument is set, then none of " - "the individual field arguments should be set.") - - 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 - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = gapic_v1.method_async.wrap_method( - self._client._transport.revoke_certificate, - default_timeout=None, - client_info=DEFAULT_CLIENT_INFO, - ) - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata(( - ("name", request.name), - )), - ) - - # Send the request. - response = await rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Done; return the response. - return response - - async def update_certificate(self, - request: Optional[Union[service.UpdateCertificateRequest, dict]] = None, - *, - certificate: Optional[resources.Certificate] = None, - update_mask: Optional[field_mask_pb2.FieldMask] = None, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), - ) -> resources.Certificate: - r"""Update a - [Certificate][google.cloud.security.privateca.v1.Certificate]. - Currently, the only field you can update is the - [labels][google.cloud.security.privateca.v1.Certificate.labels] - field. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud.security import privateca_v1 - - async def sample_update_certificate(): - # Create a client - client = privateca_v1.CertificateAuthorityServiceAsyncClient() - - # Initialize request argument(s) - certificate = privateca_v1.Certificate() - certificate.pem_csr = "pem_csr_value" - - request = privateca_v1.UpdateCertificateRequest( - certificate=certificate, - ) - - # Make the request - response = await client.update_certificate(request=request) - - # Handle the response - print(response) - - Args: - request (Optional[Union[google.cloud.security.privateca_v1.types.UpdateCertificateRequest, dict]]): - The request object. Request message for - [CertificateAuthorityService.UpdateCertificate][google.cloud.security.privateca.v1.CertificateAuthorityService.UpdateCertificate]. - certificate (:class:`google.cloud.security.privateca_v1.types.Certificate`): - Required. - [Certificate][google.cloud.security.privateca.v1.Certificate] - with updated values. - - This corresponds to the ``certificate`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - update_mask (:class:`google.protobuf.field_mask_pb2.FieldMask`): - Required. A list of fields to be - updated in this request. - - 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. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.cloud.security.privateca_v1.types.Certificate: - A [Certificate][google.cloud.security.privateca.v1.Certificate] corresponds to a signed X.509 certificate issued by a - [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority]. - - """ - # Create or coerce a protobuf request object. - # Quick check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - has_flattened_params = any([certificate, update_mask]) - if request is not None and has_flattened_params: - raise ValueError("If the `request` argument is set, then none of " - "the individual field arguments should be set.") - - 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: - request.update_mask = update_mask - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = gapic_v1.method_async.wrap_method( - self._client._transport.update_certificate, - default_timeout=None, - client_info=DEFAULT_CLIENT_INFO, - ) - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata(( - ("certificate.name", request.certificate.name), - )), - ) - - # Send the request. - response = await rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Done; return the response. - return response - - async def activate_certificate_authority(self, - request: Optional[Union[service.ActivateCertificateAuthorityRequest, dict]] = None, - *, - name: Optional[str] = None, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), - ) -> operation_async.AsyncOperation: - r"""Activate a - [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority] - that is in state - [AWAITING_USER_ACTIVATION][google.cloud.security.privateca.v1.CertificateAuthority.State.AWAITING_USER_ACTIVATION] - and is of type - [SUBORDINATE][google.cloud.security.privateca.v1.CertificateAuthority.Type.SUBORDINATE]. - After the parent Certificate Authority signs a certificate - signing request from - [FetchCertificateAuthorityCsr][google.cloud.security.privateca.v1.CertificateAuthorityService.FetchCertificateAuthorityCsr], - this method can complete the activation process. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud.security import privateca_v1 - - async def sample_activate_certificate_authority(): - # Create a client - client = privateca_v1.CertificateAuthorityServiceAsyncClient() - - # Initialize request argument(s) - subordinate_config = privateca_v1.SubordinateConfig() - subordinate_config.certificate_authority = "certificate_authority_value" - - request = privateca_v1.ActivateCertificateAuthorityRequest( - name="name_value", - pem_ca_certificate="pem_ca_certificate_value", - subordinate_config=subordinate_config, - ) - - # Make the request - operation = client.activate_certificate_authority(request=request) - - print("Waiting for operation to complete...") - - response = (await operation).result() - - # Handle the response - print(response) - - Args: - request (Optional[Union[google.cloud.security.privateca_v1.types.ActivateCertificateAuthorityRequest, dict]]): - The request object. Request message for - [CertificateAuthorityService.ActivateCertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthorityService.ActivateCertificateAuthority]. - name (:class:`str`): - Required. The resource name for this - [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority] - in the format - ``projects/*/locations/*/caPools/*/certificateAuthorities/*``. - - 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. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.api_core.operation_async.AsyncOperation: - An object representing a long-running operation. - - The result type for the operation will be :class:`google.cloud.security.privateca_v1.types.CertificateAuthority` A [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority] represents an individual Certificate Authority. - A - [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority] - can be used to create - [Certificates][google.cloud.security.privateca.v1.Certificate]. - - """ - # Create or coerce a protobuf request object. - # Quick check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - has_flattened_params = any([name]) - if request is not None and has_flattened_params: - raise ValueError("If the `request` argument is set, then none of " - "the individual field arguments should be set.") - - 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 - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = gapic_v1.method_async.wrap_method( - self._client._transport.activate_certificate_authority, - default_timeout=None, - client_info=DEFAULT_CLIENT_INFO, - ) - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata(( - ("name", request.name), - )), - ) - - # Send the request. - response = await rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Wrap the response in an operation future. - response = operation_async.from_gapic( - response, - self._client._transport.operations_client, - resources.CertificateAuthority, - metadata_type=service.OperationMetadata, - ) - - # Done; return the response. - return response - - async def create_certificate_authority(self, - request: Optional[Union[service.CreateCertificateAuthorityRequest, dict]] = None, - *, - parent: Optional[str] = None, - certificate_authority: Optional[resources.CertificateAuthority] = None, - certificate_authority_id: Optional[str] = None, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), - ) -> operation_async.AsyncOperation: - r"""Create a new - [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority] - in a given Project and Location. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud.security import privateca_v1 - - async def sample_create_certificate_authority(): - # Create a client - client = privateca_v1.CertificateAuthorityServiceAsyncClient() - - # Initialize request argument(s) - certificate_authority = privateca_v1.CertificateAuthority() - certificate_authority.type_ = "SUBORDINATE" - certificate_authority.key_spec.cloud_kms_key_version = "cloud_kms_key_version_value" - - request = privateca_v1.CreateCertificateAuthorityRequest( - parent="parent_value", - certificate_authority_id="certificate_authority_id_value", - certificate_authority=certificate_authority, - ) - - # Make the request - operation = client.create_certificate_authority(request=request) - - print("Waiting for operation to complete...") - - response = (await operation).result() - - # Handle the response - print(response) - - Args: - request (Optional[Union[google.cloud.security.privateca_v1.types.CreateCertificateAuthorityRequest, dict]]): - The request object. Request message for - [CertificateAuthorityService.CreateCertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthorityService.CreateCertificateAuthority]. - parent (:class:`str`): - Required. The resource name of the - [CaPool][google.cloud.security.privateca.v1.CaPool] - associated with the - [CertificateAuthorities][google.cloud.security.privateca.v1.CertificateAuthority], - in the format ``projects/*/locations/*/caPools/*``. - - This corresponds to the ``parent`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - certificate_authority (:class:`google.cloud.security.privateca_v1.types.CertificateAuthority`): - Required. A - [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority] - with initial field values. - - This corresponds to the ``certificate_authority`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - certificate_authority_id (:class:`str`): - Required. It must be unique within a location and match - the regular expression ``[a-zA-Z0-9_-]{1,63}`` - - 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. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.api_core.operation_async.AsyncOperation: - An object representing a long-running operation. - - The result type for the operation will be :class:`google.cloud.security.privateca_v1.types.CertificateAuthority` A [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority] represents an individual Certificate Authority. - A - [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority] - can be used to create - [Certificates][google.cloud.security.privateca.v1.Certificate]. - - """ - # Create or coerce a protobuf request object. - # Quick check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - has_flattened_params = any([parent, certificate_authority, certificate_authority_id]) - if request is not None and has_flattened_params: - raise ValueError("If the `request` argument is set, then none of " - "the individual field arguments should be set.") - - 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: - request.certificate_authority = certificate_authority - if certificate_authority_id is not None: - request.certificate_authority_id = certificate_authority_id - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = gapic_v1.method_async.wrap_method( - self._client._transport.create_certificate_authority, - default_timeout=None, - client_info=DEFAULT_CLIENT_INFO, - ) - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata(( - ("parent", request.parent), - )), - ) - - # Send the request. - response = await rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Wrap the response in an operation future. - response = operation_async.from_gapic( - response, - self._client._transport.operations_client, - resources.CertificateAuthority, - metadata_type=service.OperationMetadata, - ) - - # Done; return the response. - return response - - async def disable_certificate_authority(self, - request: Optional[Union[service.DisableCertificateAuthorityRequest, dict]] = None, - *, - name: Optional[str] = None, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), - ) -> operation_async.AsyncOperation: - r"""Disable a - [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority]. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud.security import privateca_v1 - - async def sample_disable_certificate_authority(): - # Create a client - client = privateca_v1.CertificateAuthorityServiceAsyncClient() - - # Initialize request argument(s) - request = privateca_v1.DisableCertificateAuthorityRequest( - name="name_value", - ) - - # Make the request - operation = client.disable_certificate_authority(request=request) - - print("Waiting for operation to complete...") - - response = (await operation).result() - - # Handle the response - print(response) - - Args: - request (Optional[Union[google.cloud.security.privateca_v1.types.DisableCertificateAuthorityRequest, dict]]): - The request object. Request message for - [CertificateAuthorityService.DisableCertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthorityService.DisableCertificateAuthority]. - name (:class:`str`): - Required. The resource name for this - [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority] - in the format - ``projects/*/locations/*/caPools/*/certificateAuthorities/*``. - - 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. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.api_core.operation_async.AsyncOperation: - An object representing a long-running operation. - - The result type for the operation will be :class:`google.cloud.security.privateca_v1.types.CertificateAuthority` A [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority] represents an individual Certificate Authority. - A - [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority] - can be used to create - [Certificates][google.cloud.security.privateca.v1.Certificate]. - - """ - # Create or coerce a protobuf request object. - # Quick check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - has_flattened_params = any([name]) - if request is not None and has_flattened_params: - raise ValueError("If the `request` argument is set, then none of " - "the individual field arguments should be set.") - - 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 - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = gapic_v1.method_async.wrap_method( - self._client._transport.disable_certificate_authority, - default_timeout=None, - client_info=DEFAULT_CLIENT_INFO, - ) - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata(( - ("name", request.name), - )), - ) - - # Send the request. - response = await rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Wrap the response in an operation future. - response = operation_async.from_gapic( - response, - self._client._transport.operations_client, - resources.CertificateAuthority, - metadata_type=service.OperationMetadata, - ) - - # Done; return the response. - return response - - async def enable_certificate_authority(self, - request: Optional[Union[service.EnableCertificateAuthorityRequest, dict]] = None, - *, - name: Optional[str] = None, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), - ) -> operation_async.AsyncOperation: - r"""Enable a - [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority]. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud.security import privateca_v1 - - async def sample_enable_certificate_authority(): - # Create a client - client = privateca_v1.CertificateAuthorityServiceAsyncClient() - - # Initialize request argument(s) - request = privateca_v1.EnableCertificateAuthorityRequest( - name="name_value", - ) - - # Make the request - operation = client.enable_certificate_authority(request=request) - - print("Waiting for operation to complete...") - - response = (await operation).result() - - # Handle the response - print(response) - - Args: - request (Optional[Union[google.cloud.security.privateca_v1.types.EnableCertificateAuthorityRequest, dict]]): - The request object. Request message for - [CertificateAuthorityService.EnableCertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthorityService.EnableCertificateAuthority]. - name (:class:`str`): - Required. The resource name for this - [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority] - in the format - ``projects/*/locations/*/caPools/*/certificateAuthorities/*``. - - 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. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.api_core.operation_async.AsyncOperation: - An object representing a long-running operation. - - The result type for the operation will be :class:`google.cloud.security.privateca_v1.types.CertificateAuthority` A [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority] represents an individual Certificate Authority. - A - [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority] - can be used to create - [Certificates][google.cloud.security.privateca.v1.Certificate]. - - """ - # Create or coerce a protobuf request object. - # Quick check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - has_flattened_params = any([name]) - if request is not None and has_flattened_params: - raise ValueError("If the `request` argument is set, then none of " - "the individual field arguments should be set.") - - 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 - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = gapic_v1.method_async.wrap_method( - self._client._transport.enable_certificate_authority, - default_timeout=None, - client_info=DEFAULT_CLIENT_INFO, - ) - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata(( - ("name", request.name), - )), - ) - - # Send the request. - response = await rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Wrap the response in an operation future. - response = operation_async.from_gapic( - response, - self._client._transport.operations_client, - resources.CertificateAuthority, - metadata_type=service.OperationMetadata, - ) - - # Done; return the response. - return response - - async def fetch_certificate_authority_csr(self, - request: Optional[Union[service.FetchCertificateAuthorityCsrRequest, dict]] = None, - *, - name: Optional[str] = None, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), - ) -> service.FetchCertificateAuthorityCsrResponse: - r"""Fetch a certificate signing request (CSR) from a - [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority] - that is in state - [AWAITING_USER_ACTIVATION][google.cloud.security.privateca.v1.CertificateAuthority.State.AWAITING_USER_ACTIVATION] - and is of type - [SUBORDINATE][google.cloud.security.privateca.v1.CertificateAuthority.Type.SUBORDINATE]. - The CSR must then be signed by the desired parent Certificate - Authority, which could be another - [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority] - resource, or could be an on-prem certificate authority. See also - [ActivateCertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthorityService.ActivateCertificateAuthority]. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud.security import privateca_v1 - - async def sample_fetch_certificate_authority_csr(): - # Create a client - client = privateca_v1.CertificateAuthorityServiceAsyncClient() - - # Initialize request argument(s) - request = privateca_v1.FetchCertificateAuthorityCsrRequest( - name="name_value", - ) - - # Make the request - response = await client.fetch_certificate_authority_csr(request=request) - - # Handle the response - print(response) - - Args: - request (Optional[Union[google.cloud.security.privateca_v1.types.FetchCertificateAuthorityCsrRequest, dict]]): - The request object. Request message for - [CertificateAuthorityService.FetchCertificateAuthorityCsr][google.cloud.security.privateca.v1.CertificateAuthorityService.FetchCertificateAuthorityCsr]. - name (:class:`str`): - Required. The resource name for this - [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority] - in the format - ``projects/*/locations/*/caPools/*/certificateAuthorities/*``. - - 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. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.cloud.security.privateca_v1.types.FetchCertificateAuthorityCsrResponse: - Response message for - [CertificateAuthorityService.FetchCertificateAuthorityCsr][google.cloud.security.privateca.v1.CertificateAuthorityService.FetchCertificateAuthorityCsr]. - - """ - # Create or coerce a protobuf request object. - # Quick check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - has_flattened_params = any([name]) - if request is not None and has_flattened_params: - raise ValueError("If the `request` argument is set, then none of " - "the individual field arguments should be set.") - - 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 - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = gapic_v1.method_async.wrap_method( - self._client._transport.fetch_certificate_authority_csr, - default_timeout=None, - client_info=DEFAULT_CLIENT_INFO, - ) - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata(( - ("name", request.name), - )), - ) - - # Send the request. - response = await rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Done; return the response. - return response - - async def get_certificate_authority(self, - request: Optional[Union[service.GetCertificateAuthorityRequest, dict]] = None, - *, - name: Optional[str] = None, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), - ) -> resources.CertificateAuthority: - r"""Returns a - [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority]. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud.security import privateca_v1 - - async def sample_get_certificate_authority(): - # Create a client - client = privateca_v1.CertificateAuthorityServiceAsyncClient() - - # Initialize request argument(s) - request = privateca_v1.GetCertificateAuthorityRequest( - name="name_value", - ) - - # Make the request - response = await client.get_certificate_authority(request=request) - - # Handle the response - print(response) - - Args: - request (Optional[Union[google.cloud.security.privateca_v1.types.GetCertificateAuthorityRequest, dict]]): - The request object. Request message for - [CertificateAuthorityService.GetCertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthorityService.GetCertificateAuthority]. - name (:class:`str`): - Required. The - [name][google.cloud.security.privateca.v1.CertificateAuthority.name] - of the - [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority] - to get. - - 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. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.cloud.security.privateca_v1.types.CertificateAuthority: - A [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority] represents an individual Certificate Authority. - A - [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority] - can be used to create - [Certificates][google.cloud.security.privateca.v1.Certificate]. - - """ - # Create or coerce a protobuf request object. - # Quick check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - has_flattened_params = any([name]) - if request is not None and has_flattened_params: - raise ValueError("If the `request` argument is set, then none of " - "the individual field arguments should be set.") - - 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 - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = gapic_v1.method_async.wrap_method( - self._client._transport.get_certificate_authority, - default_timeout=None, - client_info=DEFAULT_CLIENT_INFO, - ) - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata(( - ("name", request.name), - )), - ) - - # Send the request. - response = await rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Done; return the response. - return response - - async def list_certificate_authorities(self, - request: Optional[Union[service.ListCertificateAuthoritiesRequest, dict]] = None, - *, - parent: Optional[str] = None, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), - ) -> pagers.ListCertificateAuthoritiesAsyncPager: - r"""Lists - [CertificateAuthorities][google.cloud.security.privateca.v1.CertificateAuthority]. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud.security import privateca_v1 - - async def sample_list_certificate_authorities(): - # Create a client - client = privateca_v1.CertificateAuthorityServiceAsyncClient() - - # Initialize request argument(s) - request = privateca_v1.ListCertificateAuthoritiesRequest( - parent="parent_value", - ) - - # Make the request - page_result = client.list_certificate_authorities(request=request) - - # Handle the response - async for response in page_result: - print(response) - - Args: - request (Optional[Union[google.cloud.security.privateca_v1.types.ListCertificateAuthoritiesRequest, dict]]): - The request object. Request message for - [CertificateAuthorityService.ListCertificateAuthorities][google.cloud.security.privateca.v1.CertificateAuthorityService.ListCertificateAuthorities]. - parent (:class:`str`): - Required. The resource name of the - [CaPool][google.cloud.security.privateca.v1.CaPool] - associated with the - [CertificateAuthorities][google.cloud.security.privateca.v1.CertificateAuthority], - in the format ``projects/*/locations/*/caPools/*``. - - 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. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.cloud.security.privateca_v1.services.certificate_authority_service.pagers.ListCertificateAuthoritiesAsyncPager: - Response message for - [CertificateAuthorityService.ListCertificateAuthorities][google.cloud.security.privateca.v1.CertificateAuthorityService.ListCertificateAuthorities]. - - Iterating over this object will yield results and - resolve additional pages automatically. - - """ - # Create or coerce a protobuf request object. - # Quick check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - has_flattened_params = any([parent]) - if request is not None and has_flattened_params: - raise ValueError("If the `request` argument is set, then none of " - "the individual field arguments should be set.") - - 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 - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = gapic_v1.method_async.wrap_method( - self._client._transport.list_certificate_authorities, - default_timeout=None, - client_info=DEFAULT_CLIENT_INFO, - ) - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata(( - ("parent", request.parent), - )), - ) - - # Send the request. - response = await rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # This method is paged; wrap the response in a pager, which provides - # an `__aiter__` convenience method. - response = pagers.ListCertificateAuthoritiesAsyncPager( - method=rpc, - request=request, - response=response, - metadata=metadata, - ) - - # Done; return the response. - return response - - async def undelete_certificate_authority(self, - request: Optional[Union[service.UndeleteCertificateAuthorityRequest, dict]] = None, - *, - name: Optional[str] = None, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), - ) -> operation_async.AsyncOperation: - r"""Undelete a - [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority] - that has been deleted. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud.security import privateca_v1 - - async def sample_undelete_certificate_authority(): - # Create a client - client = privateca_v1.CertificateAuthorityServiceAsyncClient() - - # Initialize request argument(s) - request = privateca_v1.UndeleteCertificateAuthorityRequest( - name="name_value", - ) - - # Make the request - operation = client.undelete_certificate_authority(request=request) - - print("Waiting for operation to complete...") - - response = (await operation).result() - - # Handle the response - print(response) - - Args: - request (Optional[Union[google.cloud.security.privateca_v1.types.UndeleteCertificateAuthorityRequest, dict]]): - The request object. Request message for - [CertificateAuthorityService.UndeleteCertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthorityService.UndeleteCertificateAuthority]. - name (:class:`str`): - Required. The resource name for this - [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority] - in the format - ``projects/*/locations/*/caPools/*/certificateAuthorities/*``. - - 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. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.api_core.operation_async.AsyncOperation: - An object representing a long-running operation. - - The result type for the operation will be :class:`google.cloud.security.privateca_v1.types.CertificateAuthority` A [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority] represents an individual Certificate Authority. - A - [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority] - can be used to create - [Certificates][google.cloud.security.privateca.v1.Certificate]. - - """ - # Create or coerce a protobuf request object. - # Quick check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - has_flattened_params = any([name]) - if request is not None and has_flattened_params: - raise ValueError("If the `request` argument is set, then none of " - "the individual field arguments should be set.") - - 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 - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = gapic_v1.method_async.wrap_method( - self._client._transport.undelete_certificate_authority, - default_timeout=None, - client_info=DEFAULT_CLIENT_INFO, - ) - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata(( - ("name", request.name), - )), - ) - - # Send the request. - response = await rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Wrap the response in an operation future. - response = operation_async.from_gapic( - response, - self._client._transport.operations_client, - resources.CertificateAuthority, - metadata_type=service.OperationMetadata, - ) - - # Done; return the response. - return response - - async def delete_certificate_authority(self, - request: Optional[Union[service.DeleteCertificateAuthorityRequest, dict]] = None, - *, - name: Optional[str] = None, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), - ) -> operation_async.AsyncOperation: - r"""Delete a - [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority]. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud.security import privateca_v1 - - async def sample_delete_certificate_authority(): - # Create a client - client = privateca_v1.CertificateAuthorityServiceAsyncClient() - - # Initialize request argument(s) - request = privateca_v1.DeleteCertificateAuthorityRequest( - name="name_value", - ) - - # Make the request - operation = client.delete_certificate_authority(request=request) - - print("Waiting for operation to complete...") - - response = (await operation).result() - - # Handle the response - print(response) - - Args: - request (Optional[Union[google.cloud.security.privateca_v1.types.DeleteCertificateAuthorityRequest, dict]]): - The request object. Request message for - [CertificateAuthorityService.DeleteCertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthorityService.DeleteCertificateAuthority]. - name (:class:`str`): - Required. The resource name for this - [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority] - in the format - ``projects/*/locations/*/caPools/*/certificateAuthorities/*``. - - 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. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.api_core.operation_async.AsyncOperation: - An object representing a long-running operation. - - The result type for the operation will be :class:`google.cloud.security.privateca_v1.types.CertificateAuthority` A [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority] represents an individual Certificate Authority. - A - [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority] - can be used to create - [Certificates][google.cloud.security.privateca.v1.Certificate]. - - """ - # Create or coerce a protobuf request object. - # Quick check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - has_flattened_params = any([name]) - if request is not None and has_flattened_params: - raise ValueError("If the `request` argument is set, then none of " - "the individual field arguments should be set.") - - 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 - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = gapic_v1.method_async.wrap_method( - self._client._transport.delete_certificate_authority, - default_timeout=None, - client_info=DEFAULT_CLIENT_INFO, - ) - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata(( - ("name", request.name), - )), - ) - - # Send the request. - response = await rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Wrap the response in an operation future. - response = operation_async.from_gapic( - response, - self._client._transport.operations_client, - resources.CertificateAuthority, - metadata_type=service.OperationMetadata, - ) - - # Done; return the response. - return response - - async def update_certificate_authority(self, - request: Optional[Union[service.UpdateCertificateAuthorityRequest, dict]] = None, - *, - certificate_authority: Optional[resources.CertificateAuthority] = None, - update_mask: Optional[field_mask_pb2.FieldMask] = None, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), - ) -> operation_async.AsyncOperation: - r"""Update a - [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority]. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud.security import privateca_v1 - - async def sample_update_certificate_authority(): - # Create a client - client = privateca_v1.CertificateAuthorityServiceAsyncClient() - - # Initialize request argument(s) - certificate_authority = privateca_v1.CertificateAuthority() - certificate_authority.type_ = "SUBORDINATE" - certificate_authority.key_spec.cloud_kms_key_version = "cloud_kms_key_version_value" - - request = privateca_v1.UpdateCertificateAuthorityRequest( - certificate_authority=certificate_authority, - ) - - # Make the request - operation = client.update_certificate_authority(request=request) - - print("Waiting for operation to complete...") - - response = (await operation).result() - - # Handle the response - print(response) - - Args: - request (Optional[Union[google.cloud.security.privateca_v1.types.UpdateCertificateAuthorityRequest, dict]]): - The request object. Request message for - [CertificateAuthorityService.UpdateCertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthorityService.UpdateCertificateAuthority]. - certificate_authority (:class:`google.cloud.security.privateca_v1.types.CertificateAuthority`): - Required. - [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority] - with updated values. - - This corresponds to the ``certificate_authority`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - update_mask (:class:`google.protobuf.field_mask_pb2.FieldMask`): - Required. A list of fields to be - updated in this request. - - 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. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.api_core.operation_async.AsyncOperation: - An object representing a long-running operation. - - The result type for the operation will be :class:`google.cloud.security.privateca_v1.types.CertificateAuthority` A [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority] represents an individual Certificate Authority. - A - [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority] - can be used to create - [Certificates][google.cloud.security.privateca.v1.Certificate]. - - """ - # Create or coerce a protobuf request object. - # Quick check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - has_flattened_params = any([certificate_authority, update_mask]) - if request is not None and has_flattened_params: - raise ValueError("If the `request` argument is set, then none of " - "the individual field arguments should be set.") - - 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: - request.update_mask = update_mask - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = gapic_v1.method_async.wrap_method( - self._client._transport.update_certificate_authority, - default_timeout=None, - client_info=DEFAULT_CLIENT_INFO, - ) - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata(( - ("certificate_authority.name", request.certificate_authority.name), - )), - ) - - # Send the request. - response = await rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Wrap the response in an operation future. - response = operation_async.from_gapic( - response, - self._client._transport.operations_client, - resources.CertificateAuthority, - metadata_type=service.OperationMetadata, - ) - - # Done; return the response. - return response - - async def create_ca_pool(self, - request: Optional[Union[service.CreateCaPoolRequest, dict]] = None, - *, - parent: Optional[str] = None, - ca_pool: Optional[resources.CaPool] = None, - ca_pool_id: Optional[str] = None, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), - ) -> operation_async.AsyncOperation: - r"""Create a [CaPool][google.cloud.security.privateca.v1.CaPool]. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud.security import privateca_v1 - - async def sample_create_ca_pool(): - # Create a client - client = privateca_v1.CertificateAuthorityServiceAsyncClient() - - # Initialize request argument(s) - ca_pool = privateca_v1.CaPool() - ca_pool.tier = "DEVOPS" - - request = privateca_v1.CreateCaPoolRequest( - parent="parent_value", - ca_pool_id="ca_pool_id_value", - ca_pool=ca_pool, - ) - - # Make the request - operation = client.create_ca_pool(request=request) - - print("Waiting for operation to complete...") - - response = (await operation).result() - - # Handle the response - print(response) - - Args: - request (Optional[Union[google.cloud.security.privateca_v1.types.CreateCaPoolRequest, dict]]): - The request object. Request message for - [CertificateAuthorityService.CreateCaPool][google.cloud.security.privateca.v1.CertificateAuthorityService.CreateCaPool]. - parent (:class:`str`): - Required. The resource name of the location associated - with the - [CaPool][google.cloud.security.privateca.v1.CaPool], in - the format ``projects/*/locations/*``. - - This corresponds to the ``parent`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - ca_pool (:class:`google.cloud.security.privateca_v1.types.CaPool`): - Required. A - [CaPool][google.cloud.security.privateca.v1.CaPool] with - initial field values. - - This corresponds to the ``ca_pool`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - ca_pool_id (:class:`str`): - Required. It must be unique within a location and match - the regular expression ``[a-zA-Z0-9_-]{1,63}`` - - 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. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.api_core.operation_async.AsyncOperation: - An object representing a long-running operation. - - The result type for the operation will be :class:`google.cloud.security.privateca_v1.types.CaPool` A [CaPool][google.cloud.security.privateca.v1.CaPool] represents a group of - [CertificateAuthorities][google.cloud.security.privateca.v1.CertificateAuthority] - that form a trust anchor. A - [CaPool][google.cloud.security.privateca.v1.CaPool] - can be used to manage issuance policies for one or - more - [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority] - resources and to rotate CA certificates in and out of - the trust anchor. - - """ - # Create or coerce a protobuf request object. - # Quick check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - has_flattened_params = any([parent, ca_pool, ca_pool_id]) - if request is not None and has_flattened_params: - raise ValueError("If the `request` argument is set, then none of " - "the individual field arguments should be set.") - - 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: - request.ca_pool = ca_pool - if ca_pool_id is not None: - request.ca_pool_id = ca_pool_id - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = gapic_v1.method_async.wrap_method( - self._client._transport.create_ca_pool, - default_timeout=None, - client_info=DEFAULT_CLIENT_INFO, - ) - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata(( - ("parent", request.parent), - )), - ) - - # Send the request. - response = await rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Wrap the response in an operation future. - response = operation_async.from_gapic( - response, - self._client._transport.operations_client, - resources.CaPool, - metadata_type=service.OperationMetadata, - ) - - # Done; return the response. - return response - - async def update_ca_pool(self, - request: Optional[Union[service.UpdateCaPoolRequest, dict]] = None, - *, - ca_pool: Optional[resources.CaPool] = None, - update_mask: Optional[field_mask_pb2.FieldMask] = None, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), - ) -> operation_async.AsyncOperation: - r"""Update a [CaPool][google.cloud.security.privateca.v1.CaPool]. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud.security import privateca_v1 - - async def sample_update_ca_pool(): - # Create a client - client = privateca_v1.CertificateAuthorityServiceAsyncClient() - - # Initialize request argument(s) - ca_pool = privateca_v1.CaPool() - ca_pool.tier = "DEVOPS" - - request = privateca_v1.UpdateCaPoolRequest( - ca_pool=ca_pool, - ) - - # Make the request - operation = client.update_ca_pool(request=request) - - print("Waiting for operation to complete...") - - response = (await operation).result() - - # Handle the response - print(response) - - Args: - request (Optional[Union[google.cloud.security.privateca_v1.types.UpdateCaPoolRequest, dict]]): - The request object. Request message for - [CertificateAuthorityService.UpdateCaPool][google.cloud.security.privateca.v1.CertificateAuthorityService.UpdateCaPool]. - ca_pool (:class:`google.cloud.security.privateca_v1.types.CaPool`): - Required. - [CaPool][google.cloud.security.privateca.v1.CaPool] with - updated values. - - This corresponds to the ``ca_pool`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - update_mask (:class:`google.protobuf.field_mask_pb2.FieldMask`): - Required. A list of fields to be - updated in this request. - - 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. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.api_core.operation_async.AsyncOperation: - An object representing a long-running operation. - - The result type for the operation will be :class:`google.cloud.security.privateca_v1.types.CaPool` A [CaPool][google.cloud.security.privateca.v1.CaPool] represents a group of - [CertificateAuthorities][google.cloud.security.privateca.v1.CertificateAuthority] - that form a trust anchor. A - [CaPool][google.cloud.security.privateca.v1.CaPool] - can be used to manage issuance policies for one or - more - [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority] - resources and to rotate CA certificates in and out of - the trust anchor. - - """ - # Create or coerce a protobuf request object. - # Quick check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - has_flattened_params = any([ca_pool, update_mask]) - if request is not None and has_flattened_params: - raise ValueError("If the `request` argument is set, then none of " - "the individual field arguments should be set.") - - 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: - request.update_mask = update_mask - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = gapic_v1.method_async.wrap_method( - self._client._transport.update_ca_pool, - default_timeout=None, - client_info=DEFAULT_CLIENT_INFO, - ) - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata(( - ("ca_pool.name", request.ca_pool.name), - )), - ) - - # Send the request. - response = await rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Wrap the response in an operation future. - response = operation_async.from_gapic( - response, - self._client._transport.operations_client, - resources.CaPool, - metadata_type=service.OperationMetadata, - ) - - # Done; return the response. - return response - - async def get_ca_pool(self, - request: Optional[Union[service.GetCaPoolRequest, dict]] = None, - *, - name: Optional[str] = None, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), - ) -> resources.CaPool: - r"""Returns a [CaPool][google.cloud.security.privateca.v1.CaPool]. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud.security import privateca_v1 - - async def sample_get_ca_pool(): - # Create a client - client = privateca_v1.CertificateAuthorityServiceAsyncClient() - - # Initialize request argument(s) - request = privateca_v1.GetCaPoolRequest( - name="name_value", - ) - - # Make the request - response = await client.get_ca_pool(request=request) - - # Handle the response - print(response) - - Args: - request (Optional[Union[google.cloud.security.privateca_v1.types.GetCaPoolRequest, dict]]): - The request object. Request message for - [CertificateAuthorityService.GetCaPool][google.cloud.security.privateca.v1.CertificateAuthorityService.GetCaPool]. - name (:class:`str`): - Required. The - [name][google.cloud.security.privateca.v1.CaPool.name] - of the - [CaPool][google.cloud.security.privateca.v1.CaPool] to - get. - - 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. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.cloud.security.privateca_v1.types.CaPool: - A [CaPool][google.cloud.security.privateca.v1.CaPool] represents a group of - [CertificateAuthorities][google.cloud.security.privateca.v1.CertificateAuthority] - that form a trust anchor. A - [CaPool][google.cloud.security.privateca.v1.CaPool] - can be used to manage issuance policies for one or - more - [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority] - resources and to rotate CA certificates in and out of - the trust anchor. - - """ - # Create or coerce a protobuf request object. - # Quick check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - has_flattened_params = any([name]) - if request is not None and has_flattened_params: - raise ValueError("If the `request` argument is set, then none of " - "the individual field arguments should be set.") - - 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 - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = gapic_v1.method_async.wrap_method( - self._client._transport.get_ca_pool, - default_timeout=None, - client_info=DEFAULT_CLIENT_INFO, - ) - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata(( - ("name", request.name), - )), - ) - - # Send the request. - response = await rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Done; return the response. - return response - - async def list_ca_pools(self, - request: Optional[Union[service.ListCaPoolsRequest, dict]] = None, - *, - parent: Optional[str] = None, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), - ) -> pagers.ListCaPoolsAsyncPager: - r"""Lists [CaPools][google.cloud.security.privateca.v1.CaPool]. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud.security import privateca_v1 - - async def sample_list_ca_pools(): - # Create a client - client = privateca_v1.CertificateAuthorityServiceAsyncClient() - - # Initialize request argument(s) - request = privateca_v1.ListCaPoolsRequest( - parent="parent_value", - ) - - # Make the request - page_result = client.list_ca_pools(request=request) - - # Handle the response - async for response in page_result: - print(response) - - Args: - request (Optional[Union[google.cloud.security.privateca_v1.types.ListCaPoolsRequest, dict]]): - The request object. Request message for - [CertificateAuthorityService.ListCaPools][google.cloud.security.privateca.v1.CertificateAuthorityService.ListCaPools]. - parent (:class:`str`): - Required. The resource name of the location associated - with the - [CaPools][google.cloud.security.privateca.v1.CaPool], in - the format ``projects/*/locations/*``. - - 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. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.cloud.security.privateca_v1.services.certificate_authority_service.pagers.ListCaPoolsAsyncPager: - Response message for - [CertificateAuthorityService.ListCaPools][google.cloud.security.privateca.v1.CertificateAuthorityService.ListCaPools]. - - Iterating over this object will yield results and - resolve additional pages automatically. - - """ - # Create or coerce a protobuf request object. - # Quick check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - has_flattened_params = any([parent]) - if request is not None and has_flattened_params: - raise ValueError("If the `request` argument is set, then none of " - "the individual field arguments should be set.") - - 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 - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = gapic_v1.method_async.wrap_method( - self._client._transport.list_ca_pools, - default_timeout=None, - client_info=DEFAULT_CLIENT_INFO, - ) - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata(( - ("parent", request.parent), - )), - ) - - # Send the request. - response = await rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # This method is paged; wrap the response in a pager, which provides - # an `__aiter__` convenience method. - response = pagers.ListCaPoolsAsyncPager( - method=rpc, - request=request, - response=response, - metadata=metadata, - ) - - # Done; return the response. - return response - - async def delete_ca_pool(self, - request: Optional[Union[service.DeleteCaPoolRequest, dict]] = None, - *, - name: Optional[str] = None, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), - ) -> operation_async.AsyncOperation: - r"""Delete a [CaPool][google.cloud.security.privateca.v1.CaPool]. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud.security import privateca_v1 - - async def sample_delete_ca_pool(): - # Create a client - client = privateca_v1.CertificateAuthorityServiceAsyncClient() - - # Initialize request argument(s) - request = privateca_v1.DeleteCaPoolRequest( - name="name_value", - ) - - # Make the request - operation = client.delete_ca_pool(request=request) - - print("Waiting for operation to complete...") - - response = (await operation).result() - - # Handle the response - print(response) - - Args: - request (Optional[Union[google.cloud.security.privateca_v1.types.DeleteCaPoolRequest, dict]]): - The request object. Request message for - [CertificateAuthorityService.DeleteCaPool][google.cloud.security.privateca.v1.CertificateAuthorityService.DeleteCaPool]. - name (:class:`str`): - Required. The resource name for this - [CaPool][google.cloud.security.privateca.v1.CaPool] in - the format ``projects/*/locations/*/caPools/*``. - - 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. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.api_core.operation_async.AsyncOperation: - An object representing a long-running operation. - - The result type for the operation will be :class:`google.protobuf.empty_pb2.Empty` A generic empty message that you can re-use to avoid defining duplicated - empty messages in your APIs. A typical example is to - use it as the request or the response type of an API - method. For instance: - - service Foo { - rpc Bar(google.protobuf.Empty) returns - (google.protobuf.Empty); - - } - - """ - # Create or coerce a protobuf request object. - # Quick check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - has_flattened_params = any([name]) - if request is not None and has_flattened_params: - raise ValueError("If the `request` argument is set, then none of " - "the individual field arguments should be set.") - - 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 - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = gapic_v1.method_async.wrap_method( - self._client._transport.delete_ca_pool, - default_timeout=None, - client_info=DEFAULT_CLIENT_INFO, - ) - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata(( - ("name", request.name), - )), - ) - - # Send the request. - response = await rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Wrap the response in an operation future. - response = operation_async.from_gapic( - response, - self._client._transport.operations_client, - empty_pb2.Empty, - metadata_type=service.OperationMetadata, - ) - - # Done; return the response. - return response - - async def fetch_ca_certs(self, - request: Optional[Union[service.FetchCaCertsRequest, dict]] = None, - *, - ca_pool: Optional[str] = None, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), - ) -> service.FetchCaCertsResponse: - r"""FetchCaCerts returns the current trust anchor for the - [CaPool][google.cloud.security.privateca.v1.CaPool]. This will - include CA certificate chains for all ACTIVE - [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority] - resources in the - [CaPool][google.cloud.security.privateca.v1.CaPool]. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud.security import privateca_v1 - - async def sample_fetch_ca_certs(): - # Create a client - client = privateca_v1.CertificateAuthorityServiceAsyncClient() - - # Initialize request argument(s) - request = privateca_v1.FetchCaCertsRequest( - ca_pool="ca_pool_value", - ) - - # Make the request - response = await client.fetch_ca_certs(request=request) - - # Handle the response - print(response) - - Args: - request (Optional[Union[google.cloud.security.privateca_v1.types.FetchCaCertsRequest, dict]]): - The request object. Request message for - [CertificateAuthorityService.FetchCaCerts][google.cloud.security.privateca.v1.CertificateAuthorityService.FetchCaCerts]. - ca_pool (:class:`str`): - Required. The resource name for the - [CaPool][google.cloud.security.privateca.v1.CaPool] in - the format ``projects/*/locations/*/caPools/*``. - - 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. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.cloud.security.privateca_v1.types.FetchCaCertsResponse: - Response message for - [CertificateAuthorityService.FetchCaCerts][google.cloud.security.privateca.v1.CertificateAuthorityService.FetchCaCerts]. - - """ - # Create or coerce a protobuf request object. - # Quick check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - has_flattened_params = any([ca_pool]) - if request is not None and has_flattened_params: - raise ValueError("If the `request` argument is set, then none of " - "the individual field arguments should be set.") - - 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 - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = gapic_v1.method_async.wrap_method( - self._client._transport.fetch_ca_certs, - default_timeout=None, - client_info=DEFAULT_CLIENT_INFO, - ) - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata(( - ("ca_pool", request.ca_pool), - )), - ) - - # Send the request. - response = await rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Done; return the response. - return response - - async def get_certificate_revocation_list(self, - request: Optional[Union[service.GetCertificateRevocationListRequest, dict]] = None, - *, - name: Optional[str] = None, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), - ) -> resources.CertificateRevocationList: - r"""Returns a - [CertificateRevocationList][google.cloud.security.privateca.v1.CertificateRevocationList]. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud.security import privateca_v1 - - async def sample_get_certificate_revocation_list(): - # Create a client - client = privateca_v1.CertificateAuthorityServiceAsyncClient() - - # Initialize request argument(s) - request = privateca_v1.GetCertificateRevocationListRequest( - name="name_value", - ) - - # Make the request - response = await client.get_certificate_revocation_list(request=request) - - # Handle the response - print(response) - - Args: - request (Optional[Union[google.cloud.security.privateca_v1.types.GetCertificateRevocationListRequest, dict]]): - The request object. Request message for - [CertificateAuthorityService.GetCertificateRevocationList][google.cloud.security.privateca.v1.CertificateAuthorityService.GetCertificateRevocationList]. - name (:class:`str`): - Required. The - [name][google.cloud.security.privateca.v1.CertificateRevocationList.name] - of the - [CertificateRevocationList][google.cloud.security.privateca.v1.CertificateRevocationList] - to get. - - 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. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.cloud.security.privateca_v1.types.CertificateRevocationList: - A [CertificateRevocationList][google.cloud.security.privateca.v1.CertificateRevocationList] corresponds to a signed X.509 certificate - Revocation List (CRL). A CRL contains the serial - numbers of certificates that should no longer be - trusted. - - """ - # Create or coerce a protobuf request object. - # Quick check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - has_flattened_params = any([name]) - if request is not None and has_flattened_params: - raise ValueError("If the `request` argument is set, then none of " - "the individual field arguments should be set.") - - 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 - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = gapic_v1.method_async.wrap_method( - self._client._transport.get_certificate_revocation_list, - default_timeout=None, - client_info=DEFAULT_CLIENT_INFO, - ) - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata(( - ("name", request.name), - )), - ) - - # Send the request. - response = await rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Done; return the response. - return response - - async def list_certificate_revocation_lists(self, - request: Optional[Union[service.ListCertificateRevocationListsRequest, dict]] = None, - *, - parent: Optional[str] = None, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), - ) -> pagers.ListCertificateRevocationListsAsyncPager: - r"""Lists - [CertificateRevocationLists][google.cloud.security.privateca.v1.CertificateRevocationList]. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud.security import privateca_v1 - - async def sample_list_certificate_revocation_lists(): - # Create a client - client = privateca_v1.CertificateAuthorityServiceAsyncClient() - - # Initialize request argument(s) - request = privateca_v1.ListCertificateRevocationListsRequest( - parent="parent_value", - ) - - # Make the request - page_result = client.list_certificate_revocation_lists(request=request) - - # Handle the response - async for response in page_result: - print(response) - - Args: - request (Optional[Union[google.cloud.security.privateca_v1.types.ListCertificateRevocationListsRequest, dict]]): - The request object. Request message for - [CertificateAuthorityService.ListCertificateRevocationLists][google.cloud.security.privateca.v1.CertificateAuthorityService.ListCertificateRevocationLists]. - parent (:class:`str`): - Required. The resource name of the location associated - with the - [CertificateRevocationLists][google.cloud.security.privateca.v1.CertificateRevocationList], - in the format - ``projects/*/locations/*/caPools/*/certificateAuthorities/*``. - - 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. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.cloud.security.privateca_v1.services.certificate_authority_service.pagers.ListCertificateRevocationListsAsyncPager: - Response message for - [CertificateAuthorityService.ListCertificateRevocationLists][google.cloud.security.privateca.v1.CertificateAuthorityService.ListCertificateRevocationLists]. - - Iterating over this object will yield results and - resolve additional pages automatically. - - """ - # Create or coerce a protobuf request object. - # Quick check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - has_flattened_params = any([parent]) - if request is not None and has_flattened_params: - raise ValueError("If the `request` argument is set, then none of " - "the individual field arguments should be set.") - - 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 - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = gapic_v1.method_async.wrap_method( - self._client._transport.list_certificate_revocation_lists, - default_timeout=None, - client_info=DEFAULT_CLIENT_INFO, - ) - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata(( - ("parent", request.parent), - )), - ) - - # Send the request. - response = await rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # This method is paged; wrap the response in a pager, which provides - # an `__aiter__` convenience method. - response = pagers.ListCertificateRevocationListsAsyncPager( - method=rpc, - request=request, - response=response, - metadata=metadata, - ) - - # Done; return the response. - return response - - async def update_certificate_revocation_list(self, - request: Optional[Union[service.UpdateCertificateRevocationListRequest, dict]] = None, - *, - certificate_revocation_list: Optional[resources.CertificateRevocationList] = None, - update_mask: Optional[field_mask_pb2.FieldMask] = None, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), - ) -> operation_async.AsyncOperation: - r"""Update a - [CertificateRevocationList][google.cloud.security.privateca.v1.CertificateRevocationList]. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud.security import privateca_v1 - - async def sample_update_certificate_revocation_list(): - # Create a client - client = privateca_v1.CertificateAuthorityServiceAsyncClient() - - # Initialize request argument(s) - request = privateca_v1.UpdateCertificateRevocationListRequest( - ) - - # Make the request - operation = client.update_certificate_revocation_list(request=request) - - print("Waiting for operation to complete...") - - response = (await operation).result() - - # Handle the response - print(response) - - Args: - request (Optional[Union[google.cloud.security.privateca_v1.types.UpdateCertificateRevocationListRequest, dict]]): - The request object. Request message for - [CertificateAuthorityService.UpdateCertificateRevocationList][google.cloud.security.privateca.v1.CertificateAuthorityService.UpdateCertificateRevocationList]. - certificate_revocation_list (:class:`google.cloud.security.privateca_v1.types.CertificateRevocationList`): - Required. - [CertificateRevocationList][google.cloud.security.privateca.v1.CertificateRevocationList] - with updated values. - - This corresponds to the ``certificate_revocation_list`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - update_mask (:class:`google.protobuf.field_mask_pb2.FieldMask`): - Required. A list of fields to be - updated in this request. - - 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. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.api_core.operation_async.AsyncOperation: - An object representing a long-running operation. - - The result type for the operation will be :class:`google.cloud.security.privateca_v1.types.CertificateRevocationList` A [CertificateRevocationList][google.cloud.security.privateca.v1.CertificateRevocationList] corresponds to a signed X.509 certificate - Revocation List (CRL). A CRL contains the serial - numbers of certificates that should no longer be - trusted. - - """ - # Create or coerce a protobuf request object. - # Quick check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - has_flattened_params = any([certificate_revocation_list, update_mask]) - if request is not None and has_flattened_params: - raise ValueError("If the `request` argument is set, then none of " - "the individual field arguments should be set.") - - 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: - request.update_mask = update_mask - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = gapic_v1.method_async.wrap_method( - self._client._transport.update_certificate_revocation_list, - default_timeout=None, - client_info=DEFAULT_CLIENT_INFO, - ) - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata(( - ("certificate_revocation_list.name", request.certificate_revocation_list.name), - )), - ) - - # Send the request. - response = await rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Wrap the response in an operation future. - response = operation_async.from_gapic( - response, - self._client._transport.operations_client, - resources.CertificateRevocationList, - metadata_type=service.OperationMetadata, - ) - - # Done; return the response. - return response - - async def create_certificate_template(self, - request: Optional[Union[service.CreateCertificateTemplateRequest, dict]] = None, - *, - parent: Optional[str] = None, - certificate_template: Optional[resources.CertificateTemplate] = None, - certificate_template_id: Optional[str] = None, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), - ) -> operation_async.AsyncOperation: - r"""Create a new - [CertificateTemplate][google.cloud.security.privateca.v1.CertificateTemplate] - in a given Project and Location. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud.security import privateca_v1 - - async def sample_create_certificate_template(): - # Create a client - client = privateca_v1.CertificateAuthorityServiceAsyncClient() - - # Initialize request argument(s) - request = privateca_v1.CreateCertificateTemplateRequest( - parent="parent_value", - certificate_template_id="certificate_template_id_value", - ) - - # Make the request - operation = client.create_certificate_template(request=request) - - print("Waiting for operation to complete...") - - response = (await operation).result() - - # Handle the response - print(response) - - Args: - request (Optional[Union[google.cloud.security.privateca_v1.types.CreateCertificateTemplateRequest, dict]]): - The request object. Request message for - [CertificateAuthorityService.CreateCertificateTemplate][google.cloud.security.privateca.v1.CertificateAuthorityService.CreateCertificateTemplate]. - parent (:class:`str`): - Required. The resource name of the location associated - with the - [CertificateTemplate][google.cloud.security.privateca.v1.CertificateTemplate], - in the format ``projects/*/locations/*``. - - This corresponds to the ``parent`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - certificate_template (:class:`google.cloud.security.privateca_v1.types.CertificateTemplate`): - Required. A - [CertificateTemplate][google.cloud.security.privateca.v1.CertificateTemplate] - with initial field values. - - This corresponds to the ``certificate_template`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - certificate_template_id (:class:`str`): - Required. It must be unique within a location and match - the regular expression ``[a-zA-Z0-9_-]{1,63}`` - - 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. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.api_core.operation_async.AsyncOperation: - An object representing a long-running operation. - - The result type for the operation will be :class:`google.cloud.security.privateca_v1.types.CertificateTemplate` A [CertificateTemplate][google.cloud.security.privateca.v1.CertificateTemplate] refers to a managed template for certificate - issuance. - - """ - # Create or coerce a protobuf request object. - # Quick check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - has_flattened_params = any([parent, certificate_template, certificate_template_id]) - if request is not None and has_flattened_params: - raise ValueError("If the `request` argument is set, then none of " - "the individual field arguments should be set.") - - 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: - request.certificate_template = certificate_template - if certificate_template_id is not None: - request.certificate_template_id = certificate_template_id - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = gapic_v1.method_async.wrap_method( - self._client._transport.create_certificate_template, - default_timeout=None, - client_info=DEFAULT_CLIENT_INFO, - ) - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata(( - ("parent", request.parent), - )), - ) - - # Send the request. - response = await rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Wrap the response in an operation future. - response = operation_async.from_gapic( - response, - self._client._transport.operations_client, - resources.CertificateTemplate, - metadata_type=service.OperationMetadata, - ) - - # Done; return the response. - return response - - async def delete_certificate_template(self, - request: Optional[Union[service.DeleteCertificateTemplateRequest, dict]] = None, - *, - name: Optional[str] = None, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), - ) -> operation_async.AsyncOperation: - r"""DeleteCertificateTemplate deletes a - [CertificateTemplate][google.cloud.security.privateca.v1.CertificateTemplate]. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud.security import privateca_v1 - - async def sample_delete_certificate_template(): - # Create a client - client = privateca_v1.CertificateAuthorityServiceAsyncClient() - - # Initialize request argument(s) - request = privateca_v1.DeleteCertificateTemplateRequest( - name="name_value", - ) - - # Make the request - operation = client.delete_certificate_template(request=request) - - print("Waiting for operation to complete...") - - response = (await operation).result() - - # Handle the response - print(response) - - Args: - request (Optional[Union[google.cloud.security.privateca_v1.types.DeleteCertificateTemplateRequest, dict]]): - The request object. Request message for - [CertificateAuthorityService.DeleteCertificateTemplate][google.cloud.security.privateca.v1.CertificateAuthorityService.DeleteCertificateTemplate]. - name (:class:`str`): - Required. The resource name for this - [CertificateTemplate][google.cloud.security.privateca.v1.CertificateTemplate] - in the format - ``projects/*/locations/*/certificateTemplates/*``. - - 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. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.api_core.operation_async.AsyncOperation: - An object representing a long-running operation. - - The result type for the operation will be :class:`google.protobuf.empty_pb2.Empty` A generic empty message that you can re-use to avoid defining duplicated - empty messages in your APIs. A typical example is to - use it as the request or the response type of an API - method. For instance: - - service Foo { - rpc Bar(google.protobuf.Empty) returns - (google.protobuf.Empty); - - } - - """ - # Create or coerce a protobuf request object. - # Quick check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - has_flattened_params = any([name]) - if request is not None and has_flattened_params: - raise ValueError("If the `request` argument is set, then none of " - "the individual field arguments should be set.") - - 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 - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = gapic_v1.method_async.wrap_method( - self._client._transport.delete_certificate_template, - default_timeout=None, - client_info=DEFAULT_CLIENT_INFO, - ) - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata(( - ("name", request.name), - )), - ) - - # Send the request. - response = await rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Wrap the response in an operation future. - response = operation_async.from_gapic( - response, - self._client._transport.operations_client, - empty_pb2.Empty, - metadata_type=service.OperationMetadata, - ) - - # Done; return the response. - return response - - async def get_certificate_template(self, - request: Optional[Union[service.GetCertificateTemplateRequest, dict]] = None, - *, - name: Optional[str] = None, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), - ) -> resources.CertificateTemplate: - r"""Returns a - [CertificateTemplate][google.cloud.security.privateca.v1.CertificateTemplate]. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud.security import privateca_v1 - - async def sample_get_certificate_template(): - # Create a client - client = privateca_v1.CertificateAuthorityServiceAsyncClient() - - # Initialize request argument(s) - request = privateca_v1.GetCertificateTemplateRequest( - name="name_value", - ) - - # Make the request - response = await client.get_certificate_template(request=request) - - # Handle the response - print(response) - - Args: - request (Optional[Union[google.cloud.security.privateca_v1.types.GetCertificateTemplateRequest, dict]]): - The request object. Request message for - [CertificateAuthorityService.GetCertificateTemplate][google.cloud.security.privateca.v1.CertificateAuthorityService.GetCertificateTemplate]. - name (:class:`str`): - Required. The - [name][google.cloud.security.privateca.v1.CertificateTemplate.name] - of the - [CertificateTemplate][google.cloud.security.privateca.v1.CertificateTemplate] - to get. - - 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. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.cloud.security.privateca_v1.types.CertificateTemplate: - A [CertificateTemplate][google.cloud.security.privateca.v1.CertificateTemplate] refers to a managed template for certificate - issuance. - - """ - # Create or coerce a protobuf request object. - # Quick check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - has_flattened_params = any([name]) - if request is not None and has_flattened_params: - raise ValueError("If the `request` argument is set, then none of " - "the individual field arguments should be set.") - - 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 - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = gapic_v1.method_async.wrap_method( - self._client._transport.get_certificate_template, - default_timeout=None, - client_info=DEFAULT_CLIENT_INFO, - ) - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata(( - ("name", request.name), - )), - ) - - # Send the request. - response = await rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Done; return the response. - return response - - async def list_certificate_templates(self, - request: Optional[Union[service.ListCertificateTemplatesRequest, dict]] = None, - *, - parent: Optional[str] = None, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), - ) -> pagers.ListCertificateTemplatesAsyncPager: - r"""Lists - [CertificateTemplates][google.cloud.security.privateca.v1.CertificateTemplate]. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud.security import privateca_v1 - - async def sample_list_certificate_templates(): - # Create a client - client = privateca_v1.CertificateAuthorityServiceAsyncClient() - - # Initialize request argument(s) - request = privateca_v1.ListCertificateTemplatesRequest( - parent="parent_value", - ) - - # Make the request - page_result = client.list_certificate_templates(request=request) - - # Handle the response - async for response in page_result: - print(response) - - Args: - request (Optional[Union[google.cloud.security.privateca_v1.types.ListCertificateTemplatesRequest, dict]]): - The request object. Request message for - [CertificateAuthorityService.ListCertificateTemplates][google.cloud.security.privateca.v1.CertificateAuthorityService.ListCertificateTemplates]. - parent (:class:`str`): - Required. The resource name of the location associated - with the - [CertificateTemplates][google.cloud.security.privateca.v1.CertificateTemplate], - in the format ``projects/*/locations/*``. - - 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. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.cloud.security.privateca_v1.services.certificate_authority_service.pagers.ListCertificateTemplatesAsyncPager: - Response message for - [CertificateAuthorityService.ListCertificateTemplates][google.cloud.security.privateca.v1.CertificateAuthorityService.ListCertificateTemplates]. - - Iterating over this object will yield results and - resolve additional pages automatically. - - """ - # Create or coerce a protobuf request object. - # Quick check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - has_flattened_params = any([parent]) - if request is not None and has_flattened_params: - raise ValueError("If the `request` argument is set, then none of " - "the individual field arguments should be set.") - - 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 - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = gapic_v1.method_async.wrap_method( - self._client._transport.list_certificate_templates, - default_timeout=None, - client_info=DEFAULT_CLIENT_INFO, - ) - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata(( - ("parent", request.parent), - )), - ) - - # Send the request. - response = await rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # This method is paged; wrap the response in a pager, which provides - # an `__aiter__` convenience method. - response = pagers.ListCertificateTemplatesAsyncPager( - method=rpc, - request=request, - response=response, - metadata=metadata, - ) - - # Done; return the response. - return response - - async def update_certificate_template(self, - request: Optional[Union[service.UpdateCertificateTemplateRequest, dict]] = None, - *, - certificate_template: Optional[resources.CertificateTemplate] = None, - update_mask: Optional[field_mask_pb2.FieldMask] = None, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), - ) -> operation_async.AsyncOperation: - r"""Update a - [CertificateTemplate][google.cloud.security.privateca.v1.CertificateTemplate]. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud.security import privateca_v1 - - async def sample_update_certificate_template(): - # Create a client - client = privateca_v1.CertificateAuthorityServiceAsyncClient() - - # Initialize request argument(s) - request = privateca_v1.UpdateCertificateTemplateRequest( - ) - - # Make the request - operation = client.update_certificate_template(request=request) - - print("Waiting for operation to complete...") - - response = (await operation).result() - - # Handle the response - print(response) - - Args: - request (Optional[Union[google.cloud.security.privateca_v1.types.UpdateCertificateTemplateRequest, dict]]): - The request object. Request message for - [CertificateAuthorityService.UpdateCertificateTemplate][google.cloud.security.privateca.v1.CertificateAuthorityService.UpdateCertificateTemplate]. - certificate_template (:class:`google.cloud.security.privateca_v1.types.CertificateTemplate`): - Required. - [CertificateTemplate][google.cloud.security.privateca.v1.CertificateTemplate] - with updated values. - - This corresponds to the ``certificate_template`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - update_mask (:class:`google.protobuf.field_mask_pb2.FieldMask`): - Required. A list of fields to be - updated in this request. - - 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. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.api_core.operation_async.AsyncOperation: - An object representing a long-running operation. - - The result type for the operation will be :class:`google.cloud.security.privateca_v1.types.CertificateTemplate` A [CertificateTemplate][google.cloud.security.privateca.v1.CertificateTemplate] refers to a managed template for certificate - issuance. - - """ - # Create or coerce a protobuf request object. - # Quick check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - has_flattened_params = any([certificate_template, update_mask]) - if request is not None and has_flattened_params: - raise ValueError("If the `request` argument is set, then none of " - "the individual field arguments should be set.") - - 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: - request.update_mask = update_mask - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = gapic_v1.method_async.wrap_method( - self._client._transport.update_certificate_template, - default_timeout=None, - client_info=DEFAULT_CLIENT_INFO, - ) - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata(( - ("certificate_template.name", request.certificate_template.name), - )), - ) - - # Send the request. - response = await rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Wrap the response in an operation future. - response = operation_async.from_gapic( - response, - self._client._transport.operations_client, - resources.CertificateTemplate, - metadata_type=service.OperationMetadata, - ) - - # Done; return the response. - return response - - async def __aenter__(self): - return self - - async def __aexit__(self, exc_type, exc, tb): - await self.transport.close() - -DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo(gapic_version=package_version.__version__) - - -__all__ = ( - "CertificateAuthorityServiceAsyncClient", -) diff --git a/owl-bot-staging/v1/google/cloud/security/privateca_v1/services/certificate_authority_service/client.py b/owl-bot-staging/v1/google/cloud/security/privateca_v1/services/certificate_authority_service/client.py deleted file mode 100644 index b594b46..0000000 --- a/owl-bot-staging/v1/google/cloud/security/privateca_v1/services/certificate_authority_service/client.py +++ /dev/null @@ -1,3990 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -from collections import OrderedDict -import os -import re -from typing import Dict, Mapping, MutableMapping, MutableSequence, Optional, Sequence, Tuple, Type, Union, cast - -from google.cloud.security.privateca_v1 import gapic_version as package_version - -from google.api_core import client_options as client_options_lib -from google.api_core import exceptions as core_exceptions -from google.api_core import gapic_v1 -from google.api_core import retry as retries -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 -from google.oauth2 import service_account # type: ignore - -try: - OptionalRetry = Union[retries.Retry, gapic_v1.method._MethodDefault] -except AttributeError: # pragma: NO COVER - OptionalRetry = Union[retries.Retry, object] # type: ignore - -from google.api_core import operation # type: ignore -from google.api_core import operation_async # type: ignore -from google.cloud.security.privateca_v1.services.certificate_authority_service import pagers -from google.cloud.security.privateca_v1.types import resources -from google.cloud.security.privateca_v1.types import service -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 - - -class CertificateAuthorityServiceClientMeta(type): - """Metaclass for the CertificateAuthorityService client. - - This provides class-level methods for building and retrieving - support objects (e.g. transport) without polluting the client instance - objects. - """ - _transport_registry = OrderedDict() # type: Dict[str, Type[CertificateAuthorityServiceTransport]] - _transport_registry["grpc"] = CertificateAuthorityServiceGrpcTransport - _transport_registry["grpc_asyncio"] = CertificateAuthorityServiceGrpcAsyncIOTransport - - def get_transport_class(cls, - label: Optional[str] = None, - ) -> Type[CertificateAuthorityServiceTransport]: - """Returns an appropriate transport class. - - Args: - label: The name of the desired transport. If none is - provided, then the first transport in the registry is used. - - Returns: - The transport class to use. - """ - # If a specific transport is requested, return that one. - if label: - return cls._transport_registry[label] - - # No transport is requested; return the default (that is, the first one - # in the dictionary). - return next(iter(cls._transport_registry.values())) - - -class CertificateAuthorityServiceClient(metaclass=CertificateAuthorityServiceClientMeta): - """[Certificate Authority - Service][google.cloud.security.privateca.v1.CertificateAuthorityService] - manages private certificate authorities and issued certificates. - """ - - @staticmethod - def _get_default_mtls_endpoint(api_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: - api_endpoint (Optional[str]): the api endpoint to convert. - Returns: - str: converted mTLS api endpoint. - """ - if not api_endpoint: - return api_endpoint - - mtls_endpoint_re = re.compile( - r"(?P[^.]+)(?P\.mtls)?(?P\.sandbox)?(?P\.googleapis\.com)?" - ) - - m = mtls_endpoint_re.match(api_endpoint) - name, mtls, sandbox, googledomain = m.groups() - if mtls or not googledomain: - return api_endpoint - - if sandbox: - return api_endpoint.replace( - "sandbox.googleapis.com", "mtls.sandbox.googleapis.com" - ) - - return api_endpoint.replace(".googleapis.com", ".mtls.googleapis.com") - - DEFAULT_ENDPOINT = "privateca.googleapis.com" - DEFAULT_MTLS_ENDPOINT = _get_default_mtls_endpoint.__func__( # type: ignore - DEFAULT_ENDPOINT - ) - - @classmethod - def from_service_account_info(cls, info: dict, *args, **kwargs): - """Creates an instance of this client using the provided credentials - info. - - Args: - info (dict): The service account private key info. - args: Additional arguments to pass to the constructor. - kwargs: Additional arguments to pass to the constructor. - - Returns: - CertificateAuthorityServiceClient: The constructed client. - """ - credentials = service_account.Credentials.from_service_account_info(info) - kwargs["credentials"] = credentials - return cls(*args, **kwargs) - - @classmethod - def from_service_account_file(cls, filename: str, *args, **kwargs): - """Creates an instance of this client using the provided credentials - file. - - Args: - filename (str): The path to the service account private key json - file. - args: Additional arguments to pass to the constructor. - kwargs: Additional arguments to pass to the constructor. - - Returns: - CertificateAuthorityServiceClient: The constructed client. - """ - credentials = service_account.Credentials.from_service_account_file( - filename) - kwargs["credentials"] = credentials - return cls(*args, **kwargs) - - from_service_account_json = from_service_account_file - - @property - def transport(self) -> CertificateAuthorityServiceTransport: - """Returns the transport used by the client instance. - - Returns: - CertificateAuthorityServiceTransport: The transport used by the client - instance. - """ - return self._transport - - @staticmethod - def ca_pool_path(project: str,location: str,ca_pool: str,) -> str: - """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]: - """Parses a ca_pool path into its component segments.""" - m = re.match(r"^projects/(?P.+?)/locations/(?P.+?)/caPools/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def certificate_path(project: str,location: str,ca_pool: str,certificate: str,) -> str: - """Returns a fully-qualified certificate string.""" - return "projects/{project}/locations/{location}/caPools/{ca_pool}/certificates/{certificate}".format(project=project, location=location, ca_pool=ca_pool, certificate=certificate, ) - - @staticmethod - def parse_certificate_path(path: str) -> Dict[str,str]: - """Parses a certificate path into its component segments.""" - m = re.match(r"^projects/(?P.+?)/locations/(?P.+?)/caPools/(?P.+?)/certificates/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def certificate_authority_path(project: str,location: str,ca_pool: str,certificate_authority: str,) -> str: - """Returns a fully-qualified certificate_authority string.""" - return "projects/{project}/locations/{location}/caPools/{ca_pool}/certificateAuthorities/{certificate_authority}".format(project=project, location=location, ca_pool=ca_pool, certificate_authority=certificate_authority, ) - - @staticmethod - def parse_certificate_authority_path(path: str) -> Dict[str,str]: - """Parses a certificate_authority path into its component segments.""" - m = re.match(r"^projects/(?P.+?)/locations/(?P.+?)/caPools/(?P.+?)/certificateAuthorities/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def certificate_revocation_list_path(project: str,location: str,ca_pool: str,certificate_authority: str,certificate_revocation_list: str,) -> str: - """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, ca_pool=ca_pool, certificate_authority=certificate_authority, certificate_revocation_list=certificate_revocation_list, ) - - @staticmethod - def parse_certificate_revocation_list_path(path: str) -> Dict[str,str]: - """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) - return m.groupdict() if m else {} - - @staticmethod - def certificate_template_path(project: str,location: str,certificate_template: str,) -> str: - """Returns a fully-qualified certificate_template string.""" - return "projects/{project}/locations/{location}/certificateTemplates/{certificate_template}".format(project=project, location=location, certificate_template=certificate_template, ) - - @staticmethod - def parse_certificate_template_path(path: str) -> Dict[str,str]: - """Parses a certificate_template path into its component segments.""" - m = re.match(r"^projects/(?P.+?)/locations/(?P.+?)/certificateTemplates/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_billing_account_path(billing_account: str, ) -> str: - """Returns a fully-qualified billing_account string.""" - return "billingAccounts/{billing_account}".format(billing_account=billing_account, ) - - @staticmethod - def parse_common_billing_account_path(path: str) -> Dict[str,str]: - """Parse a billing_account path into its component segments.""" - m = re.match(r"^billingAccounts/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_folder_path(folder: str, ) -> str: - """Returns a fully-qualified folder string.""" - return "folders/{folder}".format(folder=folder, ) - - @staticmethod - def parse_common_folder_path(path: str) -> Dict[str,str]: - """Parse a folder path into its component segments.""" - m = re.match(r"^folders/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_organization_path(organization: str, ) -> str: - """Returns a fully-qualified organization string.""" - return "organizations/{organization}".format(organization=organization, ) - - @staticmethod - def parse_common_organization_path(path: str) -> Dict[str,str]: - """Parse a organization path into its component segments.""" - m = re.match(r"^organizations/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_project_path(project: str, ) -> str: - """Returns a fully-qualified project string.""" - return "projects/{project}".format(project=project, ) - - @staticmethod - def parse_common_project_path(path: str) -> Dict[str,str]: - """Parse a project path into its component segments.""" - m = re.match(r"^projects/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_location_path(project: str, location: str, ) -> str: - """Returns a fully-qualified location string.""" - return "projects/{project}/locations/{location}".format(project=project, location=location, ) - - @staticmethod - def parse_common_location_path(path: str) -> Dict[str,str]: - """Parse a location path into its component segments.""" - m = re.match(r"^projects/(?P.+?)/locations/(?P.+?)$", path) - return m.groupdict() if m else {} - - @classmethod - def get_mtls_endpoint_and_cert_source(cls, client_options: Optional[client_options_lib.ClientOptions] = None): - """Return the API endpoint and client cert source for mutual TLS. - - The client cert source is determined in the following order: - (1) if `GOOGLE_API_USE_CLIENT_CERTIFICATE` environment variable is not "true", the - client cert source is None. - (2) if `client_options.client_cert_source` is provided, use the provided one; if the - default client cert source exists, use the default one; otherwise the client cert - source is None. - - The API endpoint is determined in the following order: - (1) if `client_options.api_endpoint` if provided, use the provided one. - (2) if `GOOGLE_API_USE_CLIENT_CERTIFICATE` environment variable is "always", use the - default mTLS endpoint; if the environment variable is "never", use the default API - endpoint; otherwise if client cert source exists, use the default mTLS endpoint, otherwise - use the default API endpoint. - - More details can be found at https://google.aip.dev/auth/4114. - - Args: - client_options (google.api_core.client_options.ClientOptions): Custom options for the - client. Only the `api_endpoint` and `client_cert_source` properties may be used - in this method. - - Returns: - Tuple[str, Callable[[], Tuple[bytes, bytes]]]: returns the API endpoint and the - client cert source to use. - - Raises: - google.auth.exceptions.MutualTLSChannelError: If any errors happen. - """ - if client_options is None: - client_options = client_options_lib.ClientOptions() - use_client_cert = os.getenv("GOOGLE_API_USE_CLIENT_CERTIFICATE", "false") - use_mtls_endpoint = os.getenv("GOOGLE_API_USE_MTLS_ENDPOINT", "auto") - if use_client_cert not in ("true", "false"): - raise ValueError("Environment variable `GOOGLE_API_USE_CLIENT_CERTIFICATE` must be either `true` or `false`") - if use_mtls_endpoint not in ("auto", "never", "always"): - raise MutualTLSChannelError("Environment variable `GOOGLE_API_USE_MTLS_ENDPOINT` must be `never`, `auto` or `always`") - - # Figure out the client cert source to use. - client_cert_source = None - if use_client_cert == "true": - if client_options.client_cert_source: - client_cert_source = client_options.client_cert_source - elif mtls.has_default_client_cert_source(): - client_cert_source = mtls.default_client_cert_source() - - # Figure out which api endpoint to use. - if client_options.api_endpoint is not None: - api_endpoint = client_options.api_endpoint - elif use_mtls_endpoint == "always" or (use_mtls_endpoint == "auto" and client_cert_source): - api_endpoint = cls.DEFAULT_MTLS_ENDPOINT - else: - api_endpoint = cls.DEFAULT_ENDPOINT - - return api_endpoint, client_cert_source - - def __init__(self, *, - credentials: Optional[ga_credentials.Credentials] = None, - transport: Optional[Union[str, CertificateAuthorityServiceTransport]] = None, - client_options: Optional[Union[client_options_lib.ClientOptions, dict]] = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - ) -> None: - """Instantiates the certificate authority service client. - - Args: - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - transport (Union[str, CertificateAuthorityServiceTransport]): The - transport to use. If set to None, a transport is chosen - automatically. - client_options (Optional[Union[google.api_core.client_options.ClientOptions, dict]]): Custom options for the - client. It won't take effect if a ``transport`` instance is provided. - (1) The ``api_endpoint`` property can be used to override the - default endpoint provided by the client. GOOGLE_API_USE_MTLS_ENDPOINT - environment variable can also be used to override the endpoint: - "always" (always use the default mTLS endpoint), "never" (always - use the default regular endpoint) and "auto" (auto switch to the - default mTLS endpoint if client certificate is present, this is - the default value). However, the ``api_endpoint`` property takes - precedence if provided. - (2) If GOOGLE_API_USE_CLIENT_CERTIFICATE environment variable - is "true", then the ``client_cert_source`` property can be used - to provide client certificate for mutual TLS transport. If - not provided, the default SSL client certificate will be used if - present. If GOOGLE_API_USE_CLIENT_CERTIFICATE is "false" or not - set, no client certificate will be used. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - - Raises: - google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport - creation failed for any reason. - """ - if isinstance(client_options, dict): - client_options = client_options_lib.from_dict(client_options) - if client_options is None: - client_options = client_options_lib.ClientOptions() - client_options = cast(client_options_lib.ClientOptions, client_options) - - api_endpoint, client_cert_source_func = self.get_mtls_endpoint_and_cert_source(client_options) - - api_key_value = getattr(client_options, "api_key", None) - if api_key_value and credentials: - raise ValueError("client_options.api_key and credentials are mutually exclusive") - - # Save or instantiate the transport. - # Ordinarily, we provide the transport, but allowing a custom transport - # instance provides an extensibility point for unusual situations. - if isinstance(transport, CertificateAuthorityServiceTransport): - # transport is a CertificateAuthorityServiceTransport instance. - if credentials or client_options.credentials_file or api_key_value: - raise ValueError("When providing a transport instance, " - "provide its credentials directly.") - if client_options.scopes: - raise ValueError( - "When providing a transport instance, provide its scopes " - "directly." - ) - self._transport = transport - else: - import google.auth._default # type: ignore - - if api_key_value and hasattr(google.auth._default, "get_api_key_credentials"): - credentials = google.auth._default.get_api_key_credentials(api_key_value) - - Transport = type(self).get_transport_class(transport) - self._transport = Transport( - credentials=credentials, - credentials_file=client_options.credentials_file, - host=api_endpoint, - scopes=client_options.scopes, - client_cert_source_for_mtls=client_cert_source_func, - quota_project_id=client_options.quota_project_id, - client_info=client_info, - always_use_jwt_access=True, - api_audience=client_options.api_audience, - ) - - def create_certificate(self, - request: Optional[Union[service.CreateCertificateRequest, dict]] = None, - *, - parent: Optional[str] = None, - certificate: Optional[resources.Certificate] = None, - certificate_id: Optional[str] = None, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), - ) -> resources.Certificate: - r"""Create a new - [Certificate][google.cloud.security.privateca.v1.Certificate] in - a given Project, Location from a particular - [CaPool][google.cloud.security.privateca.v1.CaPool]. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud.security import privateca_v1 - - def sample_create_certificate(): - # Create a client - client = privateca_v1.CertificateAuthorityServiceClient() - - # Initialize request argument(s) - certificate = privateca_v1.Certificate() - certificate.pem_csr = "pem_csr_value" - - request = privateca_v1.CreateCertificateRequest( - parent="parent_value", - certificate=certificate, - ) - - # Make the request - response = client.create_certificate(request=request) - - # Handle the response - print(response) - - Args: - request (Union[google.cloud.security.privateca_v1.types.CreateCertificateRequest, dict]): - The request object. Request message for - [CertificateAuthorityService.CreateCertificate][google.cloud.security.privateca.v1.CertificateAuthorityService.CreateCertificate]. - parent (str): - Required. The resource name of the - [CaPool][google.cloud.security.privateca.v1.CaPool] - associated with the - [Certificate][google.cloud.security.privateca.v1.Certificate], - in the format ``projects/*/locations/*/caPools/*``. - - This corresponds to the ``parent`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - certificate (google.cloud.security.privateca_v1.types.Certificate): - Required. A - [Certificate][google.cloud.security.privateca.v1.Certificate] - with initial field values. - - This corresponds to the ``certificate`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - certificate_id (str): - Optional. It must be unique within a location and match - the regular expression ``[a-zA-Z0-9_-]{1,63}``. This - field is required when using a - [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority] - in the Enterprise [CertificateAuthority.Tier][], but is - optional and its value is ignored otherwise. - - 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. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.cloud.security.privateca_v1.types.Certificate: - A [Certificate][google.cloud.security.privateca.v1.Certificate] corresponds to a signed X.509 certificate issued by a - [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority]. - - """ - # Create or coerce a protobuf request object. - # Quick check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - has_flattened_params = any([parent, certificate, certificate_id]) - if request is not None and has_flattened_params: - raise ValueError('If the `request` argument is set, then none of ' - 'the individual field arguments should be set.') - - # Minor optimization to avoid making a copy if the user passes - # in a service.CreateCertificateRequest. - # There's no risk of modifying the input as we've already verified - # 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: - request.certificate = certificate - if certificate_id is not None: - request.certificate_id = certificate_id - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[self._transport.create_certificate] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata(( - ("parent", request.parent), - )), - ) - - # Send the request. - response = rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Done; return the response. - return response - - def get_certificate(self, - request: Optional[Union[service.GetCertificateRequest, dict]] = None, - *, - name: Optional[str] = None, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), - ) -> resources.Certificate: - r"""Returns a - [Certificate][google.cloud.security.privateca.v1.Certificate]. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud.security import privateca_v1 - - def sample_get_certificate(): - # Create a client - client = privateca_v1.CertificateAuthorityServiceClient() - - # Initialize request argument(s) - request = privateca_v1.GetCertificateRequest( - name="name_value", - ) - - # Make the request - response = client.get_certificate(request=request) - - # Handle the response - print(response) - - Args: - request (Union[google.cloud.security.privateca_v1.types.GetCertificateRequest, dict]): - The request object. Request message for - [CertificateAuthorityService.GetCertificate][google.cloud.security.privateca.v1.CertificateAuthorityService.GetCertificate]. - name (str): - Required. The - [name][google.cloud.security.privateca.v1.Certificate.name] - of the - [Certificate][google.cloud.security.privateca.v1.Certificate] - to get. - - 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. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.cloud.security.privateca_v1.types.Certificate: - A [Certificate][google.cloud.security.privateca.v1.Certificate] corresponds to a signed X.509 certificate issued by a - [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority]. - - """ - # Create or coerce a protobuf request object. - # Quick check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - has_flattened_params = any([name]) - if request is not None and has_flattened_params: - raise ValueError('If the `request` argument is set, then none of ' - 'the individual field arguments should be set.') - - # Minor optimization to avoid making a copy if the user passes - # in a service.GetCertificateRequest. - # There's no risk of modifying the input as we've already verified - # 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 - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[self._transport.get_certificate] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata(( - ("name", request.name), - )), - ) - - # Send the request. - response = rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Done; return the response. - return response - - def list_certificates(self, - request: Optional[Union[service.ListCertificatesRequest, dict]] = None, - *, - parent: Optional[str] = None, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), - ) -> pagers.ListCertificatesPager: - r"""Lists - [Certificates][google.cloud.security.privateca.v1.Certificate]. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud.security import privateca_v1 - - def sample_list_certificates(): - # Create a client - client = privateca_v1.CertificateAuthorityServiceClient() - - # Initialize request argument(s) - request = privateca_v1.ListCertificatesRequest( - parent="parent_value", - ) - - # Make the request - page_result = client.list_certificates(request=request) - - # Handle the response - for response in page_result: - print(response) - - Args: - request (Union[google.cloud.security.privateca_v1.types.ListCertificatesRequest, dict]): - The request object. Request message for - [CertificateAuthorityService.ListCertificates][google.cloud.security.privateca.v1.CertificateAuthorityService.ListCertificates]. - parent (str): - Required. The resource name of the location associated - with the - [Certificates][google.cloud.security.privateca.v1.Certificate], - in the format ``projects/*/locations/*/caPools/*``. - - 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. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.cloud.security.privateca_v1.services.certificate_authority_service.pagers.ListCertificatesPager: - Response message for - [CertificateAuthorityService.ListCertificates][google.cloud.security.privateca.v1.CertificateAuthorityService.ListCertificates]. - - Iterating over this object will yield results and - resolve additional pages automatically. - - """ - # Create or coerce a protobuf request object. - # Quick check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - has_flattened_params = any([parent]) - if request is not None and has_flattened_params: - raise ValueError('If the `request` argument is set, then none of ' - 'the individual field arguments should be set.') - - # Minor optimization to avoid making a copy if the user passes - # in a service.ListCertificatesRequest. - # There's no risk of modifying the input as we've already verified - # 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 - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[self._transport.list_certificates] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata(( - ("parent", request.parent), - )), - ) - - # Send the request. - response = rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # This method is paged; wrap the response in a pager, which provides - # an `__iter__` convenience method. - response = pagers.ListCertificatesPager( - method=rpc, - request=request, - response=response, - metadata=metadata, - ) - - # Done; return the response. - return response - - def revoke_certificate(self, - request: Optional[Union[service.RevokeCertificateRequest, dict]] = None, - *, - name: Optional[str] = None, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), - ) -> resources.Certificate: - r"""Revoke a - [Certificate][google.cloud.security.privateca.v1.Certificate]. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud.security import privateca_v1 - - def sample_revoke_certificate(): - # Create a client - client = privateca_v1.CertificateAuthorityServiceClient() - - # Initialize request argument(s) - request = privateca_v1.RevokeCertificateRequest( - name="name_value", - reason="ATTRIBUTE_AUTHORITY_COMPROMISE", - ) - - # Make the request - response = client.revoke_certificate(request=request) - - # Handle the response - print(response) - - Args: - request (Union[google.cloud.security.privateca_v1.types.RevokeCertificateRequest, dict]): - The request object. Request message for - [CertificateAuthorityService.RevokeCertificate][google.cloud.security.privateca.v1.CertificateAuthorityService.RevokeCertificate]. - name (str): - Required. The resource name for this - [Certificate][google.cloud.security.privateca.v1.Certificate] - in the format - ``projects/*/locations/*/caPools/*/certificates/*``. - - 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. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.cloud.security.privateca_v1.types.Certificate: - A [Certificate][google.cloud.security.privateca.v1.Certificate] corresponds to a signed X.509 certificate issued by a - [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority]. - - """ - # Create or coerce a protobuf request object. - # Quick check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - has_flattened_params = any([name]) - if request is not None and has_flattened_params: - raise ValueError('If the `request` argument is set, then none of ' - 'the individual field arguments should be set.') - - # Minor optimization to avoid making a copy if the user passes - # in a service.RevokeCertificateRequest. - # There's no risk of modifying the input as we've already verified - # 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 - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[self._transport.revoke_certificate] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata(( - ("name", request.name), - )), - ) - - # Send the request. - response = rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Done; return the response. - return response - - def update_certificate(self, - request: Optional[Union[service.UpdateCertificateRequest, dict]] = None, - *, - certificate: Optional[resources.Certificate] = None, - update_mask: Optional[field_mask_pb2.FieldMask] = None, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), - ) -> resources.Certificate: - r"""Update a - [Certificate][google.cloud.security.privateca.v1.Certificate]. - Currently, the only field you can update is the - [labels][google.cloud.security.privateca.v1.Certificate.labels] - field. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud.security import privateca_v1 - - def sample_update_certificate(): - # Create a client - client = privateca_v1.CertificateAuthorityServiceClient() - - # Initialize request argument(s) - certificate = privateca_v1.Certificate() - certificate.pem_csr = "pem_csr_value" - - request = privateca_v1.UpdateCertificateRequest( - certificate=certificate, - ) - - # Make the request - response = client.update_certificate(request=request) - - # Handle the response - print(response) - - Args: - request (Union[google.cloud.security.privateca_v1.types.UpdateCertificateRequest, dict]): - The request object. Request message for - [CertificateAuthorityService.UpdateCertificate][google.cloud.security.privateca.v1.CertificateAuthorityService.UpdateCertificate]. - certificate (google.cloud.security.privateca_v1.types.Certificate): - Required. - [Certificate][google.cloud.security.privateca.v1.Certificate] - with updated values. - - This corresponds to the ``certificate`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - update_mask (google.protobuf.field_mask_pb2.FieldMask): - Required. A list of fields to be - updated in this request. - - 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. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.cloud.security.privateca_v1.types.Certificate: - A [Certificate][google.cloud.security.privateca.v1.Certificate] corresponds to a signed X.509 certificate issued by a - [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority]. - - """ - # Create or coerce a protobuf request object. - # Quick check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - has_flattened_params = any([certificate, update_mask]) - if request is not None and has_flattened_params: - raise ValueError('If the `request` argument is set, then none of ' - 'the individual field arguments should be set.') - - # Minor optimization to avoid making a copy if the user passes - # in a service.UpdateCertificateRequest. - # There's no risk of modifying the input as we've already verified - # 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: - request.update_mask = update_mask - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[self._transport.update_certificate] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata(( - ("certificate.name", request.certificate.name), - )), - ) - - # Send the request. - response = rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Done; return the response. - return response - - def activate_certificate_authority(self, - request: Optional[Union[service.ActivateCertificateAuthorityRequest, dict]] = None, - *, - name: Optional[str] = None, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), - ) -> operation.Operation: - r"""Activate a - [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority] - that is in state - [AWAITING_USER_ACTIVATION][google.cloud.security.privateca.v1.CertificateAuthority.State.AWAITING_USER_ACTIVATION] - and is of type - [SUBORDINATE][google.cloud.security.privateca.v1.CertificateAuthority.Type.SUBORDINATE]. - After the parent Certificate Authority signs a certificate - signing request from - [FetchCertificateAuthorityCsr][google.cloud.security.privateca.v1.CertificateAuthorityService.FetchCertificateAuthorityCsr], - this method can complete the activation process. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud.security import privateca_v1 - - def sample_activate_certificate_authority(): - # Create a client - client = privateca_v1.CertificateAuthorityServiceClient() - - # Initialize request argument(s) - subordinate_config = privateca_v1.SubordinateConfig() - subordinate_config.certificate_authority = "certificate_authority_value" - - request = privateca_v1.ActivateCertificateAuthorityRequest( - name="name_value", - pem_ca_certificate="pem_ca_certificate_value", - subordinate_config=subordinate_config, - ) - - # Make the request - operation = client.activate_certificate_authority(request=request) - - print("Waiting for operation to complete...") - - response = operation.result() - - # Handle the response - print(response) - - Args: - request (Union[google.cloud.security.privateca_v1.types.ActivateCertificateAuthorityRequest, dict]): - The request object. Request message for - [CertificateAuthorityService.ActivateCertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthorityService.ActivateCertificateAuthority]. - name (str): - Required. The resource name for this - [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority] - in the format - ``projects/*/locations/*/caPools/*/certificateAuthorities/*``. - - 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. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.api_core.operation.Operation: - An object representing a long-running operation. - - The result type for the operation will be :class:`google.cloud.security.privateca_v1.types.CertificateAuthority` A [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority] represents an individual Certificate Authority. - A - [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority] - can be used to create - [Certificates][google.cloud.security.privateca.v1.Certificate]. - - """ - # Create or coerce a protobuf request object. - # Quick check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - has_flattened_params = any([name]) - if request is not None and has_flattened_params: - raise ValueError('If the `request` argument is set, then none of ' - 'the individual field arguments should be set.') - - # Minor optimization to avoid making a copy if the user passes - # in a service.ActivateCertificateAuthorityRequest. - # There's no risk of modifying the input as we've already verified - # 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 - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[self._transport.activate_certificate_authority] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata(( - ("name", request.name), - )), - ) - - # Send the request. - response = rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Wrap the response in an operation future. - response = operation.from_gapic( - response, - self._transport.operations_client, - resources.CertificateAuthority, - metadata_type=service.OperationMetadata, - ) - - # Done; return the response. - return response - - def create_certificate_authority(self, - request: Optional[Union[service.CreateCertificateAuthorityRequest, dict]] = None, - *, - parent: Optional[str] = None, - certificate_authority: Optional[resources.CertificateAuthority] = None, - certificate_authority_id: Optional[str] = None, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), - ) -> operation.Operation: - r"""Create a new - [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority] - in a given Project and Location. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud.security import privateca_v1 - - def sample_create_certificate_authority(): - # Create a client - client = privateca_v1.CertificateAuthorityServiceClient() - - # Initialize request argument(s) - certificate_authority = privateca_v1.CertificateAuthority() - certificate_authority.type_ = "SUBORDINATE" - certificate_authority.key_spec.cloud_kms_key_version = "cloud_kms_key_version_value" - - request = privateca_v1.CreateCertificateAuthorityRequest( - parent="parent_value", - certificate_authority_id="certificate_authority_id_value", - certificate_authority=certificate_authority, - ) - - # Make the request - operation = client.create_certificate_authority(request=request) - - print("Waiting for operation to complete...") - - response = operation.result() - - # Handle the response - print(response) - - Args: - request (Union[google.cloud.security.privateca_v1.types.CreateCertificateAuthorityRequest, dict]): - The request object. Request message for - [CertificateAuthorityService.CreateCertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthorityService.CreateCertificateAuthority]. - parent (str): - Required. The resource name of the - [CaPool][google.cloud.security.privateca.v1.CaPool] - associated with the - [CertificateAuthorities][google.cloud.security.privateca.v1.CertificateAuthority], - in the format ``projects/*/locations/*/caPools/*``. - - This corresponds to the ``parent`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - certificate_authority (google.cloud.security.privateca_v1.types.CertificateAuthority): - Required. A - [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority] - with initial field values. - - This corresponds to the ``certificate_authority`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - certificate_authority_id (str): - Required. It must be unique within a location and match - the regular expression ``[a-zA-Z0-9_-]{1,63}`` - - 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. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.api_core.operation.Operation: - An object representing a long-running operation. - - The result type for the operation will be :class:`google.cloud.security.privateca_v1.types.CertificateAuthority` A [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority] represents an individual Certificate Authority. - A - [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority] - can be used to create - [Certificates][google.cloud.security.privateca.v1.Certificate]. - - """ - # Create or coerce a protobuf request object. - # Quick check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - has_flattened_params = any([parent, certificate_authority, certificate_authority_id]) - if request is not None and has_flattened_params: - raise ValueError('If the `request` argument is set, then none of ' - 'the individual field arguments should be set.') - - # Minor optimization to avoid making a copy if the user passes - # in a service.CreateCertificateAuthorityRequest. - # There's no risk of modifying the input as we've already verified - # 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: - request.certificate_authority = certificate_authority - if certificate_authority_id is not None: - request.certificate_authority_id = certificate_authority_id - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[self._transport.create_certificate_authority] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata(( - ("parent", request.parent), - )), - ) - - # Send the request. - response = rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Wrap the response in an operation future. - response = operation.from_gapic( - response, - self._transport.operations_client, - resources.CertificateAuthority, - metadata_type=service.OperationMetadata, - ) - - # Done; return the response. - return response - - def disable_certificate_authority(self, - request: Optional[Union[service.DisableCertificateAuthorityRequest, dict]] = None, - *, - name: Optional[str] = None, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), - ) -> operation.Operation: - r"""Disable a - [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority]. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud.security import privateca_v1 - - def sample_disable_certificate_authority(): - # Create a client - client = privateca_v1.CertificateAuthorityServiceClient() - - # Initialize request argument(s) - request = privateca_v1.DisableCertificateAuthorityRequest( - name="name_value", - ) - - # Make the request - operation = client.disable_certificate_authority(request=request) - - print("Waiting for operation to complete...") - - response = operation.result() - - # Handle the response - print(response) - - Args: - request (Union[google.cloud.security.privateca_v1.types.DisableCertificateAuthorityRequest, dict]): - The request object. Request message for - [CertificateAuthorityService.DisableCertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthorityService.DisableCertificateAuthority]. - name (str): - Required. The resource name for this - [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority] - in the format - ``projects/*/locations/*/caPools/*/certificateAuthorities/*``. - - 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. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.api_core.operation.Operation: - An object representing a long-running operation. - - The result type for the operation will be :class:`google.cloud.security.privateca_v1.types.CertificateAuthority` A [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority] represents an individual Certificate Authority. - A - [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority] - can be used to create - [Certificates][google.cloud.security.privateca.v1.Certificate]. - - """ - # Create or coerce a protobuf request object. - # Quick check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - has_flattened_params = any([name]) - if request is not None and has_flattened_params: - raise ValueError('If the `request` argument is set, then none of ' - 'the individual field arguments should be set.') - - # Minor optimization to avoid making a copy if the user passes - # in a service.DisableCertificateAuthorityRequest. - # There's no risk of modifying the input as we've already verified - # 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 - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[self._transport.disable_certificate_authority] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata(( - ("name", request.name), - )), - ) - - # Send the request. - response = rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Wrap the response in an operation future. - response = operation.from_gapic( - response, - self._transport.operations_client, - resources.CertificateAuthority, - metadata_type=service.OperationMetadata, - ) - - # Done; return the response. - return response - - def enable_certificate_authority(self, - request: Optional[Union[service.EnableCertificateAuthorityRequest, dict]] = None, - *, - name: Optional[str] = None, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), - ) -> operation.Operation: - r"""Enable a - [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority]. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud.security import privateca_v1 - - def sample_enable_certificate_authority(): - # Create a client - client = privateca_v1.CertificateAuthorityServiceClient() - - # Initialize request argument(s) - request = privateca_v1.EnableCertificateAuthorityRequest( - name="name_value", - ) - - # Make the request - operation = client.enable_certificate_authority(request=request) - - print("Waiting for operation to complete...") - - response = operation.result() - - # Handle the response - print(response) - - Args: - request (Union[google.cloud.security.privateca_v1.types.EnableCertificateAuthorityRequest, dict]): - The request object. Request message for - [CertificateAuthorityService.EnableCertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthorityService.EnableCertificateAuthority]. - name (str): - Required. The resource name for this - [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority] - in the format - ``projects/*/locations/*/caPools/*/certificateAuthorities/*``. - - 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. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.api_core.operation.Operation: - An object representing a long-running operation. - - The result type for the operation will be :class:`google.cloud.security.privateca_v1.types.CertificateAuthority` A [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority] represents an individual Certificate Authority. - A - [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority] - can be used to create - [Certificates][google.cloud.security.privateca.v1.Certificate]. - - """ - # Create or coerce a protobuf request object. - # Quick check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - has_flattened_params = any([name]) - if request is not None and has_flattened_params: - raise ValueError('If the `request` argument is set, then none of ' - 'the individual field arguments should be set.') - - # Minor optimization to avoid making a copy if the user passes - # in a service.EnableCertificateAuthorityRequest. - # There's no risk of modifying the input as we've already verified - # 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 - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[self._transport.enable_certificate_authority] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata(( - ("name", request.name), - )), - ) - - # Send the request. - response = rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Wrap the response in an operation future. - response = operation.from_gapic( - response, - self._transport.operations_client, - resources.CertificateAuthority, - metadata_type=service.OperationMetadata, - ) - - # Done; return the response. - return response - - def fetch_certificate_authority_csr(self, - request: Optional[Union[service.FetchCertificateAuthorityCsrRequest, dict]] = None, - *, - name: Optional[str] = None, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), - ) -> service.FetchCertificateAuthorityCsrResponse: - r"""Fetch a certificate signing request (CSR) from a - [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority] - that is in state - [AWAITING_USER_ACTIVATION][google.cloud.security.privateca.v1.CertificateAuthority.State.AWAITING_USER_ACTIVATION] - and is of type - [SUBORDINATE][google.cloud.security.privateca.v1.CertificateAuthority.Type.SUBORDINATE]. - The CSR must then be signed by the desired parent Certificate - Authority, which could be another - [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority] - resource, or could be an on-prem certificate authority. See also - [ActivateCertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthorityService.ActivateCertificateAuthority]. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud.security import privateca_v1 - - def sample_fetch_certificate_authority_csr(): - # Create a client - client = privateca_v1.CertificateAuthorityServiceClient() - - # Initialize request argument(s) - request = privateca_v1.FetchCertificateAuthorityCsrRequest( - name="name_value", - ) - - # Make the request - response = client.fetch_certificate_authority_csr(request=request) - - # Handle the response - print(response) - - Args: - request (Union[google.cloud.security.privateca_v1.types.FetchCertificateAuthorityCsrRequest, dict]): - The request object. Request message for - [CertificateAuthorityService.FetchCertificateAuthorityCsr][google.cloud.security.privateca.v1.CertificateAuthorityService.FetchCertificateAuthorityCsr]. - name (str): - Required. The resource name for this - [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority] - in the format - ``projects/*/locations/*/caPools/*/certificateAuthorities/*``. - - 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. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.cloud.security.privateca_v1.types.FetchCertificateAuthorityCsrResponse: - Response message for - [CertificateAuthorityService.FetchCertificateAuthorityCsr][google.cloud.security.privateca.v1.CertificateAuthorityService.FetchCertificateAuthorityCsr]. - - """ - # Create or coerce a protobuf request object. - # Quick check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - has_flattened_params = any([name]) - if request is not None and has_flattened_params: - raise ValueError('If the `request` argument is set, then none of ' - 'the individual field arguments should be set.') - - # Minor optimization to avoid making a copy if the user passes - # in a service.FetchCertificateAuthorityCsrRequest. - # There's no risk of modifying the input as we've already verified - # 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 - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[self._transport.fetch_certificate_authority_csr] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata(( - ("name", request.name), - )), - ) - - # Send the request. - response = rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Done; return the response. - return response - - def get_certificate_authority(self, - request: Optional[Union[service.GetCertificateAuthorityRequest, dict]] = None, - *, - name: Optional[str] = None, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), - ) -> resources.CertificateAuthority: - r"""Returns a - [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority]. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud.security import privateca_v1 - - def sample_get_certificate_authority(): - # Create a client - client = privateca_v1.CertificateAuthorityServiceClient() - - # Initialize request argument(s) - request = privateca_v1.GetCertificateAuthorityRequest( - name="name_value", - ) - - # Make the request - response = client.get_certificate_authority(request=request) - - # Handle the response - print(response) - - Args: - request (Union[google.cloud.security.privateca_v1.types.GetCertificateAuthorityRequest, dict]): - The request object. Request message for - [CertificateAuthorityService.GetCertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthorityService.GetCertificateAuthority]. - name (str): - Required. The - [name][google.cloud.security.privateca.v1.CertificateAuthority.name] - of the - [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority] - to get. - - 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. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.cloud.security.privateca_v1.types.CertificateAuthority: - A [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority] represents an individual Certificate Authority. - A - [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority] - can be used to create - [Certificates][google.cloud.security.privateca.v1.Certificate]. - - """ - # Create or coerce a protobuf request object. - # Quick check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - has_flattened_params = any([name]) - if request is not None and has_flattened_params: - raise ValueError('If the `request` argument is set, then none of ' - 'the individual field arguments should be set.') - - # Minor optimization to avoid making a copy if the user passes - # in a service.GetCertificateAuthorityRequest. - # There's no risk of modifying the input as we've already verified - # 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 - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[self._transport.get_certificate_authority] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata(( - ("name", request.name), - )), - ) - - # Send the request. - response = rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Done; return the response. - return response - - def list_certificate_authorities(self, - request: Optional[Union[service.ListCertificateAuthoritiesRequest, dict]] = None, - *, - parent: Optional[str] = None, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), - ) -> pagers.ListCertificateAuthoritiesPager: - r"""Lists - [CertificateAuthorities][google.cloud.security.privateca.v1.CertificateAuthority]. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud.security import privateca_v1 - - def sample_list_certificate_authorities(): - # Create a client - client = privateca_v1.CertificateAuthorityServiceClient() - - # Initialize request argument(s) - request = privateca_v1.ListCertificateAuthoritiesRequest( - parent="parent_value", - ) - - # Make the request - page_result = client.list_certificate_authorities(request=request) - - # Handle the response - for response in page_result: - print(response) - - Args: - request (Union[google.cloud.security.privateca_v1.types.ListCertificateAuthoritiesRequest, dict]): - The request object. Request message for - [CertificateAuthorityService.ListCertificateAuthorities][google.cloud.security.privateca.v1.CertificateAuthorityService.ListCertificateAuthorities]. - parent (str): - Required. The resource name of the - [CaPool][google.cloud.security.privateca.v1.CaPool] - associated with the - [CertificateAuthorities][google.cloud.security.privateca.v1.CertificateAuthority], - in the format ``projects/*/locations/*/caPools/*``. - - 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. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.cloud.security.privateca_v1.services.certificate_authority_service.pagers.ListCertificateAuthoritiesPager: - Response message for - [CertificateAuthorityService.ListCertificateAuthorities][google.cloud.security.privateca.v1.CertificateAuthorityService.ListCertificateAuthorities]. - - Iterating over this object will yield results and - resolve additional pages automatically. - - """ - # Create or coerce a protobuf request object. - # Quick check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - has_flattened_params = any([parent]) - if request is not None and has_flattened_params: - raise ValueError('If the `request` argument is set, then none of ' - 'the individual field arguments should be set.') - - # Minor optimization to avoid making a copy if the user passes - # in a service.ListCertificateAuthoritiesRequest. - # There's no risk of modifying the input as we've already verified - # 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 - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[self._transport.list_certificate_authorities] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata(( - ("parent", request.parent), - )), - ) - - # Send the request. - response = rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # This method is paged; wrap the response in a pager, which provides - # an `__iter__` convenience method. - response = pagers.ListCertificateAuthoritiesPager( - method=rpc, - request=request, - response=response, - metadata=metadata, - ) - - # Done; return the response. - return response - - def undelete_certificate_authority(self, - request: Optional[Union[service.UndeleteCertificateAuthorityRequest, dict]] = None, - *, - name: Optional[str] = None, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), - ) -> operation.Operation: - r"""Undelete a - [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority] - that has been deleted. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud.security import privateca_v1 - - def sample_undelete_certificate_authority(): - # Create a client - client = privateca_v1.CertificateAuthorityServiceClient() - - # Initialize request argument(s) - request = privateca_v1.UndeleteCertificateAuthorityRequest( - name="name_value", - ) - - # Make the request - operation = client.undelete_certificate_authority(request=request) - - print("Waiting for operation to complete...") - - response = operation.result() - - # Handle the response - print(response) - - Args: - request (Union[google.cloud.security.privateca_v1.types.UndeleteCertificateAuthorityRequest, dict]): - The request object. Request message for - [CertificateAuthorityService.UndeleteCertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthorityService.UndeleteCertificateAuthority]. - name (str): - Required. The resource name for this - [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority] - in the format - ``projects/*/locations/*/caPools/*/certificateAuthorities/*``. - - 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. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.api_core.operation.Operation: - An object representing a long-running operation. - - The result type for the operation will be :class:`google.cloud.security.privateca_v1.types.CertificateAuthority` A [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority] represents an individual Certificate Authority. - A - [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority] - can be used to create - [Certificates][google.cloud.security.privateca.v1.Certificate]. - - """ - # Create or coerce a protobuf request object. - # Quick check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - has_flattened_params = any([name]) - if request is not None and has_flattened_params: - raise ValueError('If the `request` argument is set, then none of ' - 'the individual field arguments should be set.') - - # Minor optimization to avoid making a copy if the user passes - # in a service.UndeleteCertificateAuthorityRequest. - # There's no risk of modifying the input as we've already verified - # 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 - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[self._transport.undelete_certificate_authority] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata(( - ("name", request.name), - )), - ) - - # Send the request. - response = rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Wrap the response in an operation future. - response = operation.from_gapic( - response, - self._transport.operations_client, - resources.CertificateAuthority, - metadata_type=service.OperationMetadata, - ) - - # Done; return the response. - return response - - def delete_certificate_authority(self, - request: Optional[Union[service.DeleteCertificateAuthorityRequest, dict]] = None, - *, - name: Optional[str] = None, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), - ) -> operation.Operation: - r"""Delete a - [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority]. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud.security import privateca_v1 - - def sample_delete_certificate_authority(): - # Create a client - client = privateca_v1.CertificateAuthorityServiceClient() - - # Initialize request argument(s) - request = privateca_v1.DeleteCertificateAuthorityRequest( - name="name_value", - ) - - # Make the request - operation = client.delete_certificate_authority(request=request) - - print("Waiting for operation to complete...") - - response = operation.result() - - # Handle the response - print(response) - - Args: - request (Union[google.cloud.security.privateca_v1.types.DeleteCertificateAuthorityRequest, dict]): - The request object. Request message for - [CertificateAuthorityService.DeleteCertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthorityService.DeleteCertificateAuthority]. - name (str): - Required. The resource name for this - [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority] - in the format - ``projects/*/locations/*/caPools/*/certificateAuthorities/*``. - - 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. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.api_core.operation.Operation: - An object representing a long-running operation. - - The result type for the operation will be :class:`google.cloud.security.privateca_v1.types.CertificateAuthority` A [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority] represents an individual Certificate Authority. - A - [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority] - can be used to create - [Certificates][google.cloud.security.privateca.v1.Certificate]. - - """ - # Create or coerce a protobuf request object. - # Quick check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - has_flattened_params = any([name]) - if request is not None and has_flattened_params: - raise ValueError('If the `request` argument is set, then none of ' - 'the individual field arguments should be set.') - - # Minor optimization to avoid making a copy if the user passes - # in a service.DeleteCertificateAuthorityRequest. - # There's no risk of modifying the input as we've already verified - # 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 - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[self._transport.delete_certificate_authority] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata(( - ("name", request.name), - )), - ) - - # Send the request. - response = rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Wrap the response in an operation future. - response = operation.from_gapic( - response, - self._transport.operations_client, - resources.CertificateAuthority, - metadata_type=service.OperationMetadata, - ) - - # Done; return the response. - return response - - def update_certificate_authority(self, - request: Optional[Union[service.UpdateCertificateAuthorityRequest, dict]] = None, - *, - certificate_authority: Optional[resources.CertificateAuthority] = None, - update_mask: Optional[field_mask_pb2.FieldMask] = None, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), - ) -> operation.Operation: - r"""Update a - [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority]. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud.security import privateca_v1 - - def sample_update_certificate_authority(): - # Create a client - client = privateca_v1.CertificateAuthorityServiceClient() - - # Initialize request argument(s) - certificate_authority = privateca_v1.CertificateAuthority() - certificate_authority.type_ = "SUBORDINATE" - certificate_authority.key_spec.cloud_kms_key_version = "cloud_kms_key_version_value" - - request = privateca_v1.UpdateCertificateAuthorityRequest( - certificate_authority=certificate_authority, - ) - - # Make the request - operation = client.update_certificate_authority(request=request) - - print("Waiting for operation to complete...") - - response = operation.result() - - # Handle the response - print(response) - - Args: - request (Union[google.cloud.security.privateca_v1.types.UpdateCertificateAuthorityRequest, dict]): - The request object. Request message for - [CertificateAuthorityService.UpdateCertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthorityService.UpdateCertificateAuthority]. - certificate_authority (google.cloud.security.privateca_v1.types.CertificateAuthority): - Required. - [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority] - with updated values. - - This corresponds to the ``certificate_authority`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - update_mask (google.protobuf.field_mask_pb2.FieldMask): - Required. A list of fields to be - updated in this request. - - 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. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.api_core.operation.Operation: - An object representing a long-running operation. - - The result type for the operation will be :class:`google.cloud.security.privateca_v1.types.CertificateAuthority` A [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority] represents an individual Certificate Authority. - A - [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority] - can be used to create - [Certificates][google.cloud.security.privateca.v1.Certificate]. - - """ - # Create or coerce a protobuf request object. - # Quick check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - has_flattened_params = any([certificate_authority, update_mask]) - if request is not None and has_flattened_params: - raise ValueError('If the `request` argument is set, then none of ' - 'the individual field arguments should be set.') - - # Minor optimization to avoid making a copy if the user passes - # in a service.UpdateCertificateAuthorityRequest. - # There's no risk of modifying the input as we've already verified - # 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: - request.update_mask = update_mask - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[self._transport.update_certificate_authority] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata(( - ("certificate_authority.name", request.certificate_authority.name), - )), - ) - - # Send the request. - response = rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Wrap the response in an operation future. - response = operation.from_gapic( - response, - self._transport.operations_client, - resources.CertificateAuthority, - metadata_type=service.OperationMetadata, - ) - - # Done; return the response. - return response - - def create_ca_pool(self, - request: Optional[Union[service.CreateCaPoolRequest, dict]] = None, - *, - parent: Optional[str] = None, - ca_pool: Optional[resources.CaPool] = None, - ca_pool_id: Optional[str] = None, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), - ) -> operation.Operation: - r"""Create a [CaPool][google.cloud.security.privateca.v1.CaPool]. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud.security import privateca_v1 - - def sample_create_ca_pool(): - # Create a client - client = privateca_v1.CertificateAuthorityServiceClient() - - # Initialize request argument(s) - ca_pool = privateca_v1.CaPool() - ca_pool.tier = "DEVOPS" - - request = privateca_v1.CreateCaPoolRequest( - parent="parent_value", - ca_pool_id="ca_pool_id_value", - ca_pool=ca_pool, - ) - - # Make the request - operation = client.create_ca_pool(request=request) - - print("Waiting for operation to complete...") - - response = operation.result() - - # Handle the response - print(response) - - Args: - request (Union[google.cloud.security.privateca_v1.types.CreateCaPoolRequest, dict]): - The request object. Request message for - [CertificateAuthorityService.CreateCaPool][google.cloud.security.privateca.v1.CertificateAuthorityService.CreateCaPool]. - parent (str): - Required. The resource name of the location associated - with the - [CaPool][google.cloud.security.privateca.v1.CaPool], in - the format ``projects/*/locations/*``. - - This corresponds to the ``parent`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - ca_pool (google.cloud.security.privateca_v1.types.CaPool): - Required. A - [CaPool][google.cloud.security.privateca.v1.CaPool] with - initial field values. - - This corresponds to the ``ca_pool`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - ca_pool_id (str): - Required. It must be unique within a location and match - the regular expression ``[a-zA-Z0-9_-]{1,63}`` - - 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. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.api_core.operation.Operation: - An object representing a long-running operation. - - The result type for the operation will be :class:`google.cloud.security.privateca_v1.types.CaPool` A [CaPool][google.cloud.security.privateca.v1.CaPool] represents a group of - [CertificateAuthorities][google.cloud.security.privateca.v1.CertificateAuthority] - that form a trust anchor. A - [CaPool][google.cloud.security.privateca.v1.CaPool] - can be used to manage issuance policies for one or - more - [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority] - resources and to rotate CA certificates in and out of - the trust anchor. - - """ - # Create or coerce a protobuf request object. - # Quick check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - has_flattened_params = any([parent, ca_pool, ca_pool_id]) - if request is not None and has_flattened_params: - raise ValueError('If the `request` argument is set, then none of ' - 'the individual field arguments should be set.') - - # Minor optimization to avoid making a copy if the user passes - # in a service.CreateCaPoolRequest. - # There's no risk of modifying the input as we've already verified - # 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: - request.ca_pool = ca_pool - if ca_pool_id is not None: - request.ca_pool_id = ca_pool_id - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[self._transport.create_ca_pool] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata(( - ("parent", request.parent), - )), - ) - - # Send the request. - response = rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Wrap the response in an operation future. - response = operation.from_gapic( - response, - self._transport.operations_client, - resources.CaPool, - metadata_type=service.OperationMetadata, - ) - - # Done; return the response. - return response - - def update_ca_pool(self, - request: Optional[Union[service.UpdateCaPoolRequest, dict]] = None, - *, - ca_pool: Optional[resources.CaPool] = None, - update_mask: Optional[field_mask_pb2.FieldMask] = None, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), - ) -> operation.Operation: - r"""Update a [CaPool][google.cloud.security.privateca.v1.CaPool]. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud.security import privateca_v1 - - def sample_update_ca_pool(): - # Create a client - client = privateca_v1.CertificateAuthorityServiceClient() - - # Initialize request argument(s) - ca_pool = privateca_v1.CaPool() - ca_pool.tier = "DEVOPS" - - request = privateca_v1.UpdateCaPoolRequest( - ca_pool=ca_pool, - ) - - # Make the request - operation = client.update_ca_pool(request=request) - - print("Waiting for operation to complete...") - - response = operation.result() - - # Handle the response - print(response) - - Args: - request (Union[google.cloud.security.privateca_v1.types.UpdateCaPoolRequest, dict]): - The request object. Request message for - [CertificateAuthorityService.UpdateCaPool][google.cloud.security.privateca.v1.CertificateAuthorityService.UpdateCaPool]. - ca_pool (google.cloud.security.privateca_v1.types.CaPool): - Required. - [CaPool][google.cloud.security.privateca.v1.CaPool] with - updated values. - - This corresponds to the ``ca_pool`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - update_mask (google.protobuf.field_mask_pb2.FieldMask): - Required. A list of fields to be - updated in this request. - - 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. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.api_core.operation.Operation: - An object representing a long-running operation. - - The result type for the operation will be :class:`google.cloud.security.privateca_v1.types.CaPool` A [CaPool][google.cloud.security.privateca.v1.CaPool] represents a group of - [CertificateAuthorities][google.cloud.security.privateca.v1.CertificateAuthority] - that form a trust anchor. A - [CaPool][google.cloud.security.privateca.v1.CaPool] - can be used to manage issuance policies for one or - more - [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority] - resources and to rotate CA certificates in and out of - the trust anchor. - - """ - # Create or coerce a protobuf request object. - # Quick check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - has_flattened_params = any([ca_pool, update_mask]) - if request is not None and has_flattened_params: - raise ValueError('If the `request` argument is set, then none of ' - 'the individual field arguments should be set.') - - # Minor optimization to avoid making a copy if the user passes - # in a service.UpdateCaPoolRequest. - # There's no risk of modifying the input as we've already verified - # 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: - request.update_mask = update_mask - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[self._transport.update_ca_pool] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata(( - ("ca_pool.name", request.ca_pool.name), - )), - ) - - # Send the request. - response = rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Wrap the response in an operation future. - response = operation.from_gapic( - response, - self._transport.operations_client, - resources.CaPool, - metadata_type=service.OperationMetadata, - ) - - # Done; return the response. - return response - - def get_ca_pool(self, - request: Optional[Union[service.GetCaPoolRequest, dict]] = None, - *, - name: Optional[str] = None, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), - ) -> resources.CaPool: - r"""Returns a [CaPool][google.cloud.security.privateca.v1.CaPool]. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud.security import privateca_v1 - - def sample_get_ca_pool(): - # Create a client - client = privateca_v1.CertificateAuthorityServiceClient() - - # Initialize request argument(s) - request = privateca_v1.GetCaPoolRequest( - name="name_value", - ) - - # Make the request - response = client.get_ca_pool(request=request) - - # Handle the response - print(response) - - Args: - request (Union[google.cloud.security.privateca_v1.types.GetCaPoolRequest, dict]): - The request object. Request message for - [CertificateAuthorityService.GetCaPool][google.cloud.security.privateca.v1.CertificateAuthorityService.GetCaPool]. - name (str): - Required. The - [name][google.cloud.security.privateca.v1.CaPool.name] - of the - [CaPool][google.cloud.security.privateca.v1.CaPool] to - get. - - 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. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.cloud.security.privateca_v1.types.CaPool: - A [CaPool][google.cloud.security.privateca.v1.CaPool] represents a group of - [CertificateAuthorities][google.cloud.security.privateca.v1.CertificateAuthority] - that form a trust anchor. A - [CaPool][google.cloud.security.privateca.v1.CaPool] - can be used to manage issuance policies for one or - more - [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority] - resources and to rotate CA certificates in and out of - the trust anchor. - - """ - # Create or coerce a protobuf request object. - # Quick check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - has_flattened_params = any([name]) - if request is not None and has_flattened_params: - raise ValueError('If the `request` argument is set, then none of ' - 'the individual field arguments should be set.') - - # Minor optimization to avoid making a copy if the user passes - # in a service.GetCaPoolRequest. - # There's no risk of modifying the input as we've already verified - # 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 - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[self._transport.get_ca_pool] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata(( - ("name", request.name), - )), - ) - - # Send the request. - response = rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Done; return the response. - return response - - def list_ca_pools(self, - request: Optional[Union[service.ListCaPoolsRequest, dict]] = None, - *, - parent: Optional[str] = None, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), - ) -> pagers.ListCaPoolsPager: - r"""Lists [CaPools][google.cloud.security.privateca.v1.CaPool]. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud.security import privateca_v1 - - def sample_list_ca_pools(): - # Create a client - client = privateca_v1.CertificateAuthorityServiceClient() - - # Initialize request argument(s) - request = privateca_v1.ListCaPoolsRequest( - parent="parent_value", - ) - - # Make the request - page_result = client.list_ca_pools(request=request) - - # Handle the response - for response in page_result: - print(response) - - Args: - request (Union[google.cloud.security.privateca_v1.types.ListCaPoolsRequest, dict]): - The request object. Request message for - [CertificateAuthorityService.ListCaPools][google.cloud.security.privateca.v1.CertificateAuthorityService.ListCaPools]. - parent (str): - Required. The resource name of the location associated - with the - [CaPools][google.cloud.security.privateca.v1.CaPool], in - the format ``projects/*/locations/*``. - - 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. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.cloud.security.privateca_v1.services.certificate_authority_service.pagers.ListCaPoolsPager: - Response message for - [CertificateAuthorityService.ListCaPools][google.cloud.security.privateca.v1.CertificateAuthorityService.ListCaPools]. - - Iterating over this object will yield results and - resolve additional pages automatically. - - """ - # Create or coerce a protobuf request object. - # Quick check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - has_flattened_params = any([parent]) - if request is not None and has_flattened_params: - raise ValueError('If the `request` argument is set, then none of ' - 'the individual field arguments should be set.') - - # Minor optimization to avoid making a copy if the user passes - # in a service.ListCaPoolsRequest. - # There's no risk of modifying the input as we've already verified - # 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 - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[self._transport.list_ca_pools] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata(( - ("parent", request.parent), - )), - ) - - # Send the request. - response = rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # This method is paged; wrap the response in a pager, which provides - # an `__iter__` convenience method. - response = pagers.ListCaPoolsPager( - method=rpc, - request=request, - response=response, - metadata=metadata, - ) - - # Done; return the response. - return response - - def delete_ca_pool(self, - request: Optional[Union[service.DeleteCaPoolRequest, dict]] = None, - *, - name: Optional[str] = None, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), - ) -> operation.Operation: - r"""Delete a [CaPool][google.cloud.security.privateca.v1.CaPool]. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud.security import privateca_v1 - - def sample_delete_ca_pool(): - # Create a client - client = privateca_v1.CertificateAuthorityServiceClient() - - # Initialize request argument(s) - request = privateca_v1.DeleteCaPoolRequest( - name="name_value", - ) - - # Make the request - operation = client.delete_ca_pool(request=request) - - print("Waiting for operation to complete...") - - response = operation.result() - - # Handle the response - print(response) - - Args: - request (Union[google.cloud.security.privateca_v1.types.DeleteCaPoolRequest, dict]): - The request object. Request message for - [CertificateAuthorityService.DeleteCaPool][google.cloud.security.privateca.v1.CertificateAuthorityService.DeleteCaPool]. - name (str): - Required. The resource name for this - [CaPool][google.cloud.security.privateca.v1.CaPool] in - the format ``projects/*/locations/*/caPools/*``. - - 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. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.api_core.operation.Operation: - An object representing a long-running operation. - - The result type for the operation will be :class:`google.protobuf.empty_pb2.Empty` A generic empty message that you can re-use to avoid defining duplicated - empty messages in your APIs. A typical example is to - use it as the request or the response type of an API - method. For instance: - - service Foo { - rpc Bar(google.protobuf.Empty) returns - (google.protobuf.Empty); - - } - - """ - # Create or coerce a protobuf request object. - # Quick check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - has_flattened_params = any([name]) - if request is not None and has_flattened_params: - raise ValueError('If the `request` argument is set, then none of ' - 'the individual field arguments should be set.') - - # Minor optimization to avoid making a copy if the user passes - # in a service.DeleteCaPoolRequest. - # There's no risk of modifying the input as we've already verified - # 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 - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[self._transport.delete_ca_pool] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata(( - ("name", request.name), - )), - ) - - # Send the request. - response = rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Wrap the response in an operation future. - response = operation.from_gapic( - response, - self._transport.operations_client, - empty_pb2.Empty, - metadata_type=service.OperationMetadata, - ) - - # Done; return the response. - return response - - def fetch_ca_certs(self, - request: Optional[Union[service.FetchCaCertsRequest, dict]] = None, - *, - ca_pool: Optional[str] = None, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), - ) -> service.FetchCaCertsResponse: - r"""FetchCaCerts returns the current trust anchor for the - [CaPool][google.cloud.security.privateca.v1.CaPool]. This will - include CA certificate chains for all ACTIVE - [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority] - resources in the - [CaPool][google.cloud.security.privateca.v1.CaPool]. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud.security import privateca_v1 - - def sample_fetch_ca_certs(): - # Create a client - client = privateca_v1.CertificateAuthorityServiceClient() - - # Initialize request argument(s) - request = privateca_v1.FetchCaCertsRequest( - ca_pool="ca_pool_value", - ) - - # Make the request - response = client.fetch_ca_certs(request=request) - - # Handle the response - print(response) - - Args: - request (Union[google.cloud.security.privateca_v1.types.FetchCaCertsRequest, dict]): - The request object. Request message for - [CertificateAuthorityService.FetchCaCerts][google.cloud.security.privateca.v1.CertificateAuthorityService.FetchCaCerts]. - ca_pool (str): - Required. The resource name for the - [CaPool][google.cloud.security.privateca.v1.CaPool] in - the format ``projects/*/locations/*/caPools/*``. - - 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. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.cloud.security.privateca_v1.types.FetchCaCertsResponse: - Response message for - [CertificateAuthorityService.FetchCaCerts][google.cloud.security.privateca.v1.CertificateAuthorityService.FetchCaCerts]. - - """ - # Create or coerce a protobuf request object. - # Quick check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - has_flattened_params = any([ca_pool]) - if request is not None and has_flattened_params: - raise ValueError('If the `request` argument is set, then none of ' - 'the individual field arguments should be set.') - - # Minor optimization to avoid making a copy if the user passes - # in a service.FetchCaCertsRequest. - # There's no risk of modifying the input as we've already verified - # 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 - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[self._transport.fetch_ca_certs] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata(( - ("ca_pool", request.ca_pool), - )), - ) - - # Send the request. - response = rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Done; return the response. - return response - - def get_certificate_revocation_list(self, - request: Optional[Union[service.GetCertificateRevocationListRequest, dict]] = None, - *, - name: Optional[str] = None, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), - ) -> resources.CertificateRevocationList: - r"""Returns a - [CertificateRevocationList][google.cloud.security.privateca.v1.CertificateRevocationList]. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud.security import privateca_v1 - - def sample_get_certificate_revocation_list(): - # Create a client - client = privateca_v1.CertificateAuthorityServiceClient() - - # Initialize request argument(s) - request = privateca_v1.GetCertificateRevocationListRequest( - name="name_value", - ) - - # Make the request - response = client.get_certificate_revocation_list(request=request) - - # Handle the response - print(response) - - Args: - request (Union[google.cloud.security.privateca_v1.types.GetCertificateRevocationListRequest, dict]): - The request object. Request message for - [CertificateAuthorityService.GetCertificateRevocationList][google.cloud.security.privateca.v1.CertificateAuthorityService.GetCertificateRevocationList]. - name (str): - Required. The - [name][google.cloud.security.privateca.v1.CertificateRevocationList.name] - of the - [CertificateRevocationList][google.cloud.security.privateca.v1.CertificateRevocationList] - to get. - - 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. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.cloud.security.privateca_v1.types.CertificateRevocationList: - A [CertificateRevocationList][google.cloud.security.privateca.v1.CertificateRevocationList] corresponds to a signed X.509 certificate - Revocation List (CRL). A CRL contains the serial - numbers of certificates that should no longer be - trusted. - - """ - # Create or coerce a protobuf request object. - # Quick check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - has_flattened_params = any([name]) - if request is not None and has_flattened_params: - raise ValueError('If the `request` argument is set, then none of ' - 'the individual field arguments should be set.') - - # Minor optimization to avoid making a copy if the user passes - # in a service.GetCertificateRevocationListRequest. - # There's no risk of modifying the input as we've already verified - # 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 - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[self._transport.get_certificate_revocation_list] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata(( - ("name", request.name), - )), - ) - - # Send the request. - response = rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Done; return the response. - return response - - def list_certificate_revocation_lists(self, - request: Optional[Union[service.ListCertificateRevocationListsRequest, dict]] = None, - *, - parent: Optional[str] = None, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), - ) -> pagers.ListCertificateRevocationListsPager: - r"""Lists - [CertificateRevocationLists][google.cloud.security.privateca.v1.CertificateRevocationList]. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud.security import privateca_v1 - - def sample_list_certificate_revocation_lists(): - # Create a client - client = privateca_v1.CertificateAuthorityServiceClient() - - # Initialize request argument(s) - request = privateca_v1.ListCertificateRevocationListsRequest( - parent="parent_value", - ) - - # Make the request - page_result = client.list_certificate_revocation_lists(request=request) - - # Handle the response - for response in page_result: - print(response) - - Args: - request (Union[google.cloud.security.privateca_v1.types.ListCertificateRevocationListsRequest, dict]): - The request object. Request message for - [CertificateAuthorityService.ListCertificateRevocationLists][google.cloud.security.privateca.v1.CertificateAuthorityService.ListCertificateRevocationLists]. - parent (str): - Required. The resource name of the location associated - with the - [CertificateRevocationLists][google.cloud.security.privateca.v1.CertificateRevocationList], - in the format - ``projects/*/locations/*/caPools/*/certificateAuthorities/*``. - - 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. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.cloud.security.privateca_v1.services.certificate_authority_service.pagers.ListCertificateRevocationListsPager: - Response message for - [CertificateAuthorityService.ListCertificateRevocationLists][google.cloud.security.privateca.v1.CertificateAuthorityService.ListCertificateRevocationLists]. - - Iterating over this object will yield results and - resolve additional pages automatically. - - """ - # Create or coerce a protobuf request object. - # Quick check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - has_flattened_params = any([parent]) - if request is not None and has_flattened_params: - raise ValueError('If the `request` argument is set, then none of ' - 'the individual field arguments should be set.') - - # Minor optimization to avoid making a copy if the user passes - # in a service.ListCertificateRevocationListsRequest. - # There's no risk of modifying the input as we've already verified - # 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 - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[self._transport.list_certificate_revocation_lists] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata(( - ("parent", request.parent), - )), - ) - - # Send the request. - response = rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # This method is paged; wrap the response in a pager, which provides - # an `__iter__` convenience method. - response = pagers.ListCertificateRevocationListsPager( - method=rpc, - request=request, - response=response, - metadata=metadata, - ) - - # Done; return the response. - return response - - def update_certificate_revocation_list(self, - request: Optional[Union[service.UpdateCertificateRevocationListRequest, dict]] = None, - *, - certificate_revocation_list: Optional[resources.CertificateRevocationList] = None, - update_mask: Optional[field_mask_pb2.FieldMask] = None, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), - ) -> operation.Operation: - r"""Update a - [CertificateRevocationList][google.cloud.security.privateca.v1.CertificateRevocationList]. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud.security import privateca_v1 - - def sample_update_certificate_revocation_list(): - # Create a client - client = privateca_v1.CertificateAuthorityServiceClient() - - # Initialize request argument(s) - request = privateca_v1.UpdateCertificateRevocationListRequest( - ) - - # Make the request - operation = client.update_certificate_revocation_list(request=request) - - print("Waiting for operation to complete...") - - response = operation.result() - - # Handle the response - print(response) - - Args: - request (Union[google.cloud.security.privateca_v1.types.UpdateCertificateRevocationListRequest, dict]): - The request object. Request message for - [CertificateAuthorityService.UpdateCertificateRevocationList][google.cloud.security.privateca.v1.CertificateAuthorityService.UpdateCertificateRevocationList]. - certificate_revocation_list (google.cloud.security.privateca_v1.types.CertificateRevocationList): - Required. - [CertificateRevocationList][google.cloud.security.privateca.v1.CertificateRevocationList] - with updated values. - - This corresponds to the ``certificate_revocation_list`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - update_mask (google.protobuf.field_mask_pb2.FieldMask): - Required. A list of fields to be - updated in this request. - - 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. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.api_core.operation.Operation: - An object representing a long-running operation. - - The result type for the operation will be :class:`google.cloud.security.privateca_v1.types.CertificateRevocationList` A [CertificateRevocationList][google.cloud.security.privateca.v1.CertificateRevocationList] corresponds to a signed X.509 certificate - Revocation List (CRL). A CRL contains the serial - numbers of certificates that should no longer be - trusted. - - """ - # Create or coerce a protobuf request object. - # Quick check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - has_flattened_params = any([certificate_revocation_list, update_mask]) - if request is not None and has_flattened_params: - raise ValueError('If the `request` argument is set, then none of ' - 'the individual field arguments should be set.') - - # Minor optimization to avoid making a copy if the user passes - # in a service.UpdateCertificateRevocationListRequest. - # There's no risk of modifying the input as we've already verified - # 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: - request.update_mask = update_mask - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[self._transport.update_certificate_revocation_list] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata(( - ("certificate_revocation_list.name", request.certificate_revocation_list.name), - )), - ) - - # Send the request. - response = rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Wrap the response in an operation future. - response = operation.from_gapic( - response, - self._transport.operations_client, - resources.CertificateRevocationList, - metadata_type=service.OperationMetadata, - ) - - # Done; return the response. - return response - - def create_certificate_template(self, - request: Optional[Union[service.CreateCertificateTemplateRequest, dict]] = None, - *, - parent: Optional[str] = None, - certificate_template: Optional[resources.CertificateTemplate] = None, - certificate_template_id: Optional[str] = None, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), - ) -> operation.Operation: - r"""Create a new - [CertificateTemplate][google.cloud.security.privateca.v1.CertificateTemplate] - in a given Project and Location. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud.security import privateca_v1 - - def sample_create_certificate_template(): - # Create a client - client = privateca_v1.CertificateAuthorityServiceClient() - - # Initialize request argument(s) - request = privateca_v1.CreateCertificateTemplateRequest( - parent="parent_value", - certificate_template_id="certificate_template_id_value", - ) - - # Make the request - operation = client.create_certificate_template(request=request) - - print("Waiting for operation to complete...") - - response = operation.result() - - # Handle the response - print(response) - - Args: - request (Union[google.cloud.security.privateca_v1.types.CreateCertificateTemplateRequest, dict]): - The request object. Request message for - [CertificateAuthorityService.CreateCertificateTemplate][google.cloud.security.privateca.v1.CertificateAuthorityService.CreateCertificateTemplate]. - parent (str): - Required. The resource name of the location associated - with the - [CertificateTemplate][google.cloud.security.privateca.v1.CertificateTemplate], - in the format ``projects/*/locations/*``. - - This corresponds to the ``parent`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - certificate_template (google.cloud.security.privateca_v1.types.CertificateTemplate): - Required. A - [CertificateTemplate][google.cloud.security.privateca.v1.CertificateTemplate] - with initial field values. - - This corresponds to the ``certificate_template`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - certificate_template_id (str): - Required. It must be unique within a location and match - the regular expression ``[a-zA-Z0-9_-]{1,63}`` - - 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. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.api_core.operation.Operation: - An object representing a long-running operation. - - The result type for the operation will be :class:`google.cloud.security.privateca_v1.types.CertificateTemplate` A [CertificateTemplate][google.cloud.security.privateca.v1.CertificateTemplate] refers to a managed template for certificate - issuance. - - """ - # Create or coerce a protobuf request object. - # Quick check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - has_flattened_params = any([parent, certificate_template, certificate_template_id]) - if request is not None and has_flattened_params: - raise ValueError('If the `request` argument is set, then none of ' - 'the individual field arguments should be set.') - - # Minor optimization to avoid making a copy if the user passes - # in a service.CreateCertificateTemplateRequest. - # There's no risk of modifying the input as we've already verified - # 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: - request.certificate_template = certificate_template - if certificate_template_id is not None: - request.certificate_template_id = certificate_template_id - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[self._transport.create_certificate_template] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata(( - ("parent", request.parent), - )), - ) - - # Send the request. - response = rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Wrap the response in an operation future. - response = operation.from_gapic( - response, - self._transport.operations_client, - resources.CertificateTemplate, - metadata_type=service.OperationMetadata, - ) - - # Done; return the response. - return response - - def delete_certificate_template(self, - request: Optional[Union[service.DeleteCertificateTemplateRequest, dict]] = None, - *, - name: Optional[str] = None, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), - ) -> operation.Operation: - r"""DeleteCertificateTemplate deletes a - [CertificateTemplate][google.cloud.security.privateca.v1.CertificateTemplate]. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud.security import privateca_v1 - - def sample_delete_certificate_template(): - # Create a client - client = privateca_v1.CertificateAuthorityServiceClient() - - # Initialize request argument(s) - request = privateca_v1.DeleteCertificateTemplateRequest( - name="name_value", - ) - - # Make the request - operation = client.delete_certificate_template(request=request) - - print("Waiting for operation to complete...") - - response = operation.result() - - # Handle the response - print(response) - - Args: - request (Union[google.cloud.security.privateca_v1.types.DeleteCertificateTemplateRequest, dict]): - The request object. Request message for - [CertificateAuthorityService.DeleteCertificateTemplate][google.cloud.security.privateca.v1.CertificateAuthorityService.DeleteCertificateTemplate]. - name (str): - Required. The resource name for this - [CertificateTemplate][google.cloud.security.privateca.v1.CertificateTemplate] - in the format - ``projects/*/locations/*/certificateTemplates/*``. - - 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. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.api_core.operation.Operation: - An object representing a long-running operation. - - The result type for the operation will be :class:`google.protobuf.empty_pb2.Empty` A generic empty message that you can re-use to avoid defining duplicated - empty messages in your APIs. A typical example is to - use it as the request or the response type of an API - method. For instance: - - service Foo { - rpc Bar(google.protobuf.Empty) returns - (google.protobuf.Empty); - - } - - """ - # Create or coerce a protobuf request object. - # Quick check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - has_flattened_params = any([name]) - if request is not None and has_flattened_params: - raise ValueError('If the `request` argument is set, then none of ' - 'the individual field arguments should be set.') - - # Minor optimization to avoid making a copy if the user passes - # in a service.DeleteCertificateTemplateRequest. - # There's no risk of modifying the input as we've already verified - # 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 - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[self._transport.delete_certificate_template] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata(( - ("name", request.name), - )), - ) - - # Send the request. - response = rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Wrap the response in an operation future. - response = operation.from_gapic( - response, - self._transport.operations_client, - empty_pb2.Empty, - metadata_type=service.OperationMetadata, - ) - - # Done; return the response. - return response - - def get_certificate_template(self, - request: Optional[Union[service.GetCertificateTemplateRequest, dict]] = None, - *, - name: Optional[str] = None, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), - ) -> resources.CertificateTemplate: - r"""Returns a - [CertificateTemplate][google.cloud.security.privateca.v1.CertificateTemplate]. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud.security import privateca_v1 - - def sample_get_certificate_template(): - # Create a client - client = privateca_v1.CertificateAuthorityServiceClient() - - # Initialize request argument(s) - request = privateca_v1.GetCertificateTemplateRequest( - name="name_value", - ) - - # Make the request - response = client.get_certificate_template(request=request) - - # Handle the response - print(response) - - Args: - request (Union[google.cloud.security.privateca_v1.types.GetCertificateTemplateRequest, dict]): - The request object. Request message for - [CertificateAuthorityService.GetCertificateTemplate][google.cloud.security.privateca.v1.CertificateAuthorityService.GetCertificateTemplate]. - name (str): - Required. The - [name][google.cloud.security.privateca.v1.CertificateTemplate.name] - of the - [CertificateTemplate][google.cloud.security.privateca.v1.CertificateTemplate] - to get. - - 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. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.cloud.security.privateca_v1.types.CertificateTemplate: - A [CertificateTemplate][google.cloud.security.privateca.v1.CertificateTemplate] refers to a managed template for certificate - issuance. - - """ - # Create or coerce a protobuf request object. - # Quick check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - has_flattened_params = any([name]) - if request is not None and has_flattened_params: - raise ValueError('If the `request` argument is set, then none of ' - 'the individual field arguments should be set.') - - # Minor optimization to avoid making a copy if the user passes - # in a service.GetCertificateTemplateRequest. - # There's no risk of modifying the input as we've already verified - # 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 - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[self._transport.get_certificate_template] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata(( - ("name", request.name), - )), - ) - - # Send the request. - response = rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Done; return the response. - return response - - def list_certificate_templates(self, - request: Optional[Union[service.ListCertificateTemplatesRequest, dict]] = None, - *, - parent: Optional[str] = None, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), - ) -> pagers.ListCertificateTemplatesPager: - r"""Lists - [CertificateTemplates][google.cloud.security.privateca.v1.CertificateTemplate]. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud.security import privateca_v1 - - def sample_list_certificate_templates(): - # Create a client - client = privateca_v1.CertificateAuthorityServiceClient() - - # Initialize request argument(s) - request = privateca_v1.ListCertificateTemplatesRequest( - parent="parent_value", - ) - - # Make the request - page_result = client.list_certificate_templates(request=request) - - # Handle the response - for response in page_result: - print(response) - - Args: - request (Union[google.cloud.security.privateca_v1.types.ListCertificateTemplatesRequest, dict]): - The request object. Request message for - [CertificateAuthorityService.ListCertificateTemplates][google.cloud.security.privateca.v1.CertificateAuthorityService.ListCertificateTemplates]. - parent (str): - Required. The resource name of the location associated - with the - [CertificateTemplates][google.cloud.security.privateca.v1.CertificateTemplate], - in the format ``projects/*/locations/*``. - - 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. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.cloud.security.privateca_v1.services.certificate_authority_service.pagers.ListCertificateTemplatesPager: - Response message for - [CertificateAuthorityService.ListCertificateTemplates][google.cloud.security.privateca.v1.CertificateAuthorityService.ListCertificateTemplates]. - - Iterating over this object will yield results and - resolve additional pages automatically. - - """ - # Create or coerce a protobuf request object. - # Quick check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - has_flattened_params = any([parent]) - if request is not None and has_flattened_params: - raise ValueError('If the `request` argument is set, then none of ' - 'the individual field arguments should be set.') - - # Minor optimization to avoid making a copy if the user passes - # in a service.ListCertificateTemplatesRequest. - # There's no risk of modifying the input as we've already verified - # 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 - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[self._transport.list_certificate_templates] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata(( - ("parent", request.parent), - )), - ) - - # Send the request. - response = rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # This method is paged; wrap the response in a pager, which provides - # an `__iter__` convenience method. - response = pagers.ListCertificateTemplatesPager( - method=rpc, - request=request, - response=response, - metadata=metadata, - ) - - # Done; return the response. - return response - - def update_certificate_template(self, - request: Optional[Union[service.UpdateCertificateTemplateRequest, dict]] = None, - *, - certificate_template: Optional[resources.CertificateTemplate] = None, - update_mask: Optional[field_mask_pb2.FieldMask] = None, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), - ) -> operation.Operation: - r"""Update a - [CertificateTemplate][google.cloud.security.privateca.v1.CertificateTemplate]. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud.security import privateca_v1 - - def sample_update_certificate_template(): - # Create a client - client = privateca_v1.CertificateAuthorityServiceClient() - - # Initialize request argument(s) - request = privateca_v1.UpdateCertificateTemplateRequest( - ) - - # Make the request - operation = client.update_certificate_template(request=request) - - print("Waiting for operation to complete...") - - response = operation.result() - - # Handle the response - print(response) - - Args: - request (Union[google.cloud.security.privateca_v1.types.UpdateCertificateTemplateRequest, dict]): - The request object. Request message for - [CertificateAuthorityService.UpdateCertificateTemplate][google.cloud.security.privateca.v1.CertificateAuthorityService.UpdateCertificateTemplate]. - certificate_template (google.cloud.security.privateca_v1.types.CertificateTemplate): - Required. - [CertificateTemplate][google.cloud.security.privateca.v1.CertificateTemplate] - with updated values. - - This corresponds to the ``certificate_template`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - update_mask (google.protobuf.field_mask_pb2.FieldMask): - Required. A list of fields to be - updated in this request. - - 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. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.api_core.operation.Operation: - An object representing a long-running operation. - - The result type for the operation will be :class:`google.cloud.security.privateca_v1.types.CertificateTemplate` A [CertificateTemplate][google.cloud.security.privateca.v1.CertificateTemplate] refers to a managed template for certificate - issuance. - - """ - # Create or coerce a protobuf request object. - # Quick check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - has_flattened_params = any([certificate_template, update_mask]) - if request is not None and has_flattened_params: - raise ValueError('If the `request` argument is set, then none of ' - 'the individual field arguments should be set.') - - # Minor optimization to avoid making a copy if the user passes - # in a service.UpdateCertificateTemplateRequest. - # There's no risk of modifying the input as we've already verified - # 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: - request.update_mask = update_mask - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[self._transport.update_certificate_template] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata(( - ("certificate_template.name", request.certificate_template.name), - )), - ) - - # Send the request. - response = rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Wrap the response in an operation future. - response = operation.from_gapic( - response, - self._transport.operations_client, - resources.CertificateTemplate, - metadata_type=service.OperationMetadata, - ) - - # Done; return the response. - return response - - def __enter__(self) -> "CertificateAuthorityServiceClient": - return self - - def __exit__(self, type, value, traceback): - """Releases underlying transport's resources. - - .. warning:: - ONLY use as a context manager if the transport is NOT shared - with other clients! Exiting the with block will CLOSE the transport - and may cause errors in other clients! - """ - self.transport.close() - - - - - - - -DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo(gapic_version=package_version.__version__) - - -__all__ = ( - "CertificateAuthorityServiceClient", -) diff --git a/owl-bot-staging/v1/google/cloud/security/privateca_v1/services/certificate_authority_service/pagers.py b/owl-bot-staging/v1/google/cloud/security/privateca_v1/services/certificate_authority_service/pagers.py deleted file mode 100644 index 25dbab8..0000000 --- a/owl-bot-staging/v1/google/cloud/security/privateca_v1/services/certificate_authority_service/pagers.py +++ /dev/null @@ -1,624 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -from typing import Any, AsyncIterator, Awaitable, Callable, Sequence, Tuple, Optional, Iterator - -from google.cloud.security.privateca_v1.types import resources -from google.cloud.security.privateca_v1.types import service - - -class ListCertificatesPager: - """A pager for iterating through ``list_certificates`` requests. - - This class thinly wraps an initial - :class:`google.cloud.security.privateca_v1.types.ListCertificatesResponse` object, and - provides an ``__iter__`` method to iterate through its - ``certificates`` field. - - If there are more pages, the ``__iter__`` method will make additional - ``ListCertificates`` requests and continue to iterate - through the ``certificates`` field on the - corresponding responses. - - All the usual :class:`google.cloud.security.privateca_v1.types.ListCertificatesResponse` - attributes are available on the pager. If multiple requests are made, only - the most recent response is retained, and thus used for attribute lookup. - """ - def __init__(self, - method: Callable[..., service.ListCertificatesResponse], - request: service.ListCertificatesRequest, - response: service.ListCertificatesResponse, - *, - metadata: Sequence[Tuple[str, str]] = ()): - """Instantiate the pager. - - Args: - method (Callable): The method that was originally called, and - which instantiated this pager. - request (google.cloud.security.privateca_v1.types.ListCertificatesRequest): - The initial request object. - response (google.cloud.security.privateca_v1.types.ListCertificatesResponse): - The initial response object. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - """ - self._method = method - self._request = service.ListCertificatesRequest(request) - self._response = response - self._metadata = metadata - - def __getattr__(self, name: str) -> Any: - return getattr(self._response, name) - - @property - def pages(self) -> Iterator[service.ListCertificatesResponse]: - yield self._response - while self._response.next_page_token: - self._request.page_token = self._response.next_page_token - self._response = self._method(self._request, metadata=self._metadata) - yield self._response - - def __iter__(self) -> Iterator[resources.Certificate]: - for page in self.pages: - yield from page.certificates - - def __repr__(self) -> str: - return '{0}<{1!r}>'.format(self.__class__.__name__, self._response) - - -class ListCertificatesAsyncPager: - """A pager for iterating through ``list_certificates`` requests. - - This class thinly wraps an initial - :class:`google.cloud.security.privateca_v1.types.ListCertificatesResponse` object, and - provides an ``__aiter__`` method to iterate through its - ``certificates`` field. - - If there are more pages, the ``__aiter__`` method will make additional - ``ListCertificates`` requests and continue to iterate - through the ``certificates`` field on the - corresponding responses. - - All the usual :class:`google.cloud.security.privateca_v1.types.ListCertificatesResponse` - attributes are available on the pager. If multiple requests are made, only - the most recent response is retained, and thus used for attribute lookup. - """ - def __init__(self, - method: Callable[..., Awaitable[service.ListCertificatesResponse]], - request: service.ListCertificatesRequest, - response: service.ListCertificatesResponse, - *, - metadata: Sequence[Tuple[str, str]] = ()): - """Instantiates the pager. - - Args: - method (Callable): The method that was originally called, and - which instantiated this pager. - request (google.cloud.security.privateca_v1.types.ListCertificatesRequest): - The initial request object. - response (google.cloud.security.privateca_v1.types.ListCertificatesResponse): - The initial response object. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - """ - self._method = method - self._request = service.ListCertificatesRequest(request) - self._response = response - self._metadata = metadata - - def __getattr__(self, name: str) -> Any: - return getattr(self._response, name) - - @property - async def pages(self) -> AsyncIterator[service.ListCertificatesResponse]: - yield self._response - while self._response.next_page_token: - self._request.page_token = self._response.next_page_token - self._response = await self._method(self._request, metadata=self._metadata) - yield self._response - def __aiter__(self) -> AsyncIterator[resources.Certificate]: - async def async_generator(): - async for page in self.pages: - for response in page.certificates: - yield response - - return async_generator() - - def __repr__(self) -> str: - return '{0}<{1!r}>'.format(self.__class__.__name__, self._response) - - -class ListCertificateAuthoritiesPager: - """A pager for iterating through ``list_certificate_authorities`` requests. - - This class thinly wraps an initial - :class:`google.cloud.security.privateca_v1.types.ListCertificateAuthoritiesResponse` object, and - provides an ``__iter__`` method to iterate through its - ``certificate_authorities`` field. - - If there are more pages, the ``__iter__`` method will make additional - ``ListCertificateAuthorities`` requests and continue to iterate - through the ``certificate_authorities`` field on the - corresponding responses. - - All the usual :class:`google.cloud.security.privateca_v1.types.ListCertificateAuthoritiesResponse` - attributes are available on the pager. If multiple requests are made, only - the most recent response is retained, and thus used for attribute lookup. - """ - def __init__(self, - method: Callable[..., service.ListCertificateAuthoritiesResponse], - request: service.ListCertificateAuthoritiesRequest, - response: service.ListCertificateAuthoritiesResponse, - *, - metadata: Sequence[Tuple[str, str]] = ()): - """Instantiate the pager. - - Args: - method (Callable): The method that was originally called, and - which instantiated this pager. - request (google.cloud.security.privateca_v1.types.ListCertificateAuthoritiesRequest): - The initial request object. - response (google.cloud.security.privateca_v1.types.ListCertificateAuthoritiesResponse): - The initial response object. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - """ - self._method = method - self._request = service.ListCertificateAuthoritiesRequest(request) - self._response = response - self._metadata = metadata - - def __getattr__(self, name: str) -> Any: - return getattr(self._response, name) - - @property - def pages(self) -> Iterator[service.ListCertificateAuthoritiesResponse]: - yield self._response - while self._response.next_page_token: - self._request.page_token = self._response.next_page_token - self._response = self._method(self._request, metadata=self._metadata) - yield self._response - - def __iter__(self) -> Iterator[resources.CertificateAuthority]: - for page in self.pages: - yield from page.certificate_authorities - - def __repr__(self) -> str: - return '{0}<{1!r}>'.format(self.__class__.__name__, self._response) - - -class ListCertificateAuthoritiesAsyncPager: - """A pager for iterating through ``list_certificate_authorities`` requests. - - This class thinly wraps an initial - :class:`google.cloud.security.privateca_v1.types.ListCertificateAuthoritiesResponse` object, and - provides an ``__aiter__`` method to iterate through its - ``certificate_authorities`` field. - - If there are more pages, the ``__aiter__`` method will make additional - ``ListCertificateAuthorities`` requests and continue to iterate - through the ``certificate_authorities`` field on the - corresponding responses. - - All the usual :class:`google.cloud.security.privateca_v1.types.ListCertificateAuthoritiesResponse` - attributes are available on the pager. If multiple requests are made, only - the most recent response is retained, and thus used for attribute lookup. - """ - def __init__(self, - method: Callable[..., Awaitable[service.ListCertificateAuthoritiesResponse]], - request: service.ListCertificateAuthoritiesRequest, - response: service.ListCertificateAuthoritiesResponse, - *, - metadata: Sequence[Tuple[str, str]] = ()): - """Instantiates the pager. - - Args: - method (Callable): The method that was originally called, and - which instantiated this pager. - request (google.cloud.security.privateca_v1.types.ListCertificateAuthoritiesRequest): - The initial request object. - response (google.cloud.security.privateca_v1.types.ListCertificateAuthoritiesResponse): - The initial response object. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - """ - self._method = method - self._request = service.ListCertificateAuthoritiesRequest(request) - self._response = response - self._metadata = metadata - - def __getattr__(self, name: str) -> Any: - return getattr(self._response, name) - - @property - async def pages(self) -> AsyncIterator[service.ListCertificateAuthoritiesResponse]: - yield self._response - while self._response.next_page_token: - self._request.page_token = self._response.next_page_token - self._response = await self._method(self._request, metadata=self._metadata) - yield self._response - def __aiter__(self) -> AsyncIterator[resources.CertificateAuthority]: - async def async_generator(): - async for page in self.pages: - for response in page.certificate_authorities: - yield response - - return async_generator() - - def __repr__(self) -> str: - return '{0}<{1!r}>'.format(self.__class__.__name__, self._response) - - -class ListCaPoolsPager: - """A pager for iterating through ``list_ca_pools`` requests. - - This class thinly wraps an initial - :class:`google.cloud.security.privateca_v1.types.ListCaPoolsResponse` object, and - provides an ``__iter__`` method to iterate through its - ``ca_pools`` field. - - If there are more pages, the ``__iter__`` method will make additional - ``ListCaPools`` requests and continue to iterate - through the ``ca_pools`` field on the - corresponding responses. - - All the usual :class:`google.cloud.security.privateca_v1.types.ListCaPoolsResponse` - attributes are available on the pager. If multiple requests are made, only - the most recent response is retained, and thus used for attribute lookup. - """ - def __init__(self, - method: Callable[..., service.ListCaPoolsResponse], - request: service.ListCaPoolsRequest, - response: service.ListCaPoolsResponse, - *, - metadata: Sequence[Tuple[str, str]] = ()): - """Instantiate the pager. - - Args: - method (Callable): The method that was originally called, and - which instantiated this pager. - request (google.cloud.security.privateca_v1.types.ListCaPoolsRequest): - The initial request object. - response (google.cloud.security.privateca_v1.types.ListCaPoolsResponse): - The initial response object. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - """ - self._method = method - self._request = service.ListCaPoolsRequest(request) - self._response = response - self._metadata = metadata - - def __getattr__(self, name: str) -> Any: - return getattr(self._response, name) - - @property - def pages(self) -> Iterator[service.ListCaPoolsResponse]: - yield self._response - while self._response.next_page_token: - self._request.page_token = self._response.next_page_token - self._response = self._method(self._request, metadata=self._metadata) - yield self._response - - def __iter__(self) -> Iterator[resources.CaPool]: - for page in self.pages: - yield from page.ca_pools - - def __repr__(self) -> str: - return '{0}<{1!r}>'.format(self.__class__.__name__, self._response) - - -class ListCaPoolsAsyncPager: - """A pager for iterating through ``list_ca_pools`` requests. - - This class thinly wraps an initial - :class:`google.cloud.security.privateca_v1.types.ListCaPoolsResponse` object, and - provides an ``__aiter__`` method to iterate through its - ``ca_pools`` field. - - If there are more pages, the ``__aiter__`` method will make additional - ``ListCaPools`` requests and continue to iterate - through the ``ca_pools`` field on the - corresponding responses. - - All the usual :class:`google.cloud.security.privateca_v1.types.ListCaPoolsResponse` - attributes are available on the pager. If multiple requests are made, only - the most recent response is retained, and thus used for attribute lookup. - """ - def __init__(self, - method: Callable[..., Awaitable[service.ListCaPoolsResponse]], - request: service.ListCaPoolsRequest, - response: service.ListCaPoolsResponse, - *, - metadata: Sequence[Tuple[str, str]] = ()): - """Instantiates the pager. - - Args: - method (Callable): The method that was originally called, and - which instantiated this pager. - request (google.cloud.security.privateca_v1.types.ListCaPoolsRequest): - The initial request object. - response (google.cloud.security.privateca_v1.types.ListCaPoolsResponse): - The initial response object. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - """ - self._method = method - self._request = service.ListCaPoolsRequest(request) - self._response = response - self._metadata = metadata - - def __getattr__(self, name: str) -> Any: - return getattr(self._response, name) - - @property - async def pages(self) -> AsyncIterator[service.ListCaPoolsResponse]: - yield self._response - while self._response.next_page_token: - self._request.page_token = self._response.next_page_token - self._response = await self._method(self._request, metadata=self._metadata) - yield self._response - def __aiter__(self) -> AsyncIterator[resources.CaPool]: - async def async_generator(): - async for page in self.pages: - for response in page.ca_pools: - yield response - - return async_generator() - - def __repr__(self) -> str: - return '{0}<{1!r}>'.format(self.__class__.__name__, self._response) - - -class ListCertificateRevocationListsPager: - """A pager for iterating through ``list_certificate_revocation_lists`` requests. - - This class thinly wraps an initial - :class:`google.cloud.security.privateca_v1.types.ListCertificateRevocationListsResponse` object, and - provides an ``__iter__`` method to iterate through its - ``certificate_revocation_lists`` field. - - If there are more pages, the ``__iter__`` method will make additional - ``ListCertificateRevocationLists`` requests and continue to iterate - through the ``certificate_revocation_lists`` field on the - corresponding responses. - - All the usual :class:`google.cloud.security.privateca_v1.types.ListCertificateRevocationListsResponse` - attributes are available on the pager. If multiple requests are made, only - the most recent response is retained, and thus used for attribute lookup. - """ - def __init__(self, - method: Callable[..., service.ListCertificateRevocationListsResponse], - request: service.ListCertificateRevocationListsRequest, - response: service.ListCertificateRevocationListsResponse, - *, - metadata: Sequence[Tuple[str, str]] = ()): - """Instantiate the pager. - - Args: - method (Callable): The method that was originally called, and - which instantiated this pager. - request (google.cloud.security.privateca_v1.types.ListCertificateRevocationListsRequest): - The initial request object. - response (google.cloud.security.privateca_v1.types.ListCertificateRevocationListsResponse): - The initial response object. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - """ - self._method = method - self._request = service.ListCertificateRevocationListsRequest(request) - self._response = response - self._metadata = metadata - - def __getattr__(self, name: str) -> Any: - return getattr(self._response, name) - - @property - def pages(self) -> Iterator[service.ListCertificateRevocationListsResponse]: - yield self._response - while self._response.next_page_token: - self._request.page_token = self._response.next_page_token - self._response = self._method(self._request, metadata=self._metadata) - yield self._response - - def __iter__(self) -> Iterator[resources.CertificateRevocationList]: - for page in self.pages: - yield from page.certificate_revocation_lists - - def __repr__(self) -> str: - return '{0}<{1!r}>'.format(self.__class__.__name__, self._response) - - -class ListCertificateRevocationListsAsyncPager: - """A pager for iterating through ``list_certificate_revocation_lists`` requests. - - This class thinly wraps an initial - :class:`google.cloud.security.privateca_v1.types.ListCertificateRevocationListsResponse` object, and - provides an ``__aiter__`` method to iterate through its - ``certificate_revocation_lists`` field. - - If there are more pages, the ``__aiter__`` method will make additional - ``ListCertificateRevocationLists`` requests and continue to iterate - through the ``certificate_revocation_lists`` field on the - corresponding responses. - - All the usual :class:`google.cloud.security.privateca_v1.types.ListCertificateRevocationListsResponse` - attributes are available on the pager. If multiple requests are made, only - the most recent response is retained, and thus used for attribute lookup. - """ - def __init__(self, - method: Callable[..., Awaitable[service.ListCertificateRevocationListsResponse]], - request: service.ListCertificateRevocationListsRequest, - response: service.ListCertificateRevocationListsResponse, - *, - metadata: Sequence[Tuple[str, str]] = ()): - """Instantiates the pager. - - Args: - method (Callable): The method that was originally called, and - which instantiated this pager. - request (google.cloud.security.privateca_v1.types.ListCertificateRevocationListsRequest): - The initial request object. - response (google.cloud.security.privateca_v1.types.ListCertificateRevocationListsResponse): - The initial response object. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - """ - self._method = method - self._request = service.ListCertificateRevocationListsRequest(request) - self._response = response - self._metadata = metadata - - def __getattr__(self, name: str) -> Any: - return getattr(self._response, name) - - @property - async def pages(self) -> AsyncIterator[service.ListCertificateRevocationListsResponse]: - yield self._response - while self._response.next_page_token: - self._request.page_token = self._response.next_page_token - self._response = await self._method(self._request, metadata=self._metadata) - yield self._response - def __aiter__(self) -> AsyncIterator[resources.CertificateRevocationList]: - async def async_generator(): - async for page in self.pages: - for response in page.certificate_revocation_lists: - yield response - - return async_generator() - - def __repr__(self) -> str: - return '{0}<{1!r}>'.format(self.__class__.__name__, self._response) - - -class ListCertificateTemplatesPager: - """A pager for iterating through ``list_certificate_templates`` requests. - - This class thinly wraps an initial - :class:`google.cloud.security.privateca_v1.types.ListCertificateTemplatesResponse` object, and - provides an ``__iter__`` method to iterate through its - ``certificate_templates`` field. - - If there are more pages, the ``__iter__`` method will make additional - ``ListCertificateTemplates`` requests and continue to iterate - through the ``certificate_templates`` field on the - corresponding responses. - - All the usual :class:`google.cloud.security.privateca_v1.types.ListCertificateTemplatesResponse` - attributes are available on the pager. If multiple requests are made, only - the most recent response is retained, and thus used for attribute lookup. - """ - def __init__(self, - method: Callable[..., service.ListCertificateTemplatesResponse], - request: service.ListCertificateTemplatesRequest, - response: service.ListCertificateTemplatesResponse, - *, - metadata: Sequence[Tuple[str, str]] = ()): - """Instantiate the pager. - - Args: - method (Callable): The method that was originally called, and - which instantiated this pager. - request (google.cloud.security.privateca_v1.types.ListCertificateTemplatesRequest): - The initial request object. - response (google.cloud.security.privateca_v1.types.ListCertificateTemplatesResponse): - The initial response object. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - """ - self._method = method - self._request = service.ListCertificateTemplatesRequest(request) - self._response = response - self._metadata = metadata - - def __getattr__(self, name: str) -> Any: - return getattr(self._response, name) - - @property - def pages(self) -> Iterator[service.ListCertificateTemplatesResponse]: - yield self._response - while self._response.next_page_token: - self._request.page_token = self._response.next_page_token - self._response = self._method(self._request, metadata=self._metadata) - yield self._response - - def __iter__(self) -> Iterator[resources.CertificateTemplate]: - for page in self.pages: - yield from page.certificate_templates - - def __repr__(self) -> str: - return '{0}<{1!r}>'.format(self.__class__.__name__, self._response) - - -class ListCertificateTemplatesAsyncPager: - """A pager for iterating through ``list_certificate_templates`` requests. - - This class thinly wraps an initial - :class:`google.cloud.security.privateca_v1.types.ListCertificateTemplatesResponse` object, and - provides an ``__aiter__`` method to iterate through its - ``certificate_templates`` field. - - If there are more pages, the ``__aiter__`` method will make additional - ``ListCertificateTemplates`` requests and continue to iterate - through the ``certificate_templates`` field on the - corresponding responses. - - All the usual :class:`google.cloud.security.privateca_v1.types.ListCertificateTemplatesResponse` - attributes are available on the pager. If multiple requests are made, only - the most recent response is retained, and thus used for attribute lookup. - """ - def __init__(self, - method: Callable[..., Awaitable[service.ListCertificateTemplatesResponse]], - request: service.ListCertificateTemplatesRequest, - response: service.ListCertificateTemplatesResponse, - *, - metadata: Sequence[Tuple[str, str]] = ()): - """Instantiates the pager. - - Args: - method (Callable): The method that was originally called, and - which instantiated this pager. - request (google.cloud.security.privateca_v1.types.ListCertificateTemplatesRequest): - The initial request object. - response (google.cloud.security.privateca_v1.types.ListCertificateTemplatesResponse): - The initial response object. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - """ - self._method = method - self._request = service.ListCertificateTemplatesRequest(request) - self._response = response - self._metadata = metadata - - def __getattr__(self, name: str) -> Any: - return getattr(self._response, name) - - @property - async def pages(self) -> AsyncIterator[service.ListCertificateTemplatesResponse]: - yield self._response - while self._response.next_page_token: - self._request.page_token = self._response.next_page_token - self._response = await self._method(self._request, metadata=self._metadata) - yield self._response - def __aiter__(self) -> AsyncIterator[resources.CertificateTemplate]: - async def async_generator(): - async for page in self.pages: - for response in page.certificate_templates: - yield response - - return async_generator() - - def __repr__(self) -> str: - return '{0}<{1!r}>'.format(self.__class__.__name__, self._response) diff --git a/owl-bot-staging/v1/google/cloud/security/privateca_v1/services/certificate_authority_service/transports/__init__.py b/owl-bot-staging/v1/google/cloud/security/privateca_v1/services/certificate_authority_service/transports/__init__.py deleted file mode 100644 index 9564748..0000000 --- a/owl-bot-staging/v1/google/cloud/security/privateca_v1/services/certificate_authority_service/transports/__init__.py +++ /dev/null @@ -1,33 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -from collections import OrderedDict -from typing import Dict, Type - -from .base import CertificateAuthorityServiceTransport -from .grpc import CertificateAuthorityServiceGrpcTransport -from .grpc_asyncio import CertificateAuthorityServiceGrpcAsyncIOTransport - - -# Compile a registry of transports. -_transport_registry = OrderedDict() # type: Dict[str, Type[CertificateAuthorityServiceTransport]] -_transport_registry['grpc'] = CertificateAuthorityServiceGrpcTransport -_transport_registry['grpc_asyncio'] = CertificateAuthorityServiceGrpcAsyncIOTransport - -__all__ = ( - 'CertificateAuthorityServiceTransport', - 'CertificateAuthorityServiceGrpcTransport', - 'CertificateAuthorityServiceGrpcAsyncIOTransport', -) diff --git a/owl-bot-staging/v1/google/cloud/security/privateca_v1/services/certificate_authority_service/transports/base.py b/owl-bot-staging/v1/google/cloud/security/privateca_v1/services/certificate_authority_service/transports/base.py deleted file mode 100644 index e96b892..0000000 --- a/owl-bot-staging/v1/google/cloud/security/privateca_v1/services/certificate_authority_service/transports/base.py +++ /dev/null @@ -1,548 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -import abc -from typing import Awaitable, Callable, Dict, Optional, Sequence, Union - -from google.cloud.security.privateca_v1 import gapic_version as package_version - -import google.auth # type: ignore -import google.api_core -from google.api_core import exceptions as core_exceptions -from google.api_core import gapic_v1 -from google.api_core import retry as retries -from google.api_core import operations_v1 -from google.auth import credentials as ga_credentials # type: ignore -from google.oauth2 import service_account # 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 # type: ignore - -DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo(gapic_version=package_version.__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 = DEFAULT_HOST, - credentials: Optional[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, - always_use_jwt_access: Optional[bool] = False, - api_audience: Optional[str] = None, - **kwargs, - ) -> None: - """Instantiate the transport. - - Args: - 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 - are specified, the client will attempt to ascertain the - credentials from the environment. - 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. - 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): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - always_use_jwt_access (Optional[bool]): Whether self signed JWT should - be used for service account credentials. - """ - - scopes_kwargs = {"scopes": scopes, "default_scopes": self.AUTH_SCOPES} - - # Save the scopes. - self._scopes = scopes - - # If no credentials are provided, then determine the appropriate - # defaults. - if credentials and credentials_file: - raise core_exceptions.DuplicateCredentialArgs("'credentials_file' and 'credentials' are mutually exclusive") - - if credentials_file is not None: - credentials, _ = google.auth.load_credentials_from_file( - credentials_file, - **scopes_kwargs, - quota_project_id=quota_project_id - ) - elif credentials is None: - credentials, _ = google.auth.default(**scopes_kwargs, quota_project_id=quota_project_id) - # Don't apply audience if the credentials file passed from user. - if hasattr(credentials, "with_gdch_audience"): - credentials = credentials.with_gdch_audience(api_audience if api_audience else host) - - # If the credentials are service account credentials, then always try to use self signed JWT. - if always_use_jwt_access and isinstance(credentials, service_account.Credentials) and hasattr(service_account.Credentials, "with_always_use_jwt_access"): - credentials = credentials.with_always_use_jwt_access(True) - - # Save the credentials. - self._credentials = credentials - - # Save the hostname. Default to port 443 (HTTPS) if none is specified. - if ':' not in host: - host += ':443' - self._host = host - - def _prep_wrapped_messages(self, client_info): - # Precompute the wrapped methods. - self._wrapped_methods = { - self.create_certificate: gapic_v1.method.wrap_method( - self.create_certificate, - default_timeout=None, - client_info=client_info, - ), - self.get_certificate: gapic_v1.method.wrap_method( - self.get_certificate, - default_timeout=None, - client_info=client_info, - ), - self.list_certificates: gapic_v1.method.wrap_method( - self.list_certificates, - default_timeout=None, - client_info=client_info, - ), - self.revoke_certificate: gapic_v1.method.wrap_method( - self.revoke_certificate, - default_timeout=None, - client_info=client_info, - ), - self.update_certificate: gapic_v1.method.wrap_method( - self.update_certificate, - default_timeout=None, - client_info=client_info, - ), - self.activate_certificate_authority: gapic_v1.method.wrap_method( - self.activate_certificate_authority, - default_timeout=None, - client_info=client_info, - ), - self.create_certificate_authority: gapic_v1.method.wrap_method( - self.create_certificate_authority, - default_timeout=None, - client_info=client_info, - ), - self.disable_certificate_authority: gapic_v1.method.wrap_method( - self.disable_certificate_authority, - default_timeout=None, - client_info=client_info, - ), - self.enable_certificate_authority: gapic_v1.method.wrap_method( - self.enable_certificate_authority, - default_timeout=None, - client_info=client_info, - ), - self.fetch_certificate_authority_csr: gapic_v1.method.wrap_method( - self.fetch_certificate_authority_csr, - default_timeout=None, - client_info=client_info, - ), - self.get_certificate_authority: gapic_v1.method.wrap_method( - self.get_certificate_authority, - default_timeout=None, - client_info=client_info, - ), - self.list_certificate_authorities: gapic_v1.method.wrap_method( - self.list_certificate_authorities, - default_timeout=None, - client_info=client_info, - ), - self.undelete_certificate_authority: gapic_v1.method.wrap_method( - self.undelete_certificate_authority, - default_timeout=None, - client_info=client_info, - ), - self.delete_certificate_authority: gapic_v1.method.wrap_method( - self.delete_certificate_authority, - default_timeout=None, - client_info=client_info, - ), - self.update_certificate_authority: gapic_v1.method.wrap_method( - self.update_certificate_authority, - default_timeout=None, - client_info=client_info, - ), - self.create_ca_pool: gapic_v1.method.wrap_method( - self.create_ca_pool, - default_timeout=None, - client_info=client_info, - ), - self.update_ca_pool: gapic_v1.method.wrap_method( - self.update_ca_pool, - default_timeout=None, - client_info=client_info, - ), - self.get_ca_pool: gapic_v1.method.wrap_method( - self.get_ca_pool, - default_timeout=None, - client_info=client_info, - ), - self.list_ca_pools: gapic_v1.method.wrap_method( - self.list_ca_pools, - default_timeout=None, - client_info=client_info, - ), - self.delete_ca_pool: gapic_v1.method.wrap_method( - self.delete_ca_pool, - default_timeout=None, - client_info=client_info, - ), - self.fetch_ca_certs: gapic_v1.method.wrap_method( - self.fetch_ca_certs, - default_timeout=None, - client_info=client_info, - ), - self.get_certificate_revocation_list: gapic_v1.method.wrap_method( - self.get_certificate_revocation_list, - default_timeout=None, - client_info=client_info, - ), - self.list_certificate_revocation_lists: gapic_v1.method.wrap_method( - self.list_certificate_revocation_lists, - default_timeout=None, - client_info=client_info, - ), - self.update_certificate_revocation_list: gapic_v1.method.wrap_method( - self.update_certificate_revocation_list, - default_timeout=None, - client_info=client_info, - ), - self.create_certificate_template: gapic_v1.method.wrap_method( - self.create_certificate_template, - default_timeout=None, - client_info=client_info, - ), - self.delete_certificate_template: gapic_v1.method.wrap_method( - self.delete_certificate_template, - default_timeout=None, - client_info=client_info, - ), - self.get_certificate_template: gapic_v1.method.wrap_method( - self.get_certificate_template, - default_timeout=None, - client_info=client_info, - ), - self.list_certificate_templates: gapic_v1.method.wrap_method( - self.list_certificate_templates, - default_timeout=None, - client_info=client_info, - ), - self.update_certificate_template: gapic_v1.method.wrap_method( - self.update_certificate_template, - default_timeout=None, - client_info=client_info, - ), - } - - def close(self): - """Closes resources associated with the transport. - - .. warning:: - Only call this method if the transport is NOT shared - with other clients - this may cause errors in other clients! - """ - raise NotImplementedError() - - @property - def operations_client(self): - """Return the client designed to process long-running operations.""" - raise NotImplementedError() - - @property - def create_certificate(self) -> Callable[ - [service.CreateCertificateRequest], - Union[ - resources.Certificate, - Awaitable[resources.Certificate] - ]]: - raise NotImplementedError() - - @property - def get_certificate(self) -> Callable[ - [service.GetCertificateRequest], - Union[ - resources.Certificate, - Awaitable[resources.Certificate] - ]]: - raise NotImplementedError() - - @property - def list_certificates(self) -> Callable[ - [service.ListCertificatesRequest], - Union[ - service.ListCertificatesResponse, - Awaitable[service.ListCertificatesResponse] - ]]: - raise NotImplementedError() - - @property - def revoke_certificate(self) -> Callable[ - [service.RevokeCertificateRequest], - Union[ - resources.Certificate, - Awaitable[resources.Certificate] - ]]: - raise NotImplementedError() - - @property - def update_certificate(self) -> Callable[ - [service.UpdateCertificateRequest], - Union[ - resources.Certificate, - Awaitable[resources.Certificate] - ]]: - raise NotImplementedError() - - @property - def activate_certificate_authority(self) -> Callable[ - [service.ActivateCertificateAuthorityRequest], - Union[ - operations_pb2.Operation, - Awaitable[operations_pb2.Operation] - ]]: - raise NotImplementedError() - - @property - def create_certificate_authority(self) -> Callable[ - [service.CreateCertificateAuthorityRequest], - Union[ - operations_pb2.Operation, - Awaitable[operations_pb2.Operation] - ]]: - raise NotImplementedError() - - @property - def disable_certificate_authority(self) -> Callable[ - [service.DisableCertificateAuthorityRequest], - Union[ - operations_pb2.Operation, - Awaitable[operations_pb2.Operation] - ]]: - raise NotImplementedError() - - @property - def enable_certificate_authority(self) -> Callable[ - [service.EnableCertificateAuthorityRequest], - Union[ - operations_pb2.Operation, - Awaitable[operations_pb2.Operation] - ]]: - raise NotImplementedError() - - @property - def fetch_certificate_authority_csr(self) -> Callable[ - [service.FetchCertificateAuthorityCsrRequest], - Union[ - service.FetchCertificateAuthorityCsrResponse, - Awaitable[service.FetchCertificateAuthorityCsrResponse] - ]]: - raise NotImplementedError() - - @property - def get_certificate_authority(self) -> Callable[ - [service.GetCertificateAuthorityRequest], - Union[ - resources.CertificateAuthority, - Awaitable[resources.CertificateAuthority] - ]]: - raise NotImplementedError() - - @property - def list_certificate_authorities(self) -> Callable[ - [service.ListCertificateAuthoritiesRequest], - Union[ - service.ListCertificateAuthoritiesResponse, - Awaitable[service.ListCertificateAuthoritiesResponse] - ]]: - raise NotImplementedError() - - @property - def undelete_certificate_authority(self) -> Callable[ - [service.UndeleteCertificateAuthorityRequest], - Union[ - operations_pb2.Operation, - Awaitable[operations_pb2.Operation] - ]]: - raise NotImplementedError() - - @property - def delete_certificate_authority(self) -> Callable[ - [service.DeleteCertificateAuthorityRequest], - Union[ - operations_pb2.Operation, - Awaitable[operations_pb2.Operation] - ]]: - raise NotImplementedError() - - @property - def update_certificate_authority(self) -> Callable[ - [service.UpdateCertificateAuthorityRequest], - Union[ - operations_pb2.Operation, - Awaitable[operations_pb2.Operation] - ]]: - raise NotImplementedError() - - @property - def create_ca_pool(self) -> Callable[ - [service.CreateCaPoolRequest], - Union[ - operations_pb2.Operation, - Awaitable[operations_pb2.Operation] - ]]: - raise NotImplementedError() - - @property - def update_ca_pool(self) -> Callable[ - [service.UpdateCaPoolRequest], - Union[ - operations_pb2.Operation, - Awaitable[operations_pb2.Operation] - ]]: - raise NotImplementedError() - - @property - def get_ca_pool(self) -> Callable[ - [service.GetCaPoolRequest], - Union[ - resources.CaPool, - Awaitable[resources.CaPool] - ]]: - raise NotImplementedError() - - @property - def list_ca_pools(self) -> Callable[ - [service.ListCaPoolsRequest], - Union[ - service.ListCaPoolsResponse, - Awaitable[service.ListCaPoolsResponse] - ]]: - raise NotImplementedError() - - @property - def delete_ca_pool(self) -> Callable[ - [service.DeleteCaPoolRequest], - Union[ - operations_pb2.Operation, - Awaitable[operations_pb2.Operation] - ]]: - raise NotImplementedError() - - @property - def fetch_ca_certs(self) -> Callable[ - [service.FetchCaCertsRequest], - Union[ - service.FetchCaCertsResponse, - Awaitable[service.FetchCaCertsResponse] - ]]: - raise NotImplementedError() - - @property - def get_certificate_revocation_list(self) -> Callable[ - [service.GetCertificateRevocationListRequest], - Union[ - resources.CertificateRevocationList, - Awaitable[resources.CertificateRevocationList] - ]]: - raise NotImplementedError() - - @property - def list_certificate_revocation_lists(self) -> Callable[ - [service.ListCertificateRevocationListsRequest], - Union[ - service.ListCertificateRevocationListsResponse, - Awaitable[service.ListCertificateRevocationListsResponse] - ]]: - raise NotImplementedError() - - @property - def update_certificate_revocation_list(self) -> Callable[ - [service.UpdateCertificateRevocationListRequest], - Union[ - operations_pb2.Operation, - Awaitable[operations_pb2.Operation] - ]]: - raise NotImplementedError() - - @property - def create_certificate_template(self) -> Callable[ - [service.CreateCertificateTemplateRequest], - Union[ - operations_pb2.Operation, - Awaitable[operations_pb2.Operation] - ]]: - raise NotImplementedError() - - @property - def delete_certificate_template(self) -> Callable[ - [service.DeleteCertificateTemplateRequest], - Union[ - operations_pb2.Operation, - Awaitable[operations_pb2.Operation] - ]]: - raise NotImplementedError() - - @property - def get_certificate_template(self) -> Callable[ - [service.GetCertificateTemplateRequest], - Union[ - resources.CertificateTemplate, - Awaitable[resources.CertificateTemplate] - ]]: - raise NotImplementedError() - - @property - def list_certificate_templates(self) -> Callable[ - [service.ListCertificateTemplatesRequest], - Union[ - service.ListCertificateTemplatesResponse, - Awaitable[service.ListCertificateTemplatesResponse] - ]]: - raise NotImplementedError() - - @property - def update_certificate_template(self) -> Callable[ - [service.UpdateCertificateTemplateRequest], - Union[ - operations_pb2.Operation, - Awaitable[operations_pb2.Operation] - ]]: - raise NotImplementedError() - - @property - def kind(self) -> str: - raise NotImplementedError() - - -__all__ = ( - 'CertificateAuthorityServiceTransport', -) diff --git a/owl-bot-staging/v1/google/cloud/security/privateca_v1/services/certificate_authority_service/transports/grpc.py b/owl-bot-staging/v1/google/cloud/security/privateca_v1/services/certificate_authority_service/transports/grpc.py deleted file mode 100644 index f73bb43..0000000 --- a/owl-bot-staging/v1/google/cloud/security/privateca_v1/services/certificate_authority_service/transports/grpc.py +++ /dev/null @@ -1,1071 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -import warnings -from typing import Callable, Dict, Optional, Sequence, Tuple, Union - -from google.api_core import grpc_helpers -from google.api_core import operations_v1 -from google.api_core import gapic_v1 -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 # type: ignore -from .base import CertificateAuthorityServiceTransport, DEFAULT_CLIENT_INFO - - -class CertificateAuthorityServiceGrpcTransport(CertificateAuthorityServiceTransport): - """gRPC backend transport for CertificateAuthorityService. - - [Certificate Authority - Service][google.cloud.security.privateca.v1.CertificateAuthorityService] - manages private certificate authorities and issued certificates. - - This class defines the same methods as the primary client, so the - primary client can load the underlying transport implementation - and call it. - - It sends protocol buffers over the wire using gRPC (which is built on - top of HTTP/2); the ``grpcio`` package must be installed. - """ - _stubs: Dict[str, Callable] - - def __init__(self, *, - host: str = 'privateca.googleapis.com', - credentials: Optional[ga_credentials.Credentials] = None, - credentials_file: Optional[str] = None, - scopes: Optional[Sequence[str]] = None, - channel: Optional[grpc.Channel] = None, - api_mtls_endpoint: Optional[str] = None, - client_cert_source: Optional[Callable[[], Tuple[bytes, bytes]]] = None, - ssl_channel_credentials: Optional[grpc.ChannelCredentials] = None, - client_cert_source_for_mtls: Optional[Callable[[], Tuple[bytes, bytes]]] = None, - quota_project_id: Optional[str] = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - always_use_jwt_access: Optional[bool] = False, - api_audience: Optional[str] = None, - ) -> None: - """Instantiate the transport. - - Args: - 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 - are specified, the client will attempt to ascertain the - credentials from the environment. - This argument is ignored if ``channel`` is provided. - credentials_file (Optional[str]): A file with credentials that can - be loaded with :func:`google.auth.load_credentials_from_file`. - This argument is ignored if ``channel`` is provided. - scopes (Optional(Sequence[str])): A list of scopes. This argument is - ignored if ``channel`` is provided. - channel (Optional[grpc.Channel]): A ``Channel`` instance through - which to make calls. - api_mtls_endpoint (Optional[str]): Deprecated. The mutual TLS endpoint. - If provided, it overrides the ``host`` argument and tries to create - a mutual TLS channel with client SSL credentials from - ``client_cert_source`` or application default SSL credentials. - client_cert_source (Optional[Callable[[], Tuple[bytes, bytes]]]): - Deprecated. A callback to provide client SSL certificate bytes and - private key bytes, both in PEM format. It is ignored if - ``api_mtls_endpoint`` is None. - ssl_channel_credentials (grpc.ChannelCredentials): SSL credentials - for the grpc channel. It is ignored if ``channel`` is provided. - client_cert_source_for_mtls (Optional[Callable[[], Tuple[bytes, bytes]]]): - A callback to provide client certificate bytes and private key bytes, - both in PEM format. It is used to configure a mutual TLS channel. It is - ignored if ``channel`` or ``ssl_channel_credentials`` is provided. - quota_project_id (Optional[str]): An optional project to use for billing - and quota. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - always_use_jwt_access (Optional[bool]): Whether self signed JWT should - be used for service account credentials. - - Raises: - google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport - creation failed for any reason. - google.api_core.exceptions.DuplicateCredentialArgs: If both ``credentials`` - and ``credentials_file`` are passed. - """ - self._grpc_channel = None - self._ssl_channel_credentials = ssl_channel_credentials - self._stubs: Dict[str, Callable] = {} - self._operations_client: Optional[operations_v1.OperationsClient] = None - - if api_mtls_endpoint: - warnings.warn("api_mtls_endpoint is deprecated", DeprecationWarning) - if client_cert_source: - warnings.warn("client_cert_source is deprecated", DeprecationWarning) - - if channel: - # Ignore credentials if a channel was passed. - credentials = False - # 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 - - # Create SSL credentials with client_cert_source or application - # default SSL credentials. - if client_cert_source: - cert, key = client_cert_source() - self._ssl_channel_credentials = grpc.ssl_channel_credentials( - certificate_chain=cert, private_key=key - ) - else: - self._ssl_channel_credentials = SslCredentials().ssl_credentials - - else: - if client_cert_source_for_mtls and not ssl_channel_credentials: - cert, key = client_cert_source_for_mtls() - self._ssl_channel_credentials = grpc.ssl_channel_credentials( - certificate_chain=cert, private_key=key - ) - - # The base transport sets the host, credentials and scopes - super().__init__( - host=host, - credentials=credentials, - credentials_file=credentials_file, - scopes=scopes, - quota_project_id=quota_project_id, - client_info=client_info, - always_use_jwt_access=always_use_jwt_access, - api_audience=api_audience, - ) - - if not self._grpc_channel: - self._grpc_channel = type(self).create_channel( - self._host, - # use the credentials which are saved - credentials=self._credentials, - # Set ``credentials_file`` to ``None`` here as - # the credentials that we saved earlier should be used. - credentials_file=None, - scopes=self._scopes, - ssl_credentials=self._ssl_channel_credentials, - quota_project_id=quota_project_id, - options=[ - ("grpc.max_send_message_length", -1), - ("grpc.max_receive_message_length", -1), - ], - ) - - # Wrap messages. This must be done after self._grpc_channel exists - self._prep_wrapped_messages(client_info) - - @classmethod - def create_channel(cls, - host: str = 'privateca.googleapis.com', - credentials: Optional[ga_credentials.Credentials] = None, - credentials_file: Optional[str] = None, - scopes: Optional[Sequence[str]] = None, - quota_project_id: Optional[str] = None, - **kwargs) -> grpc.Channel: - """Create and return a gRPC channel object. - Args: - host (Optional[str]): The host for the channel to use. - credentials (Optional[~.Credentials]): The - authorization credentials to attach to requests. These - credentials identify this application to the service. If - none are specified, the client will attempt to ascertain - the credentials from the environment. - 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. - scopes (Optional[Sequence[str]]): A optional list of scopes needed for this - service. These are only used when credentials are not specified and - are passed to :func:`google.auth.default`. - quota_project_id (Optional[str]): An optional project to use for billing - and quota. - kwargs (Optional[dict]): Keyword arguments, which are passed to the - channel creation. - Returns: - grpc.Channel: A gRPC channel object. - - Raises: - google.api_core.exceptions.DuplicateCredentialArgs: If both ``credentials`` - and ``credentials_file`` are passed. - """ - - return grpc_helpers.create_channel( - host, - credentials=credentials, - credentials_file=credentials_file, - quota_project_id=quota_project_id, - default_scopes=cls.AUTH_SCOPES, - scopes=scopes, - default_host=cls.DEFAULT_HOST, - **kwargs - ) - - @property - def grpc_channel(self) -> grpc.Channel: - """Return the channel designed to connect to this service. - """ - return self._grpc_channel - - @property - def operations_client(self) -> operations_v1.OperationsClient: - """Create the client designed to process long-running operations. - - This property caches on the instance; repeated calls return the same - client. - """ - # Quick check: Only create a new client if we do not already have one. - if self._operations_client is None: - self._operations_client = operations_v1.OperationsClient( - self.grpc_channel - ) - - # Return the client from cache. - return self._operations_client - - @property - def create_certificate(self) -> Callable[ - [service.CreateCertificateRequest], - resources.Certificate]: - r"""Return a callable for the create certificate method over gRPC. - - Create a new - [Certificate][google.cloud.security.privateca.v1.Certificate] in - a given Project, Location from a particular - [CaPool][google.cloud.security.privateca.v1.CaPool]. - - Returns: - Callable[[~.CreateCertificateRequest], - ~.Certificate]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if 'create_certificate' not in self._stubs: - self._stubs['create_certificate'] = self.grpc_channel.unary_unary( - '/google.cloud.security.privateca.v1.CertificateAuthorityService/CreateCertificate', - request_serializer=service.CreateCertificateRequest.serialize, - response_deserializer=resources.Certificate.deserialize, - ) - return self._stubs['create_certificate'] - - @property - def get_certificate(self) -> Callable[ - [service.GetCertificateRequest], - resources.Certificate]: - r"""Return a callable for the get certificate method over gRPC. - - Returns a - [Certificate][google.cloud.security.privateca.v1.Certificate]. - - Returns: - Callable[[~.GetCertificateRequest], - ~.Certificate]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if 'get_certificate' not in self._stubs: - self._stubs['get_certificate'] = self.grpc_channel.unary_unary( - '/google.cloud.security.privateca.v1.CertificateAuthorityService/GetCertificate', - request_serializer=service.GetCertificateRequest.serialize, - response_deserializer=resources.Certificate.deserialize, - ) - return self._stubs['get_certificate'] - - @property - def list_certificates(self) -> Callable[ - [service.ListCertificatesRequest], - service.ListCertificatesResponse]: - r"""Return a callable for the list certificates method over gRPC. - - Lists - [Certificates][google.cloud.security.privateca.v1.Certificate]. - - Returns: - Callable[[~.ListCertificatesRequest], - ~.ListCertificatesResponse]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if 'list_certificates' not in self._stubs: - self._stubs['list_certificates'] = self.grpc_channel.unary_unary( - '/google.cloud.security.privateca.v1.CertificateAuthorityService/ListCertificates', - request_serializer=service.ListCertificatesRequest.serialize, - response_deserializer=service.ListCertificatesResponse.deserialize, - ) - return self._stubs['list_certificates'] - - @property - def revoke_certificate(self) -> Callable[ - [service.RevokeCertificateRequest], - resources.Certificate]: - r"""Return a callable for the revoke certificate method over gRPC. - - Revoke a - [Certificate][google.cloud.security.privateca.v1.Certificate]. - - Returns: - Callable[[~.RevokeCertificateRequest], - ~.Certificate]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if 'revoke_certificate' not in self._stubs: - self._stubs['revoke_certificate'] = self.grpc_channel.unary_unary( - '/google.cloud.security.privateca.v1.CertificateAuthorityService/RevokeCertificate', - request_serializer=service.RevokeCertificateRequest.serialize, - response_deserializer=resources.Certificate.deserialize, - ) - return self._stubs['revoke_certificate'] - - @property - def update_certificate(self) -> Callable[ - [service.UpdateCertificateRequest], - resources.Certificate]: - r"""Return a callable for the update certificate method over gRPC. - - Update a - [Certificate][google.cloud.security.privateca.v1.Certificate]. - Currently, the only field you can update is the - [labels][google.cloud.security.privateca.v1.Certificate.labels] - field. - - Returns: - Callable[[~.UpdateCertificateRequest], - ~.Certificate]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if 'update_certificate' not in self._stubs: - self._stubs['update_certificate'] = self.grpc_channel.unary_unary( - '/google.cloud.security.privateca.v1.CertificateAuthorityService/UpdateCertificate', - request_serializer=service.UpdateCertificateRequest.serialize, - response_deserializer=resources.Certificate.deserialize, - ) - return self._stubs['update_certificate'] - - @property - def activate_certificate_authority(self) -> Callable[ - [service.ActivateCertificateAuthorityRequest], - operations_pb2.Operation]: - r"""Return a callable for the activate certificate authority method over gRPC. - - Activate a - [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority] - that is in state - [AWAITING_USER_ACTIVATION][google.cloud.security.privateca.v1.CertificateAuthority.State.AWAITING_USER_ACTIVATION] - and is of type - [SUBORDINATE][google.cloud.security.privateca.v1.CertificateAuthority.Type.SUBORDINATE]. - After the parent Certificate Authority signs a certificate - signing request from - [FetchCertificateAuthorityCsr][google.cloud.security.privateca.v1.CertificateAuthorityService.FetchCertificateAuthorityCsr], - this method can complete the activation process. - - Returns: - Callable[[~.ActivateCertificateAuthorityRequest], - ~.Operation]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if 'activate_certificate_authority' not in self._stubs: - self._stubs['activate_certificate_authority'] = self.grpc_channel.unary_unary( - '/google.cloud.security.privateca.v1.CertificateAuthorityService/ActivateCertificateAuthority', - request_serializer=service.ActivateCertificateAuthorityRequest.serialize, - response_deserializer=operations_pb2.Operation.FromString, - ) - return self._stubs['activate_certificate_authority'] - - @property - def create_certificate_authority(self) -> Callable[ - [service.CreateCertificateAuthorityRequest], - operations_pb2.Operation]: - r"""Return a callable for the create certificate authority method over gRPC. - - Create a new - [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority] - in a given Project and Location. - - Returns: - Callable[[~.CreateCertificateAuthorityRequest], - ~.Operation]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if 'create_certificate_authority' not in self._stubs: - 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_pb2.Operation.FromString, - ) - return self._stubs['create_certificate_authority'] - - @property - def disable_certificate_authority(self) -> Callable[ - [service.DisableCertificateAuthorityRequest], - operations_pb2.Operation]: - r"""Return a callable for the disable certificate authority method over gRPC. - - Disable a - [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority]. - - Returns: - Callable[[~.DisableCertificateAuthorityRequest], - ~.Operation]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if 'disable_certificate_authority' not in self._stubs: - self._stubs['disable_certificate_authority'] = self.grpc_channel.unary_unary( - '/google.cloud.security.privateca.v1.CertificateAuthorityService/DisableCertificateAuthority', - request_serializer=service.DisableCertificateAuthorityRequest.serialize, - response_deserializer=operations_pb2.Operation.FromString, - ) - return self._stubs['disable_certificate_authority'] - - @property - def enable_certificate_authority(self) -> Callable[ - [service.EnableCertificateAuthorityRequest], - operations_pb2.Operation]: - r"""Return a callable for the enable certificate authority method over gRPC. - - Enable a - [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority]. - - Returns: - Callable[[~.EnableCertificateAuthorityRequest], - ~.Operation]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if 'enable_certificate_authority' not in self._stubs: - 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_pb2.Operation.FromString, - ) - return self._stubs['enable_certificate_authority'] - - @property - def fetch_certificate_authority_csr(self) -> Callable[ - [service.FetchCertificateAuthorityCsrRequest], - service.FetchCertificateAuthorityCsrResponse]: - r"""Return a callable for the fetch certificate authority - csr method over gRPC. - - Fetch a certificate signing request (CSR) from a - [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority] - that is in state - [AWAITING_USER_ACTIVATION][google.cloud.security.privateca.v1.CertificateAuthority.State.AWAITING_USER_ACTIVATION] - and is of type - [SUBORDINATE][google.cloud.security.privateca.v1.CertificateAuthority.Type.SUBORDINATE]. - The CSR must then be signed by the desired parent Certificate - Authority, which could be another - [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority] - resource, or could be an on-prem certificate authority. See also - [ActivateCertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthorityService.ActivateCertificateAuthority]. - - Returns: - Callable[[~.FetchCertificateAuthorityCsrRequest], - ~.FetchCertificateAuthorityCsrResponse]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if 'fetch_certificate_authority_csr' not in self._stubs: - self._stubs['fetch_certificate_authority_csr'] = self.grpc_channel.unary_unary( - '/google.cloud.security.privateca.v1.CertificateAuthorityService/FetchCertificateAuthorityCsr', - request_serializer=service.FetchCertificateAuthorityCsrRequest.serialize, - response_deserializer=service.FetchCertificateAuthorityCsrResponse.deserialize, - ) - return self._stubs['fetch_certificate_authority_csr'] - - @property - def get_certificate_authority(self) -> Callable[ - [service.GetCertificateAuthorityRequest], - resources.CertificateAuthority]: - r"""Return a callable for the get certificate authority method over gRPC. - - Returns a - [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority]. - - Returns: - Callable[[~.GetCertificateAuthorityRequest], - ~.CertificateAuthority]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if 'get_certificate_authority' not in self._stubs: - self._stubs['get_certificate_authority'] = self.grpc_channel.unary_unary( - '/google.cloud.security.privateca.v1.CertificateAuthorityService/GetCertificateAuthority', - request_serializer=service.GetCertificateAuthorityRequest.serialize, - response_deserializer=resources.CertificateAuthority.deserialize, - ) - return self._stubs['get_certificate_authority'] - - @property - def list_certificate_authorities(self) -> Callable[ - [service.ListCertificateAuthoritiesRequest], - service.ListCertificateAuthoritiesResponse]: - r"""Return a callable for the list certificate authorities method over gRPC. - - Lists - [CertificateAuthorities][google.cloud.security.privateca.v1.CertificateAuthority]. - - Returns: - Callable[[~.ListCertificateAuthoritiesRequest], - ~.ListCertificateAuthoritiesResponse]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if 'list_certificate_authorities' not in self._stubs: - self._stubs['list_certificate_authorities'] = self.grpc_channel.unary_unary( - '/google.cloud.security.privateca.v1.CertificateAuthorityService/ListCertificateAuthorities', - request_serializer=service.ListCertificateAuthoritiesRequest.serialize, - response_deserializer=service.ListCertificateAuthoritiesResponse.deserialize, - ) - return self._stubs['list_certificate_authorities'] - - @property - def undelete_certificate_authority(self) -> Callable[ - [service.UndeleteCertificateAuthorityRequest], - operations_pb2.Operation]: - r"""Return a callable for the undelete certificate authority method over gRPC. - - Undelete a - [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority] - that has been deleted. - - Returns: - Callable[[~.UndeleteCertificateAuthorityRequest], - ~.Operation]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if 'undelete_certificate_authority' not in self._stubs: - self._stubs['undelete_certificate_authority'] = self.grpc_channel.unary_unary( - '/google.cloud.security.privateca.v1.CertificateAuthorityService/UndeleteCertificateAuthority', - request_serializer=service.UndeleteCertificateAuthorityRequest.serialize, - response_deserializer=operations_pb2.Operation.FromString, - ) - return self._stubs['undelete_certificate_authority'] - - @property - def delete_certificate_authority(self) -> Callable[ - [service.DeleteCertificateAuthorityRequest], - operations_pb2.Operation]: - r"""Return a callable for the delete certificate authority method over gRPC. - - Delete a - [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority]. - - Returns: - Callable[[~.DeleteCertificateAuthorityRequest], - ~.Operation]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if 'delete_certificate_authority' not in self._stubs: - 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_pb2.Operation.FromString, - ) - return self._stubs['delete_certificate_authority'] - - @property - def update_certificate_authority(self) -> Callable[ - [service.UpdateCertificateAuthorityRequest], - operations_pb2.Operation]: - r"""Return a callable for the update certificate authority method over gRPC. - - Update a - [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority]. - - Returns: - Callable[[~.UpdateCertificateAuthorityRequest], - ~.Operation]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if 'update_certificate_authority' not in self._stubs: - 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_pb2.Operation.FromString, - ) - return self._stubs['update_certificate_authority'] - - @property - def create_ca_pool(self) -> 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]. - - Returns: - Callable[[~.CreateCaPoolRequest], - ~.Operation]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if 'create_ca_pool' not in self._stubs: - 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_pb2.Operation.FromString, - ) - return self._stubs['create_ca_pool'] - - @property - def update_ca_pool(self) -> 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]. - - Returns: - Callable[[~.UpdateCaPoolRequest], - ~.Operation]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if 'update_ca_pool' not in self._stubs: - 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_pb2.Operation.FromString, - ) - return self._stubs['update_ca_pool'] - - @property - def get_ca_pool(self) -> Callable[ - [service.GetCaPoolRequest], - resources.CaPool]: - r"""Return a callable for the get ca pool method over gRPC. - - Returns a [CaPool][google.cloud.security.privateca.v1.CaPool]. - - Returns: - Callable[[~.GetCaPoolRequest], - ~.CaPool]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if 'get_ca_pool' not in self._stubs: - self._stubs['get_ca_pool'] = self.grpc_channel.unary_unary( - '/google.cloud.security.privateca.v1.CertificateAuthorityService/GetCaPool', - request_serializer=service.GetCaPoolRequest.serialize, - response_deserializer=resources.CaPool.deserialize, - ) - return self._stubs['get_ca_pool'] - - @property - def list_ca_pools(self) -> Callable[ - [service.ListCaPoolsRequest], - service.ListCaPoolsResponse]: - r"""Return a callable for the list ca pools method over gRPC. - - Lists [CaPools][google.cloud.security.privateca.v1.CaPool]. - - Returns: - Callable[[~.ListCaPoolsRequest], - ~.ListCaPoolsResponse]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if 'list_ca_pools' not in self._stubs: - self._stubs['list_ca_pools'] = self.grpc_channel.unary_unary( - '/google.cloud.security.privateca.v1.CertificateAuthorityService/ListCaPools', - request_serializer=service.ListCaPoolsRequest.serialize, - response_deserializer=service.ListCaPoolsResponse.deserialize, - ) - return self._stubs['list_ca_pools'] - - @property - def delete_ca_pool(self) -> 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]. - - Returns: - Callable[[~.DeleteCaPoolRequest], - ~.Operation]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if 'delete_ca_pool' not in self._stubs: - 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_pb2.Operation.FromString, - ) - return self._stubs['delete_ca_pool'] - - @property - def fetch_ca_certs(self) -> Callable[ - [service.FetchCaCertsRequest], - service.FetchCaCertsResponse]: - r"""Return a callable for the fetch ca certs method over gRPC. - - FetchCaCerts returns the current trust anchor for the - [CaPool][google.cloud.security.privateca.v1.CaPool]. This will - include CA certificate chains for all ACTIVE - [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority] - resources in the - [CaPool][google.cloud.security.privateca.v1.CaPool]. - - Returns: - Callable[[~.FetchCaCertsRequest], - ~.FetchCaCertsResponse]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if 'fetch_ca_certs' not in self._stubs: - self._stubs['fetch_ca_certs'] = self.grpc_channel.unary_unary( - '/google.cloud.security.privateca.v1.CertificateAuthorityService/FetchCaCerts', - request_serializer=service.FetchCaCertsRequest.serialize, - response_deserializer=service.FetchCaCertsResponse.deserialize, - ) - return self._stubs['fetch_ca_certs'] - - @property - def get_certificate_revocation_list(self) -> Callable[ - [service.GetCertificateRevocationListRequest], - resources.CertificateRevocationList]: - r"""Return a callable for the get certificate revocation - list method over gRPC. - - Returns a - [CertificateRevocationList][google.cloud.security.privateca.v1.CertificateRevocationList]. - - Returns: - Callable[[~.GetCertificateRevocationListRequest], - ~.CertificateRevocationList]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if 'get_certificate_revocation_list' not in self._stubs: - self._stubs['get_certificate_revocation_list'] = self.grpc_channel.unary_unary( - '/google.cloud.security.privateca.v1.CertificateAuthorityService/GetCertificateRevocationList', - request_serializer=service.GetCertificateRevocationListRequest.serialize, - response_deserializer=resources.CertificateRevocationList.deserialize, - ) - return self._stubs['get_certificate_revocation_list'] - - @property - def list_certificate_revocation_lists(self) -> Callable[ - [service.ListCertificateRevocationListsRequest], - service.ListCertificateRevocationListsResponse]: - r"""Return a callable for the list certificate revocation - lists method over gRPC. - - Lists - [CertificateRevocationLists][google.cloud.security.privateca.v1.CertificateRevocationList]. - - Returns: - Callable[[~.ListCertificateRevocationListsRequest], - ~.ListCertificateRevocationListsResponse]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if 'list_certificate_revocation_lists' not in self._stubs: - self._stubs['list_certificate_revocation_lists'] = self.grpc_channel.unary_unary( - '/google.cloud.security.privateca.v1.CertificateAuthorityService/ListCertificateRevocationLists', - request_serializer=service.ListCertificateRevocationListsRequest.serialize, - response_deserializer=service.ListCertificateRevocationListsResponse.deserialize, - ) - return self._stubs['list_certificate_revocation_lists'] - - @property - def update_certificate_revocation_list(self) -> Callable[ - [service.UpdateCertificateRevocationListRequest], - operations_pb2.Operation]: - r"""Return a callable for the update certificate revocation - list method over gRPC. - - Update a - [CertificateRevocationList][google.cloud.security.privateca.v1.CertificateRevocationList]. - - Returns: - Callable[[~.UpdateCertificateRevocationListRequest], - ~.Operation]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if 'update_certificate_revocation_list' not in self._stubs: - self._stubs['update_certificate_revocation_list'] = self.grpc_channel.unary_unary( - '/google.cloud.security.privateca.v1.CertificateAuthorityService/UpdateCertificateRevocationList', - request_serializer=service.UpdateCertificateRevocationListRequest.serialize, - response_deserializer=operations_pb2.Operation.FromString, - ) - return self._stubs['update_certificate_revocation_list'] - - @property - def create_certificate_template(self) -> Callable[ - [service.CreateCertificateTemplateRequest], - operations_pb2.Operation]: - r"""Return a callable for the create certificate template method over gRPC. - - Create a new - [CertificateTemplate][google.cloud.security.privateca.v1.CertificateTemplate] - in a given Project and Location. - - Returns: - Callable[[~.CreateCertificateTemplateRequest], - ~.Operation]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if 'create_certificate_template' not in self._stubs: - 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_pb2.Operation.FromString, - ) - return self._stubs['create_certificate_template'] - - @property - def delete_certificate_template(self) -> Callable[ - [service.DeleteCertificateTemplateRequest], - operations_pb2.Operation]: - r"""Return a callable for the delete certificate template method over gRPC. - - DeleteCertificateTemplate deletes a - [CertificateTemplate][google.cloud.security.privateca.v1.CertificateTemplate]. - - Returns: - Callable[[~.DeleteCertificateTemplateRequest], - ~.Operation]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if 'delete_certificate_template' not in self._stubs: - 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_pb2.Operation.FromString, - ) - return self._stubs['delete_certificate_template'] - - @property - def get_certificate_template(self) -> Callable[ - [service.GetCertificateTemplateRequest], - resources.CertificateTemplate]: - r"""Return a callable for the get certificate template method over gRPC. - - Returns a - [CertificateTemplate][google.cloud.security.privateca.v1.CertificateTemplate]. - - Returns: - Callable[[~.GetCertificateTemplateRequest], - ~.CertificateTemplate]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if 'get_certificate_template' not in self._stubs: - self._stubs['get_certificate_template'] = self.grpc_channel.unary_unary( - '/google.cloud.security.privateca.v1.CertificateAuthorityService/GetCertificateTemplate', - request_serializer=service.GetCertificateTemplateRequest.serialize, - response_deserializer=resources.CertificateTemplate.deserialize, - ) - return self._stubs['get_certificate_template'] - - @property - def list_certificate_templates(self) -> Callable[ - [service.ListCertificateTemplatesRequest], - service.ListCertificateTemplatesResponse]: - r"""Return a callable for the list certificate templates method over gRPC. - - Lists - [CertificateTemplates][google.cloud.security.privateca.v1.CertificateTemplate]. - - Returns: - Callable[[~.ListCertificateTemplatesRequest], - ~.ListCertificateTemplatesResponse]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if 'list_certificate_templates' not in self._stubs: - self._stubs['list_certificate_templates'] = self.grpc_channel.unary_unary( - '/google.cloud.security.privateca.v1.CertificateAuthorityService/ListCertificateTemplates', - request_serializer=service.ListCertificateTemplatesRequest.serialize, - response_deserializer=service.ListCertificateTemplatesResponse.deserialize, - ) - return self._stubs['list_certificate_templates'] - - @property - def update_certificate_template(self) -> Callable[ - [service.UpdateCertificateTemplateRequest], - operations_pb2.Operation]: - r"""Return a callable for the update certificate template method over gRPC. - - Update a - [CertificateTemplate][google.cloud.security.privateca.v1.CertificateTemplate]. - - Returns: - Callable[[~.UpdateCertificateTemplateRequest], - ~.Operation]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if 'update_certificate_template' not in self._stubs: - 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_pb2.Operation.FromString, - ) - return self._stubs['update_certificate_template'] - - def close(self): - self.grpc_channel.close() - - @property - def kind(self) -> str: - return "grpc" - - -__all__ = ( - 'CertificateAuthorityServiceGrpcTransport', -) diff --git a/owl-bot-staging/v1/google/cloud/security/privateca_v1/services/certificate_authority_service/transports/grpc_asyncio.py b/owl-bot-staging/v1/google/cloud/security/privateca_v1/services/certificate_authority_service/transports/grpc_asyncio.py deleted file mode 100644 index b6ef220..0000000 --- a/owl-bot-staging/v1/google/cloud/security/privateca_v1/services/certificate_authority_service/transports/grpc_asyncio.py +++ /dev/null @@ -1,1070 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -import warnings -from typing import Awaitable, Callable, Dict, Optional, Sequence, Tuple, Union - -from google.api_core import gapic_v1 -from google.api_core import grpc_helpers_async -from google.api_core import operations_v1 -from google.auth import credentials as ga_credentials # type: ignore -from google.auth.transport.grpc import SslCredentials # type: ignore - -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 # type: ignore -from .base import CertificateAuthorityServiceTransport, DEFAULT_CLIENT_INFO -from .grpc import CertificateAuthorityServiceGrpcTransport - - -class CertificateAuthorityServiceGrpcAsyncIOTransport(CertificateAuthorityServiceTransport): - """gRPC AsyncIO backend transport for CertificateAuthorityService. - - [Certificate Authority - Service][google.cloud.security.privateca.v1.CertificateAuthorityService] - manages private certificate authorities and issued certificates. - - This class defines the same methods as the primary client, so the - primary client can load the underlying transport implementation - and call it. - - It sends protocol buffers over the wire using gRPC (which is built on - top of HTTP/2); the ``grpcio`` package must be installed. - """ - - _grpc_channel: aio.Channel - _stubs: Dict[str, Callable] = {} - - @classmethod - def create_channel(cls, - host: str = 'privateca.googleapis.com', - credentials: Optional[ga_credentials.Credentials] = None, - credentials_file: Optional[str] = None, - scopes: Optional[Sequence[str]] = None, - quota_project_id: Optional[str] = None, - **kwargs) -> aio.Channel: - """Create and return a gRPC AsyncIO channel object. - Args: - host (Optional[str]): The host for the channel to use. - credentials (Optional[~.Credentials]): The - authorization credentials to attach to requests. These - credentials identify this application to the service. If - none are specified, the client will attempt to ascertain - the credentials from the environment. - credentials_file (Optional[str]): A file with credentials that can - be loaded with :func:`google.auth.load_credentials_from_file`. - This argument is ignored if ``channel`` is provided. - scopes (Optional[Sequence[str]]): A optional list of scopes needed for this - service. These are only used when credentials are not specified and - are passed to :func:`google.auth.default`. - quota_project_id (Optional[str]): An optional project to use for billing - and quota. - kwargs (Optional[dict]): Keyword arguments, which are passed to the - channel creation. - Returns: - aio.Channel: A gRPC AsyncIO channel object. - """ - - return grpc_helpers_async.create_channel( - host, - credentials=credentials, - credentials_file=credentials_file, - quota_project_id=quota_project_id, - default_scopes=cls.AUTH_SCOPES, - scopes=scopes, - default_host=cls.DEFAULT_HOST, - **kwargs - ) - - def __init__(self, *, - host: str = 'privateca.googleapis.com', - credentials: Optional[ga_credentials.Credentials] = None, - credentials_file: Optional[str] = None, - scopes: Optional[Sequence[str]] = None, - channel: Optional[aio.Channel] = None, - api_mtls_endpoint: Optional[str] = None, - client_cert_source: Optional[Callable[[], Tuple[bytes, bytes]]] = None, - ssl_channel_credentials: Optional[grpc.ChannelCredentials] = None, - client_cert_source_for_mtls: Optional[Callable[[], Tuple[bytes, bytes]]] = None, - quota_project_id: Optional[str] = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - always_use_jwt_access: Optional[bool] = False, - api_audience: Optional[str] = None, - ) -> None: - """Instantiate the transport. - - Args: - 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 - are specified, the client will attempt to ascertain the - credentials from the environment. - This argument is ignored if ``channel`` is provided. - credentials_file (Optional[str]): A file with credentials that can - be loaded with :func:`google.auth.load_credentials_from_file`. - This argument is ignored if ``channel`` is provided. - scopes (Optional[Sequence[str]]): A optional list of scopes needed for this - service. These are only used when credentials are not specified and - are passed to :func:`google.auth.default`. - channel (Optional[aio.Channel]): A ``Channel`` instance through - which to make calls. - api_mtls_endpoint (Optional[str]): Deprecated. The mutual TLS endpoint. - If provided, it overrides the ``host`` argument and tries to create - a mutual TLS channel with client SSL credentials from - ``client_cert_source`` or application default SSL credentials. - client_cert_source (Optional[Callable[[], Tuple[bytes, bytes]]]): - Deprecated. A callback to provide client SSL certificate bytes and - private key bytes, both in PEM format. It is ignored if - ``api_mtls_endpoint`` is None. - ssl_channel_credentials (grpc.ChannelCredentials): SSL credentials - for the grpc channel. It is ignored if ``channel`` is provided. - client_cert_source_for_mtls (Optional[Callable[[], Tuple[bytes, bytes]]]): - A callback to provide client certificate bytes and private key bytes, - both in PEM format. It is used to configure a mutual TLS channel. It is - ignored if ``channel`` or ``ssl_channel_credentials`` is provided. - quota_project_id (Optional[str]): An optional project to use for billing - and quota. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - always_use_jwt_access (Optional[bool]): Whether self signed JWT should - be used for service account credentials. - - Raises: - google.auth.exceptions.MutualTlsChannelError: If mutual TLS transport - creation failed for any reason. - google.api_core.exceptions.DuplicateCredentialArgs: If both ``credentials`` - and ``credentials_file`` are passed. - """ - self._grpc_channel = None - self._ssl_channel_credentials = ssl_channel_credentials - self._stubs: Dict[str, Callable] = {} - self._operations_client: Optional[operations_v1.OperationsAsyncClient] = None - - if api_mtls_endpoint: - warnings.warn("api_mtls_endpoint is deprecated", DeprecationWarning) - if client_cert_source: - warnings.warn("client_cert_source is deprecated", DeprecationWarning) - - if channel: - # Ignore credentials if a channel was passed. - credentials = False - # 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 - - # Create SSL credentials with client_cert_source or application - # default SSL credentials. - if client_cert_source: - cert, key = client_cert_source() - self._ssl_channel_credentials = grpc.ssl_channel_credentials( - certificate_chain=cert, private_key=key - ) - else: - self._ssl_channel_credentials = SslCredentials().ssl_credentials - - else: - if client_cert_source_for_mtls and not ssl_channel_credentials: - cert, key = client_cert_source_for_mtls() - self._ssl_channel_credentials = grpc.ssl_channel_credentials( - certificate_chain=cert, private_key=key - ) - - # The base transport sets the host, credentials and scopes - super().__init__( - host=host, - credentials=credentials, - credentials_file=credentials_file, - scopes=scopes, - quota_project_id=quota_project_id, - client_info=client_info, - always_use_jwt_access=always_use_jwt_access, - api_audience=api_audience, - ) - - if not self._grpc_channel: - self._grpc_channel = type(self).create_channel( - self._host, - # use the credentials which are saved - credentials=self._credentials, - # Set ``credentials_file`` to ``None`` here as - # the credentials that we saved earlier should be used. - credentials_file=None, - scopes=self._scopes, - ssl_credentials=self._ssl_channel_credentials, - quota_project_id=quota_project_id, - options=[ - ("grpc.max_send_message_length", -1), - ("grpc.max_receive_message_length", -1), - ], - ) - - # Wrap messages. This must be done after self._grpc_channel exists - self._prep_wrapped_messages(client_info) - - @property - def grpc_channel(self) -> aio.Channel: - """Create the channel designed to connect to this service. - - This property caches on the instance; repeated calls return - the same channel. - """ - # Return the channel from cache. - return self._grpc_channel - - @property - def operations_client(self) -> operations_v1.OperationsAsyncClient: - """Create the client designed to process long-running operations. - - This property caches on the instance; repeated calls return the same - client. - """ - # Quick check: Only create a new client if we do not already have one. - if self._operations_client is None: - self._operations_client = operations_v1.OperationsAsyncClient( - self.grpc_channel - ) - - # Return the client from cache. - return self._operations_client - - @property - def create_certificate(self) -> Callable[ - [service.CreateCertificateRequest], - Awaitable[resources.Certificate]]: - r"""Return a callable for the create certificate method over gRPC. - - Create a new - [Certificate][google.cloud.security.privateca.v1.Certificate] in - a given Project, Location from a particular - [CaPool][google.cloud.security.privateca.v1.CaPool]. - - Returns: - Callable[[~.CreateCertificateRequest], - Awaitable[~.Certificate]]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if 'create_certificate' not in self._stubs: - self._stubs['create_certificate'] = self.grpc_channel.unary_unary( - '/google.cloud.security.privateca.v1.CertificateAuthorityService/CreateCertificate', - request_serializer=service.CreateCertificateRequest.serialize, - response_deserializer=resources.Certificate.deserialize, - ) - return self._stubs['create_certificate'] - - @property - def get_certificate(self) -> Callable[ - [service.GetCertificateRequest], - Awaitable[resources.Certificate]]: - r"""Return a callable for the get certificate method over gRPC. - - Returns a - [Certificate][google.cloud.security.privateca.v1.Certificate]. - - Returns: - Callable[[~.GetCertificateRequest], - Awaitable[~.Certificate]]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if 'get_certificate' not in self._stubs: - self._stubs['get_certificate'] = self.grpc_channel.unary_unary( - '/google.cloud.security.privateca.v1.CertificateAuthorityService/GetCertificate', - request_serializer=service.GetCertificateRequest.serialize, - response_deserializer=resources.Certificate.deserialize, - ) - return self._stubs['get_certificate'] - - @property - def list_certificates(self) -> Callable[ - [service.ListCertificatesRequest], - Awaitable[service.ListCertificatesResponse]]: - r"""Return a callable for the list certificates method over gRPC. - - Lists - [Certificates][google.cloud.security.privateca.v1.Certificate]. - - Returns: - Callable[[~.ListCertificatesRequest], - Awaitable[~.ListCertificatesResponse]]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if 'list_certificates' not in self._stubs: - self._stubs['list_certificates'] = self.grpc_channel.unary_unary( - '/google.cloud.security.privateca.v1.CertificateAuthorityService/ListCertificates', - request_serializer=service.ListCertificatesRequest.serialize, - response_deserializer=service.ListCertificatesResponse.deserialize, - ) - return self._stubs['list_certificates'] - - @property - def revoke_certificate(self) -> Callable[ - [service.RevokeCertificateRequest], - Awaitable[resources.Certificate]]: - r"""Return a callable for the revoke certificate method over gRPC. - - Revoke a - [Certificate][google.cloud.security.privateca.v1.Certificate]. - - Returns: - Callable[[~.RevokeCertificateRequest], - Awaitable[~.Certificate]]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if 'revoke_certificate' not in self._stubs: - self._stubs['revoke_certificate'] = self.grpc_channel.unary_unary( - '/google.cloud.security.privateca.v1.CertificateAuthorityService/RevokeCertificate', - request_serializer=service.RevokeCertificateRequest.serialize, - response_deserializer=resources.Certificate.deserialize, - ) - return self._stubs['revoke_certificate'] - - @property - def update_certificate(self) -> Callable[ - [service.UpdateCertificateRequest], - Awaitable[resources.Certificate]]: - r"""Return a callable for the update certificate method over gRPC. - - Update a - [Certificate][google.cloud.security.privateca.v1.Certificate]. - Currently, the only field you can update is the - [labels][google.cloud.security.privateca.v1.Certificate.labels] - field. - - Returns: - Callable[[~.UpdateCertificateRequest], - Awaitable[~.Certificate]]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if 'update_certificate' not in self._stubs: - self._stubs['update_certificate'] = self.grpc_channel.unary_unary( - '/google.cloud.security.privateca.v1.CertificateAuthorityService/UpdateCertificate', - request_serializer=service.UpdateCertificateRequest.serialize, - response_deserializer=resources.Certificate.deserialize, - ) - return self._stubs['update_certificate'] - - @property - def activate_certificate_authority(self) -> Callable[ - [service.ActivateCertificateAuthorityRequest], - Awaitable[operations_pb2.Operation]]: - r"""Return a callable for the activate certificate authority method over gRPC. - - Activate a - [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority] - that is in state - [AWAITING_USER_ACTIVATION][google.cloud.security.privateca.v1.CertificateAuthority.State.AWAITING_USER_ACTIVATION] - and is of type - [SUBORDINATE][google.cloud.security.privateca.v1.CertificateAuthority.Type.SUBORDINATE]. - After the parent Certificate Authority signs a certificate - signing request from - [FetchCertificateAuthorityCsr][google.cloud.security.privateca.v1.CertificateAuthorityService.FetchCertificateAuthorityCsr], - this method can complete the activation process. - - Returns: - Callable[[~.ActivateCertificateAuthorityRequest], - Awaitable[~.Operation]]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if 'activate_certificate_authority' not in self._stubs: - self._stubs['activate_certificate_authority'] = self.grpc_channel.unary_unary( - '/google.cloud.security.privateca.v1.CertificateAuthorityService/ActivateCertificateAuthority', - request_serializer=service.ActivateCertificateAuthorityRequest.serialize, - response_deserializer=operations_pb2.Operation.FromString, - ) - return self._stubs['activate_certificate_authority'] - - @property - def create_certificate_authority(self) -> Callable[ - [service.CreateCertificateAuthorityRequest], - Awaitable[operations_pb2.Operation]]: - r"""Return a callable for the create certificate authority method over gRPC. - - Create a new - [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority] - in a given Project and Location. - - Returns: - Callable[[~.CreateCertificateAuthorityRequest], - Awaitable[~.Operation]]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if 'create_certificate_authority' not in self._stubs: - 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_pb2.Operation.FromString, - ) - return self._stubs['create_certificate_authority'] - - @property - def disable_certificate_authority(self) -> Callable[ - [service.DisableCertificateAuthorityRequest], - Awaitable[operations_pb2.Operation]]: - r"""Return a callable for the disable certificate authority method over gRPC. - - Disable a - [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority]. - - Returns: - Callable[[~.DisableCertificateAuthorityRequest], - Awaitable[~.Operation]]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if 'disable_certificate_authority' not in self._stubs: - self._stubs['disable_certificate_authority'] = self.grpc_channel.unary_unary( - '/google.cloud.security.privateca.v1.CertificateAuthorityService/DisableCertificateAuthority', - request_serializer=service.DisableCertificateAuthorityRequest.serialize, - response_deserializer=operations_pb2.Operation.FromString, - ) - return self._stubs['disable_certificate_authority'] - - @property - def enable_certificate_authority(self) -> Callable[ - [service.EnableCertificateAuthorityRequest], - Awaitable[operations_pb2.Operation]]: - r"""Return a callable for the enable certificate authority method over gRPC. - - Enable a - [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority]. - - Returns: - Callable[[~.EnableCertificateAuthorityRequest], - Awaitable[~.Operation]]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if 'enable_certificate_authority' not in self._stubs: - 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_pb2.Operation.FromString, - ) - return self._stubs['enable_certificate_authority'] - - @property - def fetch_certificate_authority_csr(self) -> Callable[ - [service.FetchCertificateAuthorityCsrRequest], - Awaitable[service.FetchCertificateAuthorityCsrResponse]]: - r"""Return a callable for the fetch certificate authority - csr method over gRPC. - - Fetch a certificate signing request (CSR) from a - [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority] - that is in state - [AWAITING_USER_ACTIVATION][google.cloud.security.privateca.v1.CertificateAuthority.State.AWAITING_USER_ACTIVATION] - and is of type - [SUBORDINATE][google.cloud.security.privateca.v1.CertificateAuthority.Type.SUBORDINATE]. - The CSR must then be signed by the desired parent Certificate - Authority, which could be another - [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority] - resource, or could be an on-prem certificate authority. See also - [ActivateCertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthorityService.ActivateCertificateAuthority]. - - Returns: - Callable[[~.FetchCertificateAuthorityCsrRequest], - Awaitable[~.FetchCertificateAuthorityCsrResponse]]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if 'fetch_certificate_authority_csr' not in self._stubs: - self._stubs['fetch_certificate_authority_csr'] = self.grpc_channel.unary_unary( - '/google.cloud.security.privateca.v1.CertificateAuthorityService/FetchCertificateAuthorityCsr', - request_serializer=service.FetchCertificateAuthorityCsrRequest.serialize, - response_deserializer=service.FetchCertificateAuthorityCsrResponse.deserialize, - ) - return self._stubs['fetch_certificate_authority_csr'] - - @property - def get_certificate_authority(self) -> Callable[ - [service.GetCertificateAuthorityRequest], - Awaitable[resources.CertificateAuthority]]: - r"""Return a callable for the get certificate authority method over gRPC. - - Returns a - [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority]. - - Returns: - Callable[[~.GetCertificateAuthorityRequest], - Awaitable[~.CertificateAuthority]]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if 'get_certificate_authority' not in self._stubs: - self._stubs['get_certificate_authority'] = self.grpc_channel.unary_unary( - '/google.cloud.security.privateca.v1.CertificateAuthorityService/GetCertificateAuthority', - request_serializer=service.GetCertificateAuthorityRequest.serialize, - response_deserializer=resources.CertificateAuthority.deserialize, - ) - return self._stubs['get_certificate_authority'] - - @property - def list_certificate_authorities(self) -> Callable[ - [service.ListCertificateAuthoritiesRequest], - Awaitable[service.ListCertificateAuthoritiesResponse]]: - r"""Return a callable for the list certificate authorities method over gRPC. - - Lists - [CertificateAuthorities][google.cloud.security.privateca.v1.CertificateAuthority]. - - Returns: - Callable[[~.ListCertificateAuthoritiesRequest], - Awaitable[~.ListCertificateAuthoritiesResponse]]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if 'list_certificate_authorities' not in self._stubs: - self._stubs['list_certificate_authorities'] = self.grpc_channel.unary_unary( - '/google.cloud.security.privateca.v1.CertificateAuthorityService/ListCertificateAuthorities', - request_serializer=service.ListCertificateAuthoritiesRequest.serialize, - response_deserializer=service.ListCertificateAuthoritiesResponse.deserialize, - ) - return self._stubs['list_certificate_authorities'] - - @property - def undelete_certificate_authority(self) -> Callable[ - [service.UndeleteCertificateAuthorityRequest], - Awaitable[operations_pb2.Operation]]: - r"""Return a callable for the undelete certificate authority method over gRPC. - - Undelete a - [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority] - that has been deleted. - - Returns: - Callable[[~.UndeleteCertificateAuthorityRequest], - Awaitable[~.Operation]]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if 'undelete_certificate_authority' not in self._stubs: - self._stubs['undelete_certificate_authority'] = self.grpc_channel.unary_unary( - '/google.cloud.security.privateca.v1.CertificateAuthorityService/UndeleteCertificateAuthority', - request_serializer=service.UndeleteCertificateAuthorityRequest.serialize, - response_deserializer=operations_pb2.Operation.FromString, - ) - return self._stubs['undelete_certificate_authority'] - - @property - def delete_certificate_authority(self) -> Callable[ - [service.DeleteCertificateAuthorityRequest], - Awaitable[operations_pb2.Operation]]: - r"""Return a callable for the delete certificate authority method over gRPC. - - Delete a - [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority]. - - Returns: - Callable[[~.DeleteCertificateAuthorityRequest], - Awaitable[~.Operation]]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if 'delete_certificate_authority' not in self._stubs: - 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_pb2.Operation.FromString, - ) - return self._stubs['delete_certificate_authority'] - - @property - def update_certificate_authority(self) -> Callable[ - [service.UpdateCertificateAuthorityRequest], - Awaitable[operations_pb2.Operation]]: - r"""Return a callable for the update certificate authority method over gRPC. - - Update a - [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority]. - - Returns: - Callable[[~.UpdateCertificateAuthorityRequest], - Awaitable[~.Operation]]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if 'update_certificate_authority' not in self._stubs: - 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_pb2.Operation.FromString, - ) - return self._stubs['update_certificate_authority'] - - @property - def create_ca_pool(self) -> 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]. - - Returns: - Callable[[~.CreateCaPoolRequest], - Awaitable[~.Operation]]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if 'create_ca_pool' not in self._stubs: - 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_pb2.Operation.FromString, - ) - return self._stubs['create_ca_pool'] - - @property - def update_ca_pool(self) -> 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]. - - Returns: - Callable[[~.UpdateCaPoolRequest], - Awaitable[~.Operation]]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if 'update_ca_pool' not in self._stubs: - 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_pb2.Operation.FromString, - ) - return self._stubs['update_ca_pool'] - - @property - def get_ca_pool(self) -> Callable[ - [service.GetCaPoolRequest], - Awaitable[resources.CaPool]]: - r"""Return a callable for the get ca pool method over gRPC. - - Returns a [CaPool][google.cloud.security.privateca.v1.CaPool]. - - Returns: - Callable[[~.GetCaPoolRequest], - Awaitable[~.CaPool]]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if 'get_ca_pool' not in self._stubs: - self._stubs['get_ca_pool'] = self.grpc_channel.unary_unary( - '/google.cloud.security.privateca.v1.CertificateAuthorityService/GetCaPool', - request_serializer=service.GetCaPoolRequest.serialize, - response_deserializer=resources.CaPool.deserialize, - ) - return self._stubs['get_ca_pool'] - - @property - def list_ca_pools(self) -> Callable[ - [service.ListCaPoolsRequest], - Awaitable[service.ListCaPoolsResponse]]: - r"""Return a callable for the list ca pools method over gRPC. - - Lists [CaPools][google.cloud.security.privateca.v1.CaPool]. - - Returns: - Callable[[~.ListCaPoolsRequest], - Awaitable[~.ListCaPoolsResponse]]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if 'list_ca_pools' not in self._stubs: - self._stubs['list_ca_pools'] = self.grpc_channel.unary_unary( - '/google.cloud.security.privateca.v1.CertificateAuthorityService/ListCaPools', - request_serializer=service.ListCaPoolsRequest.serialize, - response_deserializer=service.ListCaPoolsResponse.deserialize, - ) - return self._stubs['list_ca_pools'] - - @property - def delete_ca_pool(self) -> 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]. - - Returns: - Callable[[~.DeleteCaPoolRequest], - Awaitable[~.Operation]]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if 'delete_ca_pool' not in self._stubs: - 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_pb2.Operation.FromString, - ) - return self._stubs['delete_ca_pool'] - - @property - def fetch_ca_certs(self) -> Callable[ - [service.FetchCaCertsRequest], - Awaitable[service.FetchCaCertsResponse]]: - r"""Return a callable for the fetch ca certs method over gRPC. - - FetchCaCerts returns the current trust anchor for the - [CaPool][google.cloud.security.privateca.v1.CaPool]. This will - include CA certificate chains for all ACTIVE - [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority] - resources in the - [CaPool][google.cloud.security.privateca.v1.CaPool]. - - Returns: - Callable[[~.FetchCaCertsRequest], - Awaitable[~.FetchCaCertsResponse]]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if 'fetch_ca_certs' not in self._stubs: - self._stubs['fetch_ca_certs'] = self.grpc_channel.unary_unary( - '/google.cloud.security.privateca.v1.CertificateAuthorityService/FetchCaCerts', - request_serializer=service.FetchCaCertsRequest.serialize, - response_deserializer=service.FetchCaCertsResponse.deserialize, - ) - return self._stubs['fetch_ca_certs'] - - @property - def get_certificate_revocation_list(self) -> Callable[ - [service.GetCertificateRevocationListRequest], - Awaitable[resources.CertificateRevocationList]]: - r"""Return a callable for the get certificate revocation - list method over gRPC. - - Returns a - [CertificateRevocationList][google.cloud.security.privateca.v1.CertificateRevocationList]. - - Returns: - Callable[[~.GetCertificateRevocationListRequest], - Awaitable[~.CertificateRevocationList]]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if 'get_certificate_revocation_list' not in self._stubs: - self._stubs['get_certificate_revocation_list'] = self.grpc_channel.unary_unary( - '/google.cloud.security.privateca.v1.CertificateAuthorityService/GetCertificateRevocationList', - request_serializer=service.GetCertificateRevocationListRequest.serialize, - response_deserializer=resources.CertificateRevocationList.deserialize, - ) - return self._stubs['get_certificate_revocation_list'] - - @property - def list_certificate_revocation_lists(self) -> Callable[ - [service.ListCertificateRevocationListsRequest], - Awaitable[service.ListCertificateRevocationListsResponse]]: - r"""Return a callable for the list certificate revocation - lists method over gRPC. - - Lists - [CertificateRevocationLists][google.cloud.security.privateca.v1.CertificateRevocationList]. - - Returns: - Callable[[~.ListCertificateRevocationListsRequest], - Awaitable[~.ListCertificateRevocationListsResponse]]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if 'list_certificate_revocation_lists' not in self._stubs: - self._stubs['list_certificate_revocation_lists'] = self.grpc_channel.unary_unary( - '/google.cloud.security.privateca.v1.CertificateAuthorityService/ListCertificateRevocationLists', - request_serializer=service.ListCertificateRevocationListsRequest.serialize, - response_deserializer=service.ListCertificateRevocationListsResponse.deserialize, - ) - return self._stubs['list_certificate_revocation_lists'] - - @property - def update_certificate_revocation_list(self) -> Callable[ - [service.UpdateCertificateRevocationListRequest], - Awaitable[operations_pb2.Operation]]: - r"""Return a callable for the update certificate revocation - list method over gRPC. - - Update a - [CertificateRevocationList][google.cloud.security.privateca.v1.CertificateRevocationList]. - - Returns: - Callable[[~.UpdateCertificateRevocationListRequest], - Awaitable[~.Operation]]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if 'update_certificate_revocation_list' not in self._stubs: - self._stubs['update_certificate_revocation_list'] = self.grpc_channel.unary_unary( - '/google.cloud.security.privateca.v1.CertificateAuthorityService/UpdateCertificateRevocationList', - request_serializer=service.UpdateCertificateRevocationListRequest.serialize, - response_deserializer=operations_pb2.Operation.FromString, - ) - return self._stubs['update_certificate_revocation_list'] - - @property - def create_certificate_template(self) -> Callable[ - [service.CreateCertificateTemplateRequest], - Awaitable[operations_pb2.Operation]]: - r"""Return a callable for the create certificate template method over gRPC. - - Create a new - [CertificateTemplate][google.cloud.security.privateca.v1.CertificateTemplate] - in a given Project and Location. - - Returns: - Callable[[~.CreateCertificateTemplateRequest], - Awaitable[~.Operation]]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if 'create_certificate_template' not in self._stubs: - 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_pb2.Operation.FromString, - ) - return self._stubs['create_certificate_template'] - - @property - def delete_certificate_template(self) -> Callable[ - [service.DeleteCertificateTemplateRequest], - Awaitable[operations_pb2.Operation]]: - r"""Return a callable for the delete certificate template method over gRPC. - - DeleteCertificateTemplate deletes a - [CertificateTemplate][google.cloud.security.privateca.v1.CertificateTemplate]. - - Returns: - Callable[[~.DeleteCertificateTemplateRequest], - Awaitable[~.Operation]]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if 'delete_certificate_template' not in self._stubs: - 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_pb2.Operation.FromString, - ) - return self._stubs['delete_certificate_template'] - - @property - def get_certificate_template(self) -> Callable[ - [service.GetCertificateTemplateRequest], - Awaitable[resources.CertificateTemplate]]: - r"""Return a callable for the get certificate template method over gRPC. - - Returns a - [CertificateTemplate][google.cloud.security.privateca.v1.CertificateTemplate]. - - Returns: - Callable[[~.GetCertificateTemplateRequest], - Awaitable[~.CertificateTemplate]]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if 'get_certificate_template' not in self._stubs: - self._stubs['get_certificate_template'] = self.grpc_channel.unary_unary( - '/google.cloud.security.privateca.v1.CertificateAuthorityService/GetCertificateTemplate', - request_serializer=service.GetCertificateTemplateRequest.serialize, - response_deserializer=resources.CertificateTemplate.deserialize, - ) - return self._stubs['get_certificate_template'] - - @property - def list_certificate_templates(self) -> Callable[ - [service.ListCertificateTemplatesRequest], - Awaitable[service.ListCertificateTemplatesResponse]]: - r"""Return a callable for the list certificate templates method over gRPC. - - Lists - [CertificateTemplates][google.cloud.security.privateca.v1.CertificateTemplate]. - - Returns: - Callable[[~.ListCertificateTemplatesRequest], - Awaitable[~.ListCertificateTemplatesResponse]]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if 'list_certificate_templates' not in self._stubs: - self._stubs['list_certificate_templates'] = self.grpc_channel.unary_unary( - '/google.cloud.security.privateca.v1.CertificateAuthorityService/ListCertificateTemplates', - request_serializer=service.ListCertificateTemplatesRequest.serialize, - response_deserializer=service.ListCertificateTemplatesResponse.deserialize, - ) - return self._stubs['list_certificate_templates'] - - @property - def update_certificate_template(self) -> Callable[ - [service.UpdateCertificateTemplateRequest], - Awaitable[operations_pb2.Operation]]: - r"""Return a callable for the update certificate template method over gRPC. - - Update a - [CertificateTemplate][google.cloud.security.privateca.v1.CertificateTemplate]. - - Returns: - Callable[[~.UpdateCertificateTemplateRequest], - Awaitable[~.Operation]]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if 'update_certificate_template' not in self._stubs: - 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_pb2.Operation.FromString, - ) - return self._stubs['update_certificate_template'] - - def close(self): - return self.grpc_channel.close() - - -__all__ = ( - 'CertificateAuthorityServiceGrpcAsyncIOTransport', -) diff --git a/owl-bot-staging/v1/google/cloud/security/privateca_v1/types/__init__.py b/owl-bot-staging/v1/google/cloud/security/privateca_v1/types/__init__.py deleted file mode 100644 index de38a94..0000000 --- a/owl-bot-staging/v1/google/cloud/security/privateca_v1/types/__init__.py +++ /dev/null @@ -1,134 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -from .resources import ( - CaPool, - Certificate, - CertificateAuthority, - CertificateConfig, - CertificateDescription, - CertificateExtensionConstraints, - CertificateIdentityConstraints, - CertificateRevocationList, - CertificateTemplate, - KeyUsage, - ObjectId, - PublicKey, - Subject, - SubjectAltNames, - SubordinateConfig, - X509Extension, - X509Parameters, - RevocationReason, - SubjectRequestMode, -) -from .service import ( - ActivateCertificateAuthorityRequest, - CreateCaPoolRequest, - CreateCertificateAuthorityRequest, - CreateCertificateRequest, - CreateCertificateTemplateRequest, - DeleteCaPoolRequest, - DeleteCertificateAuthorityRequest, - DeleteCertificateTemplateRequest, - DisableCertificateAuthorityRequest, - EnableCertificateAuthorityRequest, - FetchCaCertsRequest, - FetchCaCertsResponse, - FetchCertificateAuthorityCsrRequest, - FetchCertificateAuthorityCsrResponse, - GetCaPoolRequest, - GetCertificateAuthorityRequest, - GetCertificateRequest, - GetCertificateRevocationListRequest, - GetCertificateTemplateRequest, - ListCaPoolsRequest, - ListCaPoolsResponse, - ListCertificateAuthoritiesRequest, - ListCertificateAuthoritiesResponse, - ListCertificateRevocationListsRequest, - ListCertificateRevocationListsResponse, - ListCertificatesRequest, - ListCertificatesResponse, - ListCertificateTemplatesRequest, - ListCertificateTemplatesResponse, - OperationMetadata, - RevokeCertificateRequest, - UndeleteCertificateAuthorityRequest, - UpdateCaPoolRequest, - UpdateCertificateAuthorityRequest, - UpdateCertificateRequest, - UpdateCertificateRevocationListRequest, - UpdateCertificateTemplateRequest, -) - -__all__ = ( - 'CaPool', - 'Certificate', - 'CertificateAuthority', - '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', - 'GetCertificateTemplateRequest', - 'ListCaPoolsRequest', - 'ListCaPoolsResponse', - 'ListCertificateAuthoritiesRequest', - 'ListCertificateAuthoritiesResponse', - 'ListCertificateRevocationListsRequest', - 'ListCertificateRevocationListsResponse', - 'ListCertificatesRequest', - 'ListCertificatesResponse', - 'ListCertificateTemplatesRequest', - 'ListCertificateTemplatesResponse', - 'OperationMetadata', - 'RevokeCertificateRequest', - 'UndeleteCertificateAuthorityRequest', - 'UpdateCaPoolRequest', - 'UpdateCertificateAuthorityRequest', - 'UpdateCertificateRequest', - 'UpdateCertificateRevocationListRequest', - 'UpdateCertificateTemplateRequest', -) diff --git a/owl-bot-staging/v1/google/cloud/security/privateca_v1/types/resources.py b/owl-bot-staging/v1/google/cloud/security/privateca_v1/types/resources.py deleted file mode 100644 index 26acdca..0000000 --- a/owl-bot-staging/v1/google/cloud/security/privateca_v1/types/resources.py +++ /dev/null @@ -1,2179 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -from typing import MutableMapping, MutableSequence - -import proto # 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( - package='google.cloud.security.privateca.v1', - manifest={ - 'RevocationReason', - 'SubjectRequestMode', - 'CertificateAuthority', - 'CaPool', - 'CertificateRevocationList', - 'Certificate', - 'CertificateTemplate', - 'X509Parameters', - 'SubordinateConfig', - 'PublicKey', - 'CertificateConfig', - 'CertificateDescription', - 'ObjectId', - 'X509Extension', - 'KeyUsage', - 'Subject', - 'SubjectAltNames', - 'CertificateIdentityConstraints', - 'CertificateExtensionConstraints', - }, -) - - -class RevocationReason(proto.Enum): - r"""A - [RevocationReason][google.cloud.security.privateca.v1.RevocationReason] - indicates whether a - [Certificate][google.cloud.security.privateca.v1.Certificate] has - been revoked, and the reason for revocation. These correspond to - standard revocation reasons from RFC 5280. Note that the enum labels - and values in this definition are not the same ASN.1 values defined - in RFC 5280. These values will be translated to the correct ASN.1 - values when a CRL is created. - - Values: - REVOCATION_REASON_UNSPECIFIED (0): - Default unspecified value. This value does indicate that a - [Certificate][google.cloud.security.privateca.v1.Certificate] - has been revoked, but that a reason has not been recorded. - KEY_COMPROMISE (1): - Key material for this - [Certificate][google.cloud.security.privateca.v1.Certificate] - may have leaked. - CERTIFICATE_AUTHORITY_COMPROMISE (2): - The key material for a certificate authority - in the issuing path may have leaked. - AFFILIATION_CHANGED (3): - The subject or other attributes in this - [Certificate][google.cloud.security.privateca.v1.Certificate] - have changed. - SUPERSEDED (4): - This - [Certificate][google.cloud.security.privateca.v1.Certificate] - has been superseded. - CESSATION_OF_OPERATION (5): - This - [Certificate][google.cloud.security.privateca.v1.Certificate] - or entities in the issuing path have ceased to operate. - CERTIFICATE_HOLD (6): - This - [Certificate][google.cloud.security.privateca.v1.Certificate] - should not be considered valid, it is expected that it may - become valid in the future. - PRIVILEGE_WITHDRAWN (7): - This - [Certificate][google.cloud.security.privateca.v1.Certificate] - no longer has permission to assert the listed attributes. - ATTRIBUTE_AUTHORITY_COMPROMISE (8): - The authority which determines appropriate attributes for a - [Certificate][google.cloud.security.privateca.v1.Certificate] - may have been compromised. - """ - REVOCATION_REASON_UNSPECIFIED = 0 - KEY_COMPROMISE = 1 - CERTIFICATE_AUTHORITY_COMPROMISE = 2 - AFFILIATION_CHANGED = 3 - SUPERSEDED = 4 - CESSATION_OF_OPERATION = 5 - CERTIFICATE_HOLD = 6 - PRIVILEGE_WITHDRAWN = 7 - ATTRIBUTE_AUTHORITY_COMPROMISE = 8 - - -class SubjectRequestMode(proto.Enum): - r"""Describes the way in which a - [Certificate][google.cloud.security.privateca.v1.Certificate]'s - [Subject][google.cloud.security.privateca.v1.Subject] and/or - [SubjectAltNames][google.cloud.security.privateca.v1.SubjectAltNames] - will be resolved. - - Values: - SUBJECT_REQUEST_MODE_UNSPECIFIED (0): - Not specified. - DEFAULT (1): - The default mode used in most cases. Indicates that the - certificate's - [Subject][google.cloud.security.privateca.v1.Subject] and/or - [SubjectAltNames][google.cloud.security.privateca.v1.SubjectAltNames] - are specified in the certificate request. This mode requires - the caller to have the ``privateca.certificates.create`` - permission. - REFLECTED_SPIFFE (2): - A mode reserved for special cases. Indicates that the - certificate should have one or more SPIFFE - [SubjectAltNames][google.cloud.security.privateca.v1.SubjectAltNames] - set by the service based on the caller's identity. This mode - will ignore any explicitly specified - [Subject][google.cloud.security.privateca.v1.Subject] and/or - [SubjectAltNames][google.cloud.security.privateca.v1.SubjectAltNames] - in the certificate request. This mode requires the caller to - have the ``privateca.certificates.createForSelf`` - permission. - """ - SUBJECT_REQUEST_MODE_UNSPECIFIED = 0 - DEFAULT = 1 - REFLECTED_SPIFFE = 2 - - -class CertificateAuthority(proto.Message): - r"""A - [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority] - represents an individual Certificate Authority. A - [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority] - can be used to create - [Certificates][google.cloud.security.privateca.v1.Certificate]. - - Attributes: - name (str): - Output only. The resource name for this - [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority] - in the format - ``projects/*/locations/*/caPools/*/certificateAuthorities/*``. - type_ (google.cloud.security.privateca_v1.types.CertificateAuthority.Type): - Required. Immutable. The - [Type][google.cloud.security.privateca.v1.CertificateAuthority.Type] - of this - [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority]. - config (google.cloud.security.privateca_v1.types.CertificateConfig): - Required. Immutable. The config used to - create a self-signed X.509 certificate or CSR. - lifetime (google.protobuf.duration_pb2.Duration): - Required. Immutable. The desired lifetime of the CA - certificate. Used to create the "not_before_time" and - "not_after_time" fields inside an X.509 certificate. - key_spec (google.cloud.security.privateca_v1.types.CertificateAuthority.KeyVersionSpec): - Required. Immutable. Used when issuing certificates for this - [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority]. - If this - [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority] - is a self-signed CertificateAuthority, this key is also used - to sign the self-signed CA certificate. Otherwise, it is - used to sign a CSR. - subordinate_config (google.cloud.security.privateca_v1.types.SubordinateConfig): - Optional. If this is a subordinate - [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority], - this field will be set with the subordinate configuration, - which describes its issuers. This may be updated, but this - [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority] - must continue to validate. - tier (google.cloud.security.privateca_v1.types.CaPool.Tier): - Output only. The - [CaPool.Tier][google.cloud.security.privateca.v1.CaPool.Tier] - of the [CaPool][google.cloud.security.privateca.v1.CaPool] - that includes this - [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority]. - state (google.cloud.security.privateca_v1.types.CertificateAuthority.State): - Output only. The - [State][google.cloud.security.privateca.v1.CertificateAuthority.State] - for this - [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority]. - pem_ca_certificates (MutableSequence[str]): - Output only. This - [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority]'s - certificate chain, including the current - [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority]'s - certificate. Ordered such that the root issuer is the final - element (consistent with RFC 5246). For a self-signed CA, - this will only list the current - [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority]'s - certificate. - ca_certificate_descriptions (MutableSequence[google.cloud.security.privateca_v1.types.CertificateDescription]): - Output only. A structured description of this - [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority]'s - CA certificate and its issuers. Ordered as self-to-root. - gcs_bucket (str): - Immutable. The name of a Cloud Storage bucket where this - [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority] - will publish content, such as the CA certificate and CRLs. - This must be a bucket name, without any prefixes (such as - ``gs://``) or suffixes (such as ``.googleapis.com``). For - example, to use a bucket named ``my-bucket``, you would - simply specify ``my-bucket``. If not specified, a managed - bucket will be created. - access_urls (google.cloud.security.privateca_v1.types.CertificateAuthority.AccessUrls): - Output only. URLs for accessing content - published by this CA, such as the CA certificate - and CRLs. - create_time (google.protobuf.timestamp_pb2.Timestamp): - Output only. The time at which this - [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority] - was created. - update_time (google.protobuf.timestamp_pb2.Timestamp): - Output only. The time at which this - [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority] - was last updated. - delete_time (google.protobuf.timestamp_pb2.Timestamp): - Output only. The time at which this - [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority] - was soft deleted, if it is in the - [DELETED][google.cloud.security.privateca.v1.CertificateAuthority.State.DELETED] - state. - expire_time (google.protobuf.timestamp_pb2.Timestamp): - Output only. The time at which this - [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority] - will be permanently purged, if it is in the - [DELETED][google.cloud.security.privateca.v1.CertificateAuthority.State.DELETED] - state. - labels (MutableMapping[str, str]): - Optional. Labels with user-defined metadata. - """ - class Type(proto.Enum): - r"""The type of a - [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority], - indicating its issuing chain. - - Values: - TYPE_UNSPECIFIED (0): - Not specified. - SELF_SIGNED (1): - Self-signed CA. - SUBORDINATE (2): - Subordinate CA. Could be issued by a Private CA - [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority] - or an unmanaged CA. - """ - TYPE_UNSPECIFIED = 0 - SELF_SIGNED = 1 - SUBORDINATE = 2 - - class State(proto.Enum): - r"""The state of a - [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority], - indicating if it can be used. - - Values: - STATE_UNSPECIFIED (0): - Not specified. - ENABLED (1): - Certificates can be issued from this CA. CRLs will be - generated for this CA. The CA will be part of the - [CaPool][google.cloud.security.privateca.v1.CaPool]'s trust - anchor, and will be used to issue certificates from the - [CaPool][google.cloud.security.privateca.v1.CaPool]. - DISABLED (2): - Certificates cannot be issued from this CA. CRLs will still - be generated. The CA will be part of the - [CaPool][google.cloud.security.privateca.v1.CaPool]'s trust - anchor, but will not be used to issue certificates from the - [CaPool][google.cloud.security.privateca.v1.CaPool]. - STAGED (3): - Certificates can be issued from this CA. CRLs will be - generated for this CA. The CA will be part of the - [CaPool][google.cloud.security.privateca.v1.CaPool]'s trust - anchor, but will not be used to issue certificates from the - [CaPool][google.cloud.security.privateca.v1.CaPool]. - AWAITING_USER_ACTIVATION (4): - Certificates cannot be issued from this CA. CRLs will not be - generated. The CA will not be part of the - [CaPool][google.cloud.security.privateca.v1.CaPool]'s trust - anchor, and will not be used to issue certificates from the - [CaPool][google.cloud.security.privateca.v1.CaPool]. - DELETED (5): - Certificates cannot be issued from this CA. CRLs will not be - generated. The CA may still be recovered by calling - [CertificateAuthorityService.UndeleteCertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthorityService.UndeleteCertificateAuthority] - before - [expire_time][google.cloud.security.privateca.v1.CertificateAuthority.expire_time]. - The CA will not be part of the - [CaPool][google.cloud.security.privateca.v1.CaPool]'s trust - anchor, and will not be used to issue certificates from the - [CaPool][google.cloud.security.privateca.v1.CaPool]. - """ - STATE_UNSPECIFIED = 0 - ENABLED = 1 - DISABLED = 2 - STAGED = 3 - AWAITING_USER_ACTIVATION = 4 - DELETED = 5 - - class SignHashAlgorithm(proto.Enum): - r"""The algorithm of a Cloud KMS CryptoKeyVersion of a - [CryptoKey][google.cloud.kms.v1.CryptoKey] with the - [CryptoKeyPurpose][google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose] - value ``ASYMMETRIC_SIGN``. These values correspond to the - [CryptoKeyVersionAlgorithm][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionAlgorithm] - values. For RSA signing algorithms, the PSS algorithms should be - preferred, use PKCS1 algorithms if required for compatibility. For - further recommendations, see - https://cloud.google.com/kms/docs/algorithms#algorithm_recommendations. - - Values: - SIGN_HASH_ALGORITHM_UNSPECIFIED (0): - Not specified. - RSA_PSS_2048_SHA256 (1): - maps to CryptoKeyVersionAlgorithm.RSA_SIGN_PSS_2048_SHA256 - RSA_PSS_3072_SHA256 (2): - maps to CryptoKeyVersionAlgorithm. RSA_SIGN_PSS_3072_SHA256 - RSA_PSS_4096_SHA256 (3): - maps to CryptoKeyVersionAlgorithm.RSA_SIGN_PSS_4096_SHA256 - RSA_PKCS1_2048_SHA256 (6): - maps to CryptoKeyVersionAlgorithm.RSA_SIGN_PKCS1_2048_SHA256 - RSA_PKCS1_3072_SHA256 (7): - maps to CryptoKeyVersionAlgorithm.RSA_SIGN_PKCS1_3072_SHA256 - RSA_PKCS1_4096_SHA256 (8): - maps to CryptoKeyVersionAlgorithm.RSA_SIGN_PKCS1_4096_SHA256 - EC_P256_SHA256 (4): - maps to CryptoKeyVersionAlgorithm.EC_SIGN_P256_SHA256 - EC_P384_SHA384 (5): - maps to CryptoKeyVersionAlgorithm.EC_SIGN_P384_SHA384 - """ - SIGN_HASH_ALGORITHM_UNSPECIFIED = 0 - RSA_PSS_2048_SHA256 = 1 - RSA_PSS_3072_SHA256 = 2 - RSA_PSS_4096_SHA256 = 3 - RSA_PKCS1_2048_SHA256 = 6 - RSA_PKCS1_3072_SHA256 = 7 - RSA_PKCS1_4096_SHA256 = 8 - EC_P256_SHA256 = 4 - EC_P384_SHA384 = 5 - - class AccessUrls(proto.Message): - r"""URLs where a - [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority] - will publish content. - - Attributes: - ca_certificate_access_url (str): - The URL where this - [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority]'s - CA certificate is published. This will only be set for CAs - that have been activated. - crl_access_urls (MutableSequence[str]): - The URLs where this - [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority]'s - CRLs are published. This will only be set for CAs that have - been activated. - """ - - ca_certificate_access_url: str = proto.Field( - proto.STRING, - number=1, - ) - crl_access_urls: MutableSequence[str] = proto.RepeatedField( - proto.STRING, - number=2, - ) - - class KeyVersionSpec(proto.Message): - r"""A Cloud KMS key configuration that a - [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority] - will use. - - This message has `oneof`_ fields (mutually exclusive fields). - For each oneof, at most one member field can be set at the same time. - Setting any member of the oneof automatically clears all other - members. - - .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields - - Attributes: - cloud_kms_key_version (str): - The resource name for an existing Cloud KMS CryptoKeyVersion - in the format - ``projects/*/locations/*/keyRings/*/cryptoKeys/*/cryptoKeyVersions/*``. - This option enables full flexibility in the key's - capabilities and properties. - - This field is a member of `oneof`_ ``KeyVersion``. - algorithm (google.cloud.security.privateca_v1.types.CertificateAuthority.SignHashAlgorithm): - The algorithm to use for creating a managed Cloud KMS key - for a for a simplified experience. All managed keys will be - have their - [ProtectionLevel][google.cloud.kms.v1.ProtectionLevel] as - ``HSM``. - - This field is a member of `oneof`_ ``KeyVersion``. - """ - - cloud_kms_key_version: str = proto.Field( - proto.STRING, - number=1, - oneof='KeyVersion', - ) - algorithm: 'CertificateAuthority.SignHashAlgorithm' = proto.Field( - proto.ENUM, - number=2, - oneof='KeyVersion', - enum='CertificateAuthority.SignHashAlgorithm', - ) - - name: str = proto.Field( - proto.STRING, - number=1, - ) - type_: Type = proto.Field( - proto.ENUM, - number=2, - enum=Type, - ) - config: 'CertificateConfig' = proto.Field( - proto.MESSAGE, - number=3, - message='CertificateConfig', - ) - lifetime: duration_pb2.Duration = proto.Field( - proto.MESSAGE, - number=4, - message=duration_pb2.Duration, - ) - key_spec: KeyVersionSpec = proto.Field( - proto.MESSAGE, - number=5, - message=KeyVersionSpec, - ) - subordinate_config: 'SubordinateConfig' = proto.Field( - proto.MESSAGE, - number=6, - message='SubordinateConfig', - ) - tier: 'CaPool.Tier' = proto.Field( - proto.ENUM, - number=7, - enum='CaPool.Tier', - ) - state: State = proto.Field( - proto.ENUM, - number=8, - enum=State, - ) - pem_ca_certificates: MutableSequence[str] = proto.RepeatedField( - proto.STRING, - number=9, - ) - ca_certificate_descriptions: MutableSequence['CertificateDescription'] = proto.RepeatedField( - proto.MESSAGE, - number=10, - message='CertificateDescription', - ) - gcs_bucket: str = proto.Field( - proto.STRING, - number=11, - ) - access_urls: AccessUrls = proto.Field( - proto.MESSAGE, - number=12, - message=AccessUrls, - ) - create_time: timestamp_pb2.Timestamp = proto.Field( - proto.MESSAGE, - number=13, - message=timestamp_pb2.Timestamp, - ) - update_time: timestamp_pb2.Timestamp = proto.Field( - proto.MESSAGE, - number=14, - message=timestamp_pb2.Timestamp, - ) - delete_time: timestamp_pb2.Timestamp = proto.Field( - proto.MESSAGE, - number=15, - message=timestamp_pb2.Timestamp, - ) - expire_time: timestamp_pb2.Timestamp = proto.Field( - proto.MESSAGE, - number=16, - message=timestamp_pb2.Timestamp, - ) - labels: MutableMapping[str, str] = proto.MapField( - proto.STRING, - proto.STRING, - number=17, - ) - - -class CaPool(proto.Message): - r"""A [CaPool][google.cloud.security.privateca.v1.CaPool] represents a - group of - [CertificateAuthorities][google.cloud.security.privateca.v1.CertificateAuthority] - that form a trust anchor. A - [CaPool][google.cloud.security.privateca.v1.CaPool] can be used to - manage issuance policies for one or more - [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority] - resources and to rotate CA certificates in and out of the trust - anchor. - - Attributes: - name (str): - Output only. The resource name for this - [CaPool][google.cloud.security.privateca.v1.CaPool] in the - format ``projects/*/locations/*/caPools/*``. - tier (google.cloud.security.privateca_v1.types.CaPool.Tier): - Required. Immutable. The - [Tier][google.cloud.security.privateca.v1.CaPool.Tier] of - this [CaPool][google.cloud.security.privateca.v1.CaPool]. - issuance_policy (google.cloud.security.privateca_v1.types.CaPool.IssuancePolicy): - Optional. The - [IssuancePolicy][google.cloud.security.privateca.v1.CaPool.IssuancePolicy] - to control how - [Certificates][google.cloud.security.privateca.v1.Certificate] - will be issued from this - [CaPool][google.cloud.security.privateca.v1.CaPool]. - publishing_options (google.cloud.security.privateca_v1.types.CaPool.PublishingOptions): - Optional. The - [PublishingOptions][google.cloud.security.privateca.v1.CaPool.PublishingOptions] - to follow when issuing - [Certificates][google.cloud.security.privateca.v1.Certificate] - from any - [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority] - in this [CaPool][google.cloud.security.privateca.v1.CaPool]. - labels (MutableMapping[str, str]): - Optional. Labels with user-defined metadata. - """ - class Tier(proto.Enum): - r"""The tier of a [CaPool][google.cloud.security.privateca.v1.CaPool], - indicating its supported functionality and/or billing SKU. - - Values: - TIER_UNSPECIFIED (0): - Not specified. - ENTERPRISE (1): - Enterprise tier. - DEVOPS (2): - DevOps tier. - """ - TIER_UNSPECIFIED = 0 - ENTERPRISE = 1 - DEVOPS = 2 - - class PublishingOptions(proto.Message): - r"""Options relating to the publication of each - [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority]'s - CA certificate and CRLs and their inclusion as extensions in issued - [Certificates][google.cloud.security.privateca.v1.Certificate]. The - options set here apply to certificates issued by any - [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority] - in the [CaPool][google.cloud.security.privateca.v1.CaPool]. - - Attributes: - publish_ca_cert (bool): - Optional. When true, publishes each - [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority]'s - CA certificate and includes its URL in the "Authority - Information Access" X.509 extension in all issued - [Certificates][google.cloud.security.privateca.v1.Certificate]. - If this is false, the CA certificate will not be published - and the corresponding X.509 extension will not be written in - issued certificates. - publish_crl (bool): - Optional. When true, publishes each - [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority]'s - CRL and includes its URL in the "CRL Distribution Points" - X.509 extension in all issued - [Certificates][google.cloud.security.privateca.v1.Certificate]. - If this is false, CRLs will not be published and the - corresponding X.509 extension will not be written in issued - certificates. CRLs will expire 7 days from their creation. - However, we will rebuild daily. CRLs are also rebuilt - shortly after a certificate is revoked. - """ - - publish_ca_cert: bool = proto.Field( - proto.BOOL, - number=1, - ) - publish_crl: bool = proto.Field( - proto.BOOL, - number=2, - ) - - class IssuancePolicy(proto.Message): - r"""Defines controls over all certificate issuance within a - [CaPool][google.cloud.security.privateca.v1.CaPool]. - - Attributes: - allowed_key_types (MutableSequence[google.cloud.security.privateca_v1.types.CaPool.IssuancePolicy.AllowedKeyType]): - Optional. If any - [AllowedKeyType][google.cloud.security.privateca.v1.CaPool.IssuancePolicy.AllowedKeyType] - is specified, then the certificate request's public key must - match one of the key types listed here. Otherwise, any key - may be used. - maximum_lifetime (google.protobuf.duration_pb2.Duration): - Optional. The maximum lifetime allowed for issued - [Certificates][google.cloud.security.privateca.v1.Certificate]. - Note that if the issuing - [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority] - expires before a - [Certificate][google.cloud.security.privateca.v1.Certificate]'s - requested maximum_lifetime, the effective lifetime will be - explicitly truncated to match it. - allowed_issuance_modes (google.cloud.security.privateca_v1.types.CaPool.IssuancePolicy.IssuanceModes): - Optional. If specified, then only methods allowed in the - [IssuanceModes][google.cloud.security.privateca.v1.CaPool.IssuancePolicy.IssuanceModes] - may be used to issue - [Certificates][google.cloud.security.privateca.v1.Certificate]. - baseline_values (google.cloud.security.privateca_v1.types.X509Parameters): - Optional. A set of X.509 values that will be applied to all - certificates issued through this - [CaPool][google.cloud.security.privateca.v1.CaPool]. If a - certificate request includes conflicting values for the same - properties, they will be overwritten by the values defined - here. If a certificate request uses a - [CertificateTemplate][google.cloud.security.privateca.v1.CertificateTemplate] - that defines conflicting - [predefined_values][google.cloud.security.privateca.v1.CertificateTemplate.predefined_values] - for the same properties, the certificate issuance request - will fail. - identity_constraints (google.cloud.security.privateca_v1.types.CertificateIdentityConstraints): - Optional. Describes constraints on identities that may - appear in - [Certificates][google.cloud.security.privateca.v1.Certificate] - issued through this - [CaPool][google.cloud.security.privateca.v1.CaPool]. If this - is omitted, then this - [CaPool][google.cloud.security.privateca.v1.CaPool] will not - add restrictions on a certificate's identity. - passthrough_extensions (google.cloud.security.privateca_v1.types.CertificateExtensionConstraints): - Optional. Describes the set of X.509 extensions that may - appear in a - [Certificate][google.cloud.security.privateca.v1.Certificate] - issued through this - [CaPool][google.cloud.security.privateca.v1.CaPool]. If a - certificate request sets extensions that don't appear in the - [passthrough_extensions][google.cloud.security.privateca.v1.CaPool.IssuancePolicy.passthrough_extensions], - those extensions will be dropped. If a certificate request - uses a - [CertificateTemplate][google.cloud.security.privateca.v1.CertificateTemplate] - with - [predefined_values][google.cloud.security.privateca.v1.CertificateTemplate.predefined_values] - that don't appear here, the certificate issuance request - will fail. If this is omitted, then this - [CaPool][google.cloud.security.privateca.v1.CaPool] will not - add restrictions on a certificate's X.509 extensions. These - constraints do not apply to X.509 extensions set in this - [CaPool][google.cloud.security.privateca.v1.CaPool]'s - [baseline_values][google.cloud.security.privateca.v1.CaPool.IssuancePolicy.baseline_values]. - """ - - class AllowedKeyType(proto.Message): - r"""Describes a "type" of key that may be used in a - [Certificate][google.cloud.security.privateca.v1.Certificate] issued - from a [CaPool][google.cloud.security.privateca.v1.CaPool]. Note - that a single - [AllowedKeyType][google.cloud.security.privateca.v1.CaPool.IssuancePolicy.AllowedKeyType] - may refer to either a fully-qualified key algorithm, such as RSA - 4096, or a family of key algorithms, such as any RSA key. - - This message has `oneof`_ fields (mutually exclusive fields). - For each oneof, at most one member field can be set at the same time. - Setting any member of the oneof automatically clears all other - members. - - .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields - - Attributes: - rsa (google.cloud.security.privateca_v1.types.CaPool.IssuancePolicy.AllowedKeyType.RsaKeyType): - Represents an allowed RSA key type. - - This field is a member of `oneof`_ ``key_type``. - elliptic_curve (google.cloud.security.privateca_v1.types.CaPool.IssuancePolicy.AllowedKeyType.EcKeyType): - Represents an allowed Elliptic Curve key - type. - - This field is a member of `oneof`_ ``key_type``. - """ - - class RsaKeyType(proto.Message): - r"""Describes an RSA key that may be used in a - [Certificate][google.cloud.security.privateca.v1.Certificate] issued - from a [CaPool][google.cloud.security.privateca.v1.CaPool]. - - Attributes: - min_modulus_size (int): - Optional. The minimum allowed RSA modulus - size (inclusive), in bits. If this is not set, - or if set to zero, the service-level min RSA - modulus size will continue to apply. - max_modulus_size (int): - Optional. The maximum allowed RSA modulus - size (inclusive), in bits. If this is not set, - or if set to zero, the service will not enforce - an explicit upper bound on RSA modulus sizes. - """ - - min_modulus_size: int = proto.Field( - proto.INT64, - number=1, - ) - max_modulus_size: int = proto.Field( - proto.INT64, - number=2, - ) - - class EcKeyType(proto.Message): - r"""Describes an Elliptic Curve key that may be used in a - [Certificate][google.cloud.security.privateca.v1.Certificate] issued - from a [CaPool][google.cloud.security.privateca.v1.CaPool]. - - Attributes: - signature_algorithm (google.cloud.security.privateca_v1.types.CaPool.IssuancePolicy.AllowedKeyType.EcKeyType.EcSignatureAlgorithm): - Optional. A signature algorithm that must be - used. If this is omitted, any EC-based signature - algorithm will be allowed. - """ - class EcSignatureAlgorithm(proto.Enum): - r"""Describes an elliptic curve-based signature algorithm that may be - used in a - [Certificate][google.cloud.security.privateca.v1.Certificate] issued - from a [CaPool][google.cloud.security.privateca.v1.CaPool]. - - Values: - EC_SIGNATURE_ALGORITHM_UNSPECIFIED (0): - Not specified. Signifies that any signature - algorithm may be used. - ECDSA_P256 (1): - Refers to the Elliptic Curve Digital - Signature Algorithm over the NIST P-256 curve. - ECDSA_P384 (2): - Refers to the Elliptic Curve Digital - Signature Algorithm over the NIST P-384 curve. - EDDSA_25519 (3): - Refers to the Edwards-curve Digital Signature - Algorithm over curve 25519, as described in RFC - 8410. - """ - EC_SIGNATURE_ALGORITHM_UNSPECIFIED = 0 - ECDSA_P256 = 1 - ECDSA_P384 = 2 - EDDSA_25519 = 3 - - signature_algorithm: 'CaPool.IssuancePolicy.AllowedKeyType.EcKeyType.EcSignatureAlgorithm' = proto.Field( - proto.ENUM, - number=1, - enum='CaPool.IssuancePolicy.AllowedKeyType.EcKeyType.EcSignatureAlgorithm', - ) - - rsa: 'CaPool.IssuancePolicy.AllowedKeyType.RsaKeyType' = proto.Field( - proto.MESSAGE, - number=1, - oneof='key_type', - message='CaPool.IssuancePolicy.AllowedKeyType.RsaKeyType', - ) - elliptic_curve: 'CaPool.IssuancePolicy.AllowedKeyType.EcKeyType' = proto.Field( - proto.MESSAGE, - number=2, - oneof='key_type', - message='CaPool.IssuancePolicy.AllowedKeyType.EcKeyType', - ) - - class IssuanceModes(proto.Message): - r"""[IssuanceModes][google.cloud.security.privateca.v1.CaPool.IssuancePolicy.IssuanceModes] - specifies the allowed ways in which - [Certificates][google.cloud.security.privateca.v1.Certificate] may - be requested from this - [CaPool][google.cloud.security.privateca.v1.CaPool]. - - Attributes: - allow_csr_based_issuance (bool): - Optional. When true, allows callers to create - [Certificates][google.cloud.security.privateca.v1.Certificate] - by specifying a CSR. - allow_config_based_issuance (bool): - Optional. When true, allows callers to create - [Certificates][google.cloud.security.privateca.v1.Certificate] - by specifying a - [CertificateConfig][google.cloud.security.privateca.v1.CertificateConfig]. - """ - - allow_csr_based_issuance: bool = proto.Field( - proto.BOOL, - number=1, - ) - allow_config_based_issuance: bool = proto.Field( - proto.BOOL, - number=2, - ) - - allowed_key_types: MutableSequence['CaPool.IssuancePolicy.AllowedKeyType'] = proto.RepeatedField( - proto.MESSAGE, - number=1, - message='CaPool.IssuancePolicy.AllowedKeyType', - ) - maximum_lifetime: duration_pb2.Duration = proto.Field( - proto.MESSAGE, - number=2, - message=duration_pb2.Duration, - ) - allowed_issuance_modes: 'CaPool.IssuancePolicy.IssuanceModes' = proto.Field( - proto.MESSAGE, - number=3, - message='CaPool.IssuancePolicy.IssuanceModes', - ) - baseline_values: 'X509Parameters' = proto.Field( - proto.MESSAGE, - number=4, - message='X509Parameters', - ) - identity_constraints: 'CertificateIdentityConstraints' = proto.Field( - proto.MESSAGE, - number=5, - message='CertificateIdentityConstraints', - ) - passthrough_extensions: 'CertificateExtensionConstraints' = proto.Field( - proto.MESSAGE, - number=6, - message='CertificateExtensionConstraints', - ) - - name: str = proto.Field( - proto.STRING, - number=1, - ) - tier: Tier = proto.Field( - proto.ENUM, - number=2, - enum=Tier, - ) - issuance_policy: IssuancePolicy = proto.Field( - proto.MESSAGE, - number=3, - message=IssuancePolicy, - ) - publishing_options: PublishingOptions = proto.Field( - proto.MESSAGE, - number=4, - message=PublishingOptions, - ) - labels: MutableMapping[str, str] = proto.MapField( - proto.STRING, - proto.STRING, - number=5, - ) - - -class CertificateRevocationList(proto.Message): - r"""A - [CertificateRevocationList][google.cloud.security.privateca.v1.CertificateRevocationList] - corresponds to a signed X.509 certificate Revocation List (CRL). A - CRL contains the serial numbers of certificates that should no - longer be trusted. - - Attributes: - name (str): - Output only. The resource name for this - [CertificateRevocationList][google.cloud.security.privateca.v1.CertificateRevocationList] - in the format - ``projects/*/locations/*/caPools/*certificateAuthorities/*/ certificateRevocationLists/*``. - sequence_number (int): - Output only. The CRL sequence number that appears in - pem_crl. - revoked_certificates (MutableSequence[google.cloud.security.privateca_v1.types.CertificateRevocationList.RevokedCertificate]): - Output only. The revoked serial numbers that appear in - pem_crl. - pem_crl (str): - Output only. The PEM-encoded X.509 CRL. - access_url (str): - Output only. The location where 'pem_crl' can be accessed. - state (google.cloud.security.privateca_v1.types.CertificateRevocationList.State): - Output only. The - [State][google.cloud.security.privateca.v1.CertificateRevocationList.State] - for this - [CertificateRevocationList][google.cloud.security.privateca.v1.CertificateRevocationList]. - create_time (google.protobuf.timestamp_pb2.Timestamp): - Output only. The time at which this - [CertificateRevocationList][google.cloud.security.privateca.v1.CertificateRevocationList] - was created. - update_time (google.protobuf.timestamp_pb2.Timestamp): - Output only. The time at which this - [CertificateRevocationList][google.cloud.security.privateca.v1.CertificateRevocationList] - was updated. - revision_id (str): - Output only. The revision ID of this - [CertificateRevocationList][google.cloud.security.privateca.v1.CertificateRevocationList]. - A new revision is committed whenever a new CRL is published. - The format is an 8-character hexadecimal string. - labels (MutableMapping[str, str]): - Optional. Labels with user-defined metadata. - """ - class State(proto.Enum): - r"""The state of a - [CertificateRevocationList][google.cloud.security.privateca.v1.CertificateRevocationList], - indicating if it is current. - - Values: - STATE_UNSPECIFIED (0): - Not specified. - ACTIVE (1): - The - [CertificateRevocationList][google.cloud.security.privateca.v1.CertificateRevocationList] - is up to date. - SUPERSEDED (2): - The - [CertificateRevocationList][google.cloud.security.privateca.v1.CertificateRevocationList] - is no longer current. - """ - STATE_UNSPECIFIED = 0 - ACTIVE = 1 - SUPERSEDED = 2 - - class RevokedCertificate(proto.Message): - r"""Describes a revoked - [Certificate][google.cloud.security.privateca.v1.Certificate]. - - Attributes: - certificate (str): - The resource name for the - [Certificate][google.cloud.security.privateca.v1.Certificate] - in the format - ``projects/*/locations/*/caPools/*/certificates/*``. - hex_serial_number (str): - The serial number of the - [Certificate][google.cloud.security.privateca.v1.Certificate]. - revocation_reason (google.cloud.security.privateca_v1.types.RevocationReason): - The reason the - [Certificate][google.cloud.security.privateca.v1.Certificate] - was revoked. - """ - - certificate: str = proto.Field( - proto.STRING, - number=1, - ) - hex_serial_number: str = proto.Field( - proto.STRING, - number=2, - ) - revocation_reason: 'RevocationReason' = proto.Field( - proto.ENUM, - number=3, - enum='RevocationReason', - ) - - name: str = proto.Field( - proto.STRING, - number=1, - ) - sequence_number: int = proto.Field( - proto.INT64, - number=2, - ) - revoked_certificates: MutableSequence[RevokedCertificate] = proto.RepeatedField( - proto.MESSAGE, - number=3, - message=RevokedCertificate, - ) - pem_crl: str = proto.Field( - proto.STRING, - number=4, - ) - access_url: str = proto.Field( - proto.STRING, - number=5, - ) - state: State = proto.Field( - proto.ENUM, - number=6, - enum=State, - ) - create_time: timestamp_pb2.Timestamp = proto.Field( - proto.MESSAGE, - number=7, - message=timestamp_pb2.Timestamp, - ) - update_time: timestamp_pb2.Timestamp = proto.Field( - proto.MESSAGE, - number=8, - message=timestamp_pb2.Timestamp, - ) - revision_id: str = proto.Field( - proto.STRING, - number=9, - ) - labels: MutableMapping[str, str] = proto.MapField( - proto.STRING, - proto.STRING, - number=10, - ) - - -class Certificate(proto.Message): - r"""A [Certificate][google.cloud.security.privateca.v1.Certificate] - corresponds to a signed X.509 certificate issued by a - [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority]. - - This message has `oneof`_ fields (mutually exclusive fields). - For each oneof, at most one member field can be set at the same time. - Setting any member of the oneof automatically clears all other - members. - - .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields - - Attributes: - name (str): - Output only. The resource name for this - [Certificate][google.cloud.security.privateca.v1.Certificate] - in the format - ``projects/*/locations/*/caPools/*/certificates/*``. - pem_csr (str): - Immutable. A pem-encoded X.509 certificate - signing request (CSR). - - This field is a member of `oneof`_ ``certificate_config``. - config (google.cloud.security.privateca_v1.types.CertificateConfig): - Immutable. A description of the certificate - and key that does not require X.509 or ASN.1. - - This field is a member of `oneof`_ ``certificate_config``. - issuer_certificate_authority (str): - Output only. The resource name of the issuing - [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority] - in the format - ``projects/*/locations/*/caPools/*/certificateAuthorities/*``. - lifetime (google.protobuf.duration_pb2.Duration): - Required. Immutable. The desired lifetime of a certificate. - Used to create the "not_before_time" and "not_after_time" - fields inside an X.509 certificate. Note that the lifetime - may be truncated if it would extend past the life of any - certificate authority in the issuing chain. - certificate_template (str): - Immutable. The resource name for a - [CertificateTemplate][google.cloud.security.privateca.v1.CertificateTemplate] - used to issue this certificate, in the format - ``projects/*/locations/*/certificateTemplates/*``. If this - is specified, the caller must have the necessary permission - to use this template. If this is omitted, no template will - be used. This template must be in the same location as the - [Certificate][google.cloud.security.privateca.v1.Certificate]. - subject_mode (google.cloud.security.privateca_v1.types.SubjectRequestMode): - Immutable. Specifies how the - [Certificate][google.cloud.security.privateca.v1.Certificate]'s - identity fields are to be decided. If this is omitted, the - ``DEFAULT`` subject mode will be used. - revocation_details (google.cloud.security.privateca_v1.types.Certificate.RevocationDetails): - Output only. Details regarding the revocation of this - [Certificate][google.cloud.security.privateca.v1.Certificate]. - This - [Certificate][google.cloud.security.privateca.v1.Certificate] - is considered revoked if and only if this field is present. - pem_certificate (str): - Output only. The pem-encoded, signed X.509 - certificate. - certificate_description (google.cloud.security.privateca_v1.types.CertificateDescription): - Output only. A structured description of the - issued X.509 certificate. - pem_certificate_chain (MutableSequence[str]): - Output only. The chain that may be used to - verify the X.509 certificate. Expected to be in - issuer-to-root order according to RFC 5246. - create_time (google.protobuf.timestamp_pb2.Timestamp): - Output only. The time at which this - [Certificate][google.cloud.security.privateca.v1.Certificate] - was created. - update_time (google.protobuf.timestamp_pb2.Timestamp): - Output only. The time at which this - [Certificate][google.cloud.security.privateca.v1.Certificate] - was updated. - labels (MutableMapping[str, str]): - Optional. Labels with user-defined metadata. - """ - - class RevocationDetails(proto.Message): - r"""Describes fields that are relavent to the revocation of a - [Certificate][google.cloud.security.privateca.v1.Certificate]. - - Attributes: - revocation_state (google.cloud.security.privateca_v1.types.RevocationReason): - Indicates why a - [Certificate][google.cloud.security.privateca.v1.Certificate] - was revoked. - revocation_time (google.protobuf.timestamp_pb2.Timestamp): - The time at which this - [Certificate][google.cloud.security.privateca.v1.Certificate] - was revoked. - """ - - revocation_state: 'RevocationReason' = proto.Field( - proto.ENUM, - number=1, - enum='RevocationReason', - ) - revocation_time: timestamp_pb2.Timestamp = proto.Field( - proto.MESSAGE, - number=2, - message=timestamp_pb2.Timestamp, - ) - - name: str = proto.Field( - proto.STRING, - number=1, - ) - pem_csr: str = proto.Field( - proto.STRING, - number=2, - oneof='certificate_config', - ) - config: 'CertificateConfig' = proto.Field( - proto.MESSAGE, - number=3, - oneof='certificate_config', - message='CertificateConfig', - ) - issuer_certificate_authority: str = proto.Field( - proto.STRING, - number=4, - ) - lifetime: duration_pb2.Duration = proto.Field( - proto.MESSAGE, - number=5, - message=duration_pb2.Duration, - ) - certificate_template: str = proto.Field( - proto.STRING, - number=6, - ) - subject_mode: 'SubjectRequestMode' = proto.Field( - proto.ENUM, - number=7, - enum='SubjectRequestMode', - ) - revocation_details: RevocationDetails = proto.Field( - proto.MESSAGE, - number=8, - message=RevocationDetails, - ) - pem_certificate: str = proto.Field( - proto.STRING, - number=9, - ) - certificate_description: 'CertificateDescription' = proto.Field( - proto.MESSAGE, - number=10, - message='CertificateDescription', - ) - pem_certificate_chain: MutableSequence[str] = proto.RepeatedField( - proto.STRING, - number=11, - ) - create_time: timestamp_pb2.Timestamp = proto.Field( - proto.MESSAGE, - number=12, - message=timestamp_pb2.Timestamp, - ) - update_time: timestamp_pb2.Timestamp = proto.Field( - proto.MESSAGE, - number=13, - message=timestamp_pb2.Timestamp, - ) - labels: MutableMapping[str, str] = proto.MapField( - proto.STRING, - proto.STRING, - number=14, - ) - - -class CertificateTemplate(proto.Message): - r"""A - [CertificateTemplate][google.cloud.security.privateca.v1.CertificateTemplate] - refers to a managed template for certificate issuance. - - Attributes: - name (str): - Output only. The resource name for this - [CertificateTemplate][google.cloud.security.privateca.v1.CertificateTemplate] - in the format - ``projects/*/locations/*/certificateTemplates/*``. - predefined_values (google.cloud.security.privateca_v1.types.X509Parameters): - Optional. A set of X.509 values that will be applied to all - issued certificates that use this template. If the - certificate request includes conflicting values for the same - properties, they will be overwritten by the values defined - here. If the issuing - [CaPool][google.cloud.security.privateca.v1.CaPool]'s - [IssuancePolicy][google.cloud.security.privateca.v1.CaPool.IssuancePolicy] - defines conflicting - [baseline_values][google.cloud.security.privateca.v1.CaPool.IssuancePolicy.baseline_values] - for the same properties, the certificate issuance request - will fail. - identity_constraints (google.cloud.security.privateca_v1.types.CertificateIdentityConstraints): - Optional. Describes constraints on identities that may be - appear in - [Certificates][google.cloud.security.privateca.v1.Certificate] - issued using this template. If this is omitted, then this - template will not add restrictions on a certificate's - identity. - passthrough_extensions (google.cloud.security.privateca_v1.types.CertificateExtensionConstraints): - Optional. Describes the set of X.509 extensions that may - appear in a - [Certificate][google.cloud.security.privateca.v1.Certificate] - issued using this - [CertificateTemplate][google.cloud.security.privateca.v1.CertificateTemplate]. - If a certificate request sets extensions that don't appear - in the - [passthrough_extensions][google.cloud.security.privateca.v1.CertificateTemplate.passthrough_extensions], - those extensions will be dropped. If the issuing - [CaPool][google.cloud.security.privateca.v1.CaPool]'s - [IssuancePolicy][google.cloud.security.privateca.v1.CaPool.IssuancePolicy] - defines - [baseline_values][google.cloud.security.privateca.v1.CaPool.IssuancePolicy.baseline_values] - that don't appear here, the certificate issuance request - will fail. If this is omitted, then this template will not - add restrictions on a certificate's X.509 extensions. These - constraints do not apply to X.509 extensions set in this - [CertificateTemplate][google.cloud.security.privateca.v1.CertificateTemplate]'s - [predefined_values][google.cloud.security.privateca.v1.CertificateTemplate.predefined_values]. - description (str): - Optional. A human-readable description of - scenarios this template is intended for. - create_time (google.protobuf.timestamp_pb2.Timestamp): - Output only. The time at which this - [CertificateTemplate][google.cloud.security.privateca.v1.CertificateTemplate] - was created. - update_time (google.protobuf.timestamp_pb2.Timestamp): - Output only. The time at which this - [CertificateTemplate][google.cloud.security.privateca.v1.CertificateTemplate] - was updated. - labels (MutableMapping[str, str]): - Optional. Labels with user-defined metadata. - """ - - name: str = proto.Field( - proto.STRING, - number=1, - ) - predefined_values: 'X509Parameters' = proto.Field( - proto.MESSAGE, - number=2, - message='X509Parameters', - ) - identity_constraints: 'CertificateIdentityConstraints' = proto.Field( - proto.MESSAGE, - number=3, - message='CertificateIdentityConstraints', - ) - passthrough_extensions: 'CertificateExtensionConstraints' = proto.Field( - proto.MESSAGE, - number=4, - message='CertificateExtensionConstraints', - ) - description: str = proto.Field( - proto.STRING, - number=5, - ) - create_time: timestamp_pb2.Timestamp = proto.Field( - proto.MESSAGE, - number=6, - message=timestamp_pb2.Timestamp, - ) - update_time: timestamp_pb2.Timestamp = proto.Field( - proto.MESSAGE, - number=7, - message=timestamp_pb2.Timestamp, - ) - labels: MutableMapping[str, str] = proto.MapField( - proto.STRING, - proto.STRING, - number=8, - ) - - -class X509Parameters(proto.Message): - r"""An - [X509Parameters][google.cloud.security.privateca.v1.X509Parameters] - is used to describe certain fields of an X.509 certificate, such as - the key usage fields, fields specific to CA certificates, - certificate policy extensions and custom extensions. - - Attributes: - key_usage (google.cloud.security.privateca_v1.types.KeyUsage): - Optional. Indicates the intended use for keys - that correspond to a certificate. - ca_options (google.cloud.security.privateca_v1.types.X509Parameters.CaOptions): - Optional. Describes options in this - [X509Parameters][google.cloud.security.privateca.v1.X509Parameters] - that are relevant in a CA certificate. - policy_ids (MutableSequence[google.cloud.security.privateca_v1.types.ObjectId]): - Optional. Describes the X.509 certificate - policy object identifiers, per - https://tools.ietf.org/html/rfc5280#section-4.2.1.4. - aia_ocsp_servers (MutableSequence[str]): - Optional. Describes Online Certificate Status - Protocol (OCSP) endpoint addresses that appear - in the "Authority Information Access" extension - in the certificate. - additional_extensions (MutableSequence[google.cloud.security.privateca_v1.types.X509Extension]): - Optional. Describes custom X.509 extensions. - """ - - class CaOptions(proto.Message): - r"""Describes values that are relevant in a CA certificate. - - .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields - - Attributes: - is_ca (bool): - Optional. Refers to the "CA" X.509 extension, - which is a boolean value. When this value is - missing, the extension will be omitted from the - CA certificate. - - This field is a member of `oneof`_ ``_is_ca``. - max_issuer_path_length (int): - Optional. Refers to the path length - restriction X.509 extension. For a CA - certificate, this value describes the depth of - subordinate CA certificates that are allowed. - If this value is less than 0, the request will - fail. If this value is missing, the max path - length will be omitted from the CA certificate. - - This field is a member of `oneof`_ ``_max_issuer_path_length``. - """ - - is_ca: bool = proto.Field( - proto.BOOL, - number=1, - optional=True, - ) - max_issuer_path_length: int = proto.Field( - proto.INT32, - number=2, - optional=True, - ) - - key_usage: 'KeyUsage' = proto.Field( - proto.MESSAGE, - number=1, - message='KeyUsage', - ) - ca_options: CaOptions = proto.Field( - proto.MESSAGE, - number=2, - message=CaOptions, - ) - policy_ids: MutableSequence['ObjectId'] = proto.RepeatedField( - proto.MESSAGE, - number=3, - message='ObjectId', - ) - aia_ocsp_servers: MutableSequence[str] = proto.RepeatedField( - proto.STRING, - number=4, - ) - additional_extensions: MutableSequence['X509Extension'] = proto.RepeatedField( - proto.MESSAGE, - number=5, - message='X509Extension', - ) - - -class SubordinateConfig(proto.Message): - r"""Describes a subordinate CA's issuers. This is either a resource name - to a known issuing - [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority], - or a PEM issuer certificate chain. - - This message has `oneof`_ fields (mutually exclusive fields). - For each oneof, at most one member field can be set at the same time. - Setting any member of the oneof automatically clears all other - members. - - .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields - - Attributes: - certificate_authority (str): - Required. This can refer to a - [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority] - that was used to create a subordinate - [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority]. - This field is used for information and usability purposes - only. The resource name is in the format - ``projects/*/locations/*/caPools/*/certificateAuthorities/*``. - - This field is a member of `oneof`_ ``subordinate_config``. - pem_issuer_chain (google.cloud.security.privateca_v1.types.SubordinateConfig.SubordinateConfigChain): - Required. Contains the PEM certificate chain for the issuers - of this - [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority], - but not pem certificate for this CA itself. - - This field is a member of `oneof`_ ``subordinate_config``. - """ - - class SubordinateConfigChain(proto.Message): - r"""This message describes a subordinate CA's issuer certificate - chain. This wrapper exists for compatibility reasons. - - Attributes: - pem_certificates (MutableSequence[str]): - Required. Expected to be in leaf-to-root - order according to RFC 5246. - """ - - pem_certificates: MutableSequence[str] = proto.RepeatedField( - proto.STRING, - number=1, - ) - - certificate_authority: str = proto.Field( - proto.STRING, - number=1, - oneof='subordinate_config', - ) - pem_issuer_chain: SubordinateConfigChain = proto.Field( - proto.MESSAGE, - number=2, - oneof='subordinate_config', - message=SubordinateConfigChain, - ) - - -class PublicKey(proto.Message): - r"""A [PublicKey][google.cloud.security.privateca.v1.PublicKey] - describes a public key. - - Attributes: - key (bytes): - Required. A public key. The padding and encoding must match - with the ``KeyFormat`` value specified for the ``format`` - field. - format_ (google.cloud.security.privateca_v1.types.PublicKey.KeyFormat): - Required. The format of the public key. - """ - class KeyFormat(proto.Enum): - r"""Types of public keys formats that are supported. Currently, only - ``PEM`` format is supported. - - Values: - KEY_FORMAT_UNSPECIFIED (0): - Default unspecified value. - PEM (1): - The key is PEM-encoded as defined in `RFC - 7468 `__. It can be any - of the following: a PEM-encoded PKCS#1/RFC 3447 RSAPublicKey - structure, an RFC 5280 - `SubjectPublicKeyInfo `__ - or a PEM-encoded X.509 certificate signing request (CSR). If - a - `SubjectPublicKeyInfo `__ - is specified, it can contain a A PEM-encoded PKCS#1/RFC 3447 - RSAPublicKey or a NIST P-256/secp256r1/prime256v1 or P-384 - key. If a CSR is specified, it will used solely for the - purpose of extracting the public key. When generated by the - service, it will always be an RFC 5280 - `SubjectPublicKeyInfo `__ - structure containing an algorithm identifier and a key. - """ - KEY_FORMAT_UNSPECIFIED = 0 - PEM = 1 - - key: bytes = proto.Field( - proto.BYTES, - number=1, - ) - format_: KeyFormat = proto.Field( - proto.ENUM, - number=2, - enum=KeyFormat, - ) - - -class CertificateConfig(proto.Message): - r"""A - [CertificateConfig][google.cloud.security.privateca.v1.CertificateConfig] - describes an X.509 certificate or CSR that is to be created, as an - alternative to using ASN.1. - - Attributes: - subject_config (google.cloud.security.privateca_v1.types.CertificateConfig.SubjectConfig): - Required. Specifies some of the values in a - certificate that are related to the subject. - x509_config (google.cloud.security.privateca_v1.types.X509Parameters): - Required. Describes how some of the technical - X.509 fields in a certificate should be - populated. - public_key (google.cloud.security.privateca_v1.types.PublicKey): - Optional. The public key that corresponds to this config. - This is, for example, used when issuing - [Certificates][google.cloud.security.privateca.v1.Certificate], - but not when creating a self-signed - [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority] - or - [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority] - CSR. - """ - - class SubjectConfig(proto.Message): - r"""These values are used to create the distinguished name and - subject alternative name fields in an X.509 certificate. - - Attributes: - subject (google.cloud.security.privateca_v1.types.Subject): - Required. Contains distinguished name fields - such as the common name, location and - organization. - subject_alt_name (google.cloud.security.privateca_v1.types.SubjectAltNames): - Optional. The subject alternative name - fields. - """ - - subject: 'Subject' = proto.Field( - proto.MESSAGE, - number=1, - message='Subject', - ) - subject_alt_name: 'SubjectAltNames' = proto.Field( - proto.MESSAGE, - number=2, - message='SubjectAltNames', - ) - - subject_config: SubjectConfig = proto.Field( - proto.MESSAGE, - number=1, - message=SubjectConfig, - ) - x509_config: 'X509Parameters' = proto.Field( - proto.MESSAGE, - number=2, - message='X509Parameters', - ) - public_key: 'PublicKey' = proto.Field( - proto.MESSAGE, - number=3, - message='PublicKey', - ) - - -class CertificateDescription(proto.Message): - r"""A - [CertificateDescription][google.cloud.security.privateca.v1.CertificateDescription] - describes an X.509 certificate or CSR that has been issued, as an - alternative to using ASN.1 / X.509. - - Attributes: - subject_description (google.cloud.security.privateca_v1.types.CertificateDescription.SubjectDescription): - Describes some of the values in a certificate - that are related to the subject and lifetime. - x509_description (google.cloud.security.privateca_v1.types.X509Parameters): - Describes some of the technical X.509 fields - in a certificate. - public_key (google.cloud.security.privateca_v1.types.PublicKey): - The public key that corresponds to an issued - certificate. - subject_key_id (google.cloud.security.privateca_v1.types.CertificateDescription.KeyId): - Provides a means of identifiying certificates - that contain a particular public key, per - https://tools.ietf.org/html/rfc5280#section-4.2.1.2. - authority_key_id (google.cloud.security.privateca_v1.types.CertificateDescription.KeyId): - Identifies the subject_key_id of the parent certificate, per - https://tools.ietf.org/html/rfc5280#section-4.2.1.1 - crl_distribution_points (MutableSequence[str]): - Describes a list of locations to obtain CRL - information, i.e. the DistributionPoint.fullName - described by - https://tools.ietf.org/html/rfc5280#section-4.2.1.13 - aia_issuing_certificate_urls (MutableSequence[str]): - Describes lists of issuer CA certificate URLs - that appear in the "Authority Information - Access" extension in the certificate. - cert_fingerprint (google.cloud.security.privateca_v1.types.CertificateDescription.CertificateFingerprint): - The hash of the x.509 certificate. - """ - - class SubjectDescription(proto.Message): - r"""These values describe fields in an issued X.509 certificate - such as the distinguished name, subject alternative names, - serial number, and lifetime. - - Attributes: - subject (google.cloud.security.privateca_v1.types.Subject): - Contains distinguished name fields such as - the common name, location and / organization. - subject_alt_name (google.cloud.security.privateca_v1.types.SubjectAltNames): - The subject alternative name fields. - hex_serial_number (str): - The serial number encoded in lowercase - hexadecimal. - lifetime (google.protobuf.duration_pb2.Duration): - For convenience, the actual lifetime of an - issued certificate. - not_before_time (google.protobuf.timestamp_pb2.Timestamp): - The time at which the certificate becomes - valid. - not_after_time (google.protobuf.timestamp_pb2.Timestamp): - The time after which the certificate is expired. Per RFC - 5280, the validity period for a certificate is the period of - time from not_before_time through not_after_time, inclusive. - Corresponds to 'not_before_time' + 'lifetime' - 1 second. - """ - - subject: 'Subject' = proto.Field( - proto.MESSAGE, - number=1, - message='Subject', - ) - subject_alt_name: 'SubjectAltNames' = proto.Field( - proto.MESSAGE, - number=2, - message='SubjectAltNames', - ) - hex_serial_number: str = proto.Field( - proto.STRING, - number=3, - ) - lifetime: duration_pb2.Duration = proto.Field( - proto.MESSAGE, - number=4, - message=duration_pb2.Duration, - ) - not_before_time: timestamp_pb2.Timestamp = proto.Field( - proto.MESSAGE, - number=5, - message=timestamp_pb2.Timestamp, - ) - not_after_time: timestamp_pb2.Timestamp = proto.Field( - proto.MESSAGE, - number=6, - message=timestamp_pb2.Timestamp, - ) - - class KeyId(proto.Message): - r"""A KeyId identifies a specific public key, usually by hashing - the public key. - - Attributes: - key_id (str): - Optional. The value of this KeyId encoded in - lowercase hexadecimal. This is most likely the - 160 bit SHA-1 hash of the public key. - """ - - key_id: str = 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: str = proto.Field( - proto.STRING, - number=1, - ) - - subject_description: SubjectDescription = proto.Field( - proto.MESSAGE, - number=1, - message=SubjectDescription, - ) - x509_description: 'X509Parameters' = proto.Field( - proto.MESSAGE, - number=2, - message='X509Parameters', - ) - public_key: 'PublicKey' = proto.Field( - proto.MESSAGE, - number=3, - message='PublicKey', - ) - subject_key_id: KeyId = proto.Field( - proto.MESSAGE, - number=4, - message=KeyId, - ) - authority_key_id: KeyId = proto.Field( - proto.MESSAGE, - number=5, - message=KeyId, - ) - crl_distribution_points: MutableSequence[str] = proto.RepeatedField( - proto.STRING, - number=6, - ) - aia_issuing_certificate_urls: MutableSequence[str] = proto.RepeatedField( - proto.STRING, - number=7, - ) - cert_fingerprint: CertificateFingerprint = proto.Field( - proto.MESSAGE, - number=8, - message=CertificateFingerprint, - ) - - -class ObjectId(proto.Message): - r"""An [ObjectId][google.cloud.security.privateca.v1.ObjectId] specifies - an object identifier (OID). These provide context and describe types - in ASN.1 messages. - - Attributes: - object_id_path (MutableSequence[int]): - Required. The parts of an OID path. The most - significant parts of the path come first. - """ - - object_id_path: MutableSequence[int] = proto.RepeatedField( - proto.INT32, - number=1, - ) - - -class X509Extension(proto.Message): - r"""An [X509Extension][google.cloud.security.privateca.v1.X509Extension] - specifies an X.509 extension, which may be used in different parts - of X.509 objects like certificates, CSRs, and CRLs. - - Attributes: - object_id (google.cloud.security.privateca_v1.types.ObjectId): - Required. The OID for this X.509 extension. - critical (bool): - Optional. Indicates whether or not this - extension is critical (i.e., if the client does - not know how to handle this extension, the - client should consider this to be an error). - value (bytes): - Required. The value of this X.509 extension. - """ - - object_id: 'ObjectId' = proto.Field( - proto.MESSAGE, - number=1, - message='ObjectId', - ) - critical: bool = proto.Field( - proto.BOOL, - number=2, - ) - value: bytes = proto.Field( - proto.BYTES, - number=3, - ) - - -class KeyUsage(proto.Message): - r"""A [KeyUsage][google.cloud.security.privateca.v1.KeyUsage] describes - key usage values that may appear in an X.509 certificate. - - Attributes: - base_key_usage (google.cloud.security.privateca_v1.types.KeyUsage.KeyUsageOptions): - Describes high-level ways in which a key may - be used. - extended_key_usage (google.cloud.security.privateca_v1.types.KeyUsage.ExtendedKeyUsageOptions): - Detailed scenarios in which a key may be - used. - unknown_extended_key_usages (MutableSequence[google.cloud.security.privateca_v1.types.ObjectId]): - Used to describe extended key usages that are not listed in - the - [KeyUsage.ExtendedKeyUsageOptions][google.cloud.security.privateca.v1.KeyUsage.ExtendedKeyUsageOptions] - message. - """ - - class KeyUsageOptions(proto.Message): - r"""[KeyUsage.KeyUsageOptions][google.cloud.security.privateca.v1.KeyUsage.KeyUsageOptions] - corresponds to the key usage values described in - https://tools.ietf.org/html/rfc5280#section-4.2.1.3. - - Attributes: - digital_signature (bool): - The key may be used for digital signatures. - content_commitment (bool): - The key may be used for cryptographic - commitments. Note that this may also be referred - to as "non-repudiation". - key_encipherment (bool): - The key may be used to encipher other keys. - data_encipherment (bool): - The key may be used to encipher data. - key_agreement (bool): - The key may be used in a key agreement - protocol. - cert_sign (bool): - The key may be used to sign certificates. - crl_sign (bool): - The key may be used sign certificate - revocation lists. - encipher_only (bool): - The key may be used to encipher only. - decipher_only (bool): - The key may be used to decipher only. - """ - - digital_signature: bool = proto.Field( - proto.BOOL, - number=1, - ) - content_commitment: bool = proto.Field( - proto.BOOL, - number=2, - ) - key_encipherment: bool = proto.Field( - proto.BOOL, - number=3, - ) - data_encipherment: bool = proto.Field( - proto.BOOL, - number=4, - ) - key_agreement: bool = proto.Field( - proto.BOOL, - number=5, - ) - cert_sign: bool = proto.Field( - proto.BOOL, - number=6, - ) - crl_sign: bool = proto.Field( - proto.BOOL, - number=7, - ) - encipher_only: bool = proto.Field( - proto.BOOL, - number=8, - ) - decipher_only: bool = proto.Field( - proto.BOOL, - number=9, - ) - - class ExtendedKeyUsageOptions(proto.Message): - r"""[KeyUsage.ExtendedKeyUsageOptions][google.cloud.security.privateca.v1.KeyUsage.ExtendedKeyUsageOptions] - has fields that correspond to certain common OIDs that could be - specified as an extended key usage value. - - Attributes: - server_auth (bool): - Corresponds to OID 1.3.6.1.5.5.7.3.1. - Officially described as "TLS WWW server - authentication", though regularly used for - non-WWW TLS. - client_auth (bool): - Corresponds to OID 1.3.6.1.5.5.7.3.2. - Officially described as "TLS WWW client - authentication", though regularly used for - non-WWW TLS. - code_signing (bool): - Corresponds to OID 1.3.6.1.5.5.7.3.3. - Officially described as "Signing of downloadable - executable code client authentication". - email_protection (bool): - Corresponds to OID 1.3.6.1.5.5.7.3.4. - Officially described as "Email protection". - time_stamping (bool): - Corresponds to OID 1.3.6.1.5.5.7.3.8. - Officially described as "Binding the hash of an - object to a time". - ocsp_signing (bool): - Corresponds to OID 1.3.6.1.5.5.7.3.9. - Officially described as "Signing OCSP - responses". - """ - - server_auth: bool = proto.Field( - proto.BOOL, - number=1, - ) - client_auth: bool = proto.Field( - proto.BOOL, - number=2, - ) - code_signing: bool = proto.Field( - proto.BOOL, - number=3, - ) - email_protection: bool = proto.Field( - proto.BOOL, - number=4, - ) - time_stamping: bool = proto.Field( - proto.BOOL, - number=5, - ) - ocsp_signing: bool = proto.Field( - proto.BOOL, - number=6, - ) - - base_key_usage: KeyUsageOptions = proto.Field( - proto.MESSAGE, - number=1, - message=KeyUsageOptions, - ) - extended_key_usage: ExtendedKeyUsageOptions = proto.Field( - proto.MESSAGE, - number=2, - message=ExtendedKeyUsageOptions, - ) - unknown_extended_key_usages: MutableSequence['ObjectId'] = proto.RepeatedField( - proto.MESSAGE, - number=3, - message='ObjectId', - ) - - -class Subject(proto.Message): - r"""[Subject][google.cloud.security.privateca.v1.Subject] describes - parts of a distinguished name that, in turn, describes the subject - of the certificate. - - Attributes: - common_name (str): - The "common name" of the subject. - country_code (str): - The country code of the subject. - organization (str): - The organization of the subject. - organizational_unit (str): - The organizational_unit of the subject. - locality (str): - The locality or city of the subject. - province (str): - The province, territory, or regional state of - the subject. - street_address (str): - The street address of the subject. - postal_code (str): - The postal code of the subject. - """ - - common_name: str = proto.Field( - proto.STRING, - number=1, - ) - country_code: str = proto.Field( - proto.STRING, - number=2, - ) - organization: str = proto.Field( - proto.STRING, - number=3, - ) - organizational_unit: str = proto.Field( - proto.STRING, - number=4, - ) - locality: str = proto.Field( - proto.STRING, - number=5, - ) - province: str = proto.Field( - proto.STRING, - number=6, - ) - street_address: str = proto.Field( - proto.STRING, - number=7, - ) - postal_code: str = proto.Field( - proto.STRING, - number=8, - ) - - -class SubjectAltNames(proto.Message): - r"""[SubjectAltNames][google.cloud.security.privateca.v1.SubjectAltNames] - corresponds to a more modern way of listing what the asserted - identity is in a certificate (i.e., compared to the "common name" in - the distinguished name). - - Attributes: - dns_names (MutableSequence[str]): - Contains only valid, fully-qualified host - names. - uris (MutableSequence[str]): - Contains only valid RFC 3986 URIs. - email_addresses (MutableSequence[str]): - Contains only valid RFC 2822 E-mail - addresses. - ip_addresses (MutableSequence[str]): - Contains only valid 32-bit IPv4 addresses or - RFC 4291 IPv6 addresses. - custom_sans (MutableSequence[google.cloud.security.privateca_v1.types.X509Extension]): - Contains additional subject alternative name values. For - each custom_san, the ``value`` field must contain an ASN.1 - encoded UTF8String. - """ - - dns_names: MutableSequence[str] = proto.RepeatedField( - proto.STRING, - number=1, - ) - uris: MutableSequence[str] = proto.RepeatedField( - proto.STRING, - number=2, - ) - email_addresses: MutableSequence[str] = proto.RepeatedField( - proto.STRING, - number=3, - ) - ip_addresses: MutableSequence[str] = proto.RepeatedField( - proto.STRING, - number=4, - ) - custom_sans: MutableSequence['X509Extension'] = proto.RepeatedField( - proto.MESSAGE, - number=5, - message='X509Extension', - ) - - -class CertificateIdentityConstraints(proto.Message): - r"""Describes constraints on a - [Certificate][google.cloud.security.privateca.v1.Certificate]'s - [Subject][google.cloud.security.privateca.v1.Subject] and - [SubjectAltNames][google.cloud.security.privateca.v1.SubjectAltNames]. - - - .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields - - Attributes: - cel_expression (google.type.expr_pb2.Expr): - Optional. A CEL expression that may be used - to validate the resolved X.509 Subject and/or - Subject Alternative Name before a certificate is - signed. To see the full allowed syntax and some - examples, see - https://cloud.google.com/certificate-authority-service/docs/using-cel - allow_subject_passthrough (bool): - 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. - - This field is a member of `oneof`_ ``_allow_subject_passthrough``. - allow_subject_alt_names_passthrough (bool): - 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. - - This field is a member of `oneof`_ ``_allow_subject_alt_names_passthrough``. - """ - - cel_expression: expr_pb2.Expr = proto.Field( - proto.MESSAGE, - number=1, - message=expr_pb2.Expr, - ) - allow_subject_passthrough: bool = proto.Field( - proto.BOOL, - number=2, - optional=True, - ) - allow_subject_alt_names_passthrough: bool = proto.Field( - proto.BOOL, - number=3, - optional=True, - ) - - -class CertificateExtensionConstraints(proto.Message): - r"""Describes a set of X.509 extensions that may be part of some - certificate issuance controls. - - Attributes: - known_extensions (MutableSequence[google.cloud.security.privateca_v1.types.CertificateExtensionConstraints.KnownCertificateExtension]): - Optional. A set of named X.509 extensions. Will be combined - with - [additional_extensions][google.cloud.security.privateca.v1.CertificateExtensionConstraints.additional_extensions] - to determine the full set of X.509 extensions. - additional_extensions (MutableSequence[google.cloud.security.privateca_v1.types.ObjectId]): - Optional. A set of - [ObjectIds][google.cloud.security.privateca.v1.ObjectId] - identifying custom X.509 extensions. Will be combined with - [known_extensions][google.cloud.security.privateca.v1.CertificateExtensionConstraints.known_extensions] - to determine the full set of X.509 extensions. - """ - class KnownCertificateExtension(proto.Enum): - r"""Describes well-known X.509 extensions that can appear in a - [Certificate][google.cloud.security.privateca.v1.Certificate], not - including the - [SubjectAltNames][google.cloud.security.privateca.v1.SubjectAltNames] - extension. - - Values: - KNOWN_CERTIFICATE_EXTENSION_UNSPECIFIED (0): - Not specified. - BASE_KEY_USAGE (1): - Refers to a certificate's Key Usage extension, as described - in `RFC 5280 section - 4.2.1.3 `__. - This corresponds to the - [KeyUsage.base_key_usage][google.cloud.security.privateca.v1.KeyUsage.base_key_usage] - field. - EXTENDED_KEY_USAGE (2): - Refers to a certificate's Extended Key Usage extension, as - described in `RFC 5280 section - 4.2.1.12 `__. - This corresponds to the - [KeyUsage.extended_key_usage][google.cloud.security.privateca.v1.KeyUsage.extended_key_usage] - message. - CA_OPTIONS (3): - Refers to a certificate's Basic Constraints extension, as - described in `RFC 5280 section - 4.2.1.9 `__. - This corresponds to the - [X509Parameters.ca_options][google.cloud.security.privateca.v1.X509Parameters.ca_options] - field. - POLICY_IDS (4): - Refers to a certificate's Policy object identifiers, as - described in `RFC 5280 section - 4.2.1.4 `__. - This corresponds to the - [X509Parameters.policy_ids][google.cloud.security.privateca.v1.X509Parameters.policy_ids] - field. - AIA_OCSP_SERVERS (5): - Refers to OCSP servers in a certificate's Authority - Information Access extension, as described in `RFC 5280 - section - 4.2.2.1 `__, - This corresponds to the - [X509Parameters.aia_ocsp_servers][google.cloud.security.privateca.v1.X509Parameters.aia_ocsp_servers] - field. - """ - KNOWN_CERTIFICATE_EXTENSION_UNSPECIFIED = 0 - BASE_KEY_USAGE = 1 - EXTENDED_KEY_USAGE = 2 - CA_OPTIONS = 3 - POLICY_IDS = 4 - AIA_OCSP_SERVERS = 5 - - known_extensions: MutableSequence[KnownCertificateExtension] = proto.RepeatedField( - proto.ENUM, - number=1, - enum=KnownCertificateExtension, - ) - additional_extensions: MutableSequence['ObjectId'] = proto.RepeatedField( - proto.MESSAGE, - number=2, - message='ObjectId', - ) - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/owl-bot-staging/v1/google/cloud/security/privateca_v1/types/service.py b/owl-bot-staging/v1/google/cloud/security/privateca_v1/types/service.py deleted file mode 100644 index cc04e4a..0000000 --- a/owl-bot-staging/v1/google/cloud/security/privateca_v1/types/service.py +++ /dev/null @@ -1,1671 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -from typing import MutableMapping, MutableSequence - -import proto # type: ignore - -from google.cloud.security.privateca_v1.types import resources -from google.protobuf import field_mask_pb2 # type: ignore -from google.protobuf import timestamp_pb2 # type: ignore - - -__protobuf__ = proto.module( - package='google.cloud.security.privateca.v1', - manifest={ - 'CreateCertificateRequest', - 'GetCertificateRequest', - 'ListCertificatesRequest', - 'ListCertificatesResponse', - 'RevokeCertificateRequest', - 'UpdateCertificateRequest', - 'ActivateCertificateAuthorityRequest', - 'CreateCertificateAuthorityRequest', - 'DisableCertificateAuthorityRequest', - 'EnableCertificateAuthorityRequest', - 'FetchCertificateAuthorityCsrRequest', - 'FetchCertificateAuthorityCsrResponse', - 'GetCertificateAuthorityRequest', - 'ListCertificateAuthoritiesRequest', - 'ListCertificateAuthoritiesResponse', - 'UndeleteCertificateAuthorityRequest', - 'DeleteCertificateAuthorityRequest', - 'UpdateCertificateAuthorityRequest', - 'CreateCaPoolRequest', - 'UpdateCaPoolRequest', - 'DeleteCaPoolRequest', - 'FetchCaCertsRequest', - 'FetchCaCertsResponse', - 'GetCaPoolRequest', - 'ListCaPoolsRequest', - 'ListCaPoolsResponse', - 'GetCertificateRevocationListRequest', - 'ListCertificateRevocationListsRequest', - 'ListCertificateRevocationListsResponse', - 'UpdateCertificateRevocationListRequest', - 'CreateCertificateTemplateRequest', - 'DeleteCertificateTemplateRequest', - 'GetCertificateTemplateRequest', - 'ListCertificateTemplatesRequest', - 'ListCertificateTemplatesResponse', - 'UpdateCertificateTemplateRequest', - 'OperationMetadata', - }, -) - - -class CreateCertificateRequest(proto.Message): - r"""Request message for - [CertificateAuthorityService.CreateCertificate][google.cloud.security.privateca.v1.CertificateAuthorityService.CreateCertificate]. - - Attributes: - parent (str): - Required. The resource name of the - [CaPool][google.cloud.security.privateca.v1.CaPool] - associated with the - [Certificate][google.cloud.security.privateca.v1.Certificate], - in the format ``projects/*/locations/*/caPools/*``. - certificate_id (str): - Optional. It must be unique within a location and match the - regular expression ``[a-zA-Z0-9_-]{1,63}``. This field is - required when using a - [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority] - in the Enterprise [CertificateAuthority.Tier][], but is - optional and its value is ignored otherwise. - certificate (google.cloud.security.privateca_v1.types.Certificate): - Required. A - [Certificate][google.cloud.security.privateca.v1.Certificate] - with initial field values. - request_id (str): - Optional. An ID to identify requests. Specify - a unique request ID so that if you must retry - your request, the server will know to ignore the - request if it has already been completed. The - server will guarantee that for at least 60 - minutes since the first request. - - For example, consider a situation where you make - an initial request and the request times out. If - you make the request again with the same request - ID, the server can check if original operation - with the same request ID was received, and if - so, will ignore the second request. This - prevents clients from accidentally creating - duplicate commitments. - The request ID must be a valid UUID with the - exception that zero UUID is not supported - (00000000-0000-0000-0000-000000000000). - validate_only (bool): - Optional. If this is true, no - [Certificate][google.cloud.security.privateca.v1.Certificate] - resource will be persisted regardless of the - [CaPool][google.cloud.security.privateca.v1.CaPool]'s - [tier][google.cloud.security.privateca.v1.CaPool.tier], and - the returned - [Certificate][google.cloud.security.privateca.v1.Certificate] - will not contain the - [pem_certificate][google.cloud.security.privateca.v1.Certificate.pem_certificate] - field. - issuing_certificate_authority_id (str): - Optional. The resource ID of the - [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority] - that should issue the certificate. This optional field will - ignore the load-balancing scheme of the Pool and directly - issue the certificate from the CA with the specified ID, - contained in the same - [CaPool][google.cloud.security.privateca.v1.CaPool] - referenced by ``parent``. Per-CA quota rules apply. If left - empty, a - [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority] - will be chosen from the - [CaPool][google.cloud.security.privateca.v1.CaPool] by the - service. For example, to issue a - [Certificate][google.cloud.security.privateca.v1.Certificate] - from a Certificate Authority with resource name - "projects/my-project/locations/us-central1/caPools/my-pool/certificateAuthorities/my-ca", - you can set the - [parent][google.cloud.security.privateca.v1.CreateCertificateRequest.parent] - to - "projects/my-project/locations/us-central1/caPools/my-pool" - and the - [issuing_certificate_authority_id][google.cloud.security.privateca.v1.CreateCertificateRequest.issuing_certificate_authority_id] - to "my-ca". - """ - - parent: str = proto.Field( - proto.STRING, - number=1, - ) - certificate_id: str = proto.Field( - proto.STRING, - number=2, - ) - certificate: resources.Certificate = proto.Field( - proto.MESSAGE, - number=3, - message=resources.Certificate, - ) - request_id: str = proto.Field( - proto.STRING, - number=4, - ) - validate_only: bool = proto.Field( - proto.BOOL, - number=5, - ) - issuing_certificate_authority_id: str = proto.Field( - proto.STRING, - number=6, - ) - - -class GetCertificateRequest(proto.Message): - r"""Request message for - [CertificateAuthorityService.GetCertificate][google.cloud.security.privateca.v1.CertificateAuthorityService.GetCertificate]. - - Attributes: - name (str): - Required. The - [name][google.cloud.security.privateca.v1.Certificate.name] - of the - [Certificate][google.cloud.security.privateca.v1.Certificate] - to get. - """ - - name: str = proto.Field( - proto.STRING, - number=1, - ) - - -class ListCertificatesRequest(proto.Message): - r"""Request message for - [CertificateAuthorityService.ListCertificates][google.cloud.security.privateca.v1.CertificateAuthorityService.ListCertificates]. - - Attributes: - parent (str): - Required. The resource name of the location associated with - the - [Certificates][google.cloud.security.privateca.v1.Certificate], - in the format ``projects/*/locations/*/caPools/*``. - page_size (int): - Optional. Limit on the number of - [Certificates][google.cloud.security.privateca.v1.Certificate] - to include in the response. Further - [Certificates][google.cloud.security.privateca.v1.Certificate] - can subsequently be obtained by including the - [ListCertificatesResponse.next_page_token][google.cloud.security.privateca.v1.ListCertificatesResponse.next_page_token] - in a subsequent request. If unspecified, the server will - pick an appropriate default. - page_token (str): - Optional. Pagination token, returned earlier via - [ListCertificatesResponse.next_page_token][google.cloud.security.privateca.v1.ListCertificatesResponse.next_page_token]. - filter (str): - Optional. Only include resources that match the filter in - the response. For details on supported filters and syntax, - see `Certificates Filtering - documentation `__. - order_by (str): - Optional. Specify how the results should be sorted. For - details on supported fields and syntax, see `Certificates - Sorting - documentation `__. - """ - - parent: str = proto.Field( - proto.STRING, - number=1, - ) - page_size: int = proto.Field( - proto.INT32, - number=2, - ) - page_token: str = proto.Field( - proto.STRING, - number=3, - ) - filter: str = proto.Field( - proto.STRING, - number=4, - ) - order_by: str = proto.Field( - proto.STRING, - number=5, - ) - - -class ListCertificatesResponse(proto.Message): - r"""Response message for - [CertificateAuthorityService.ListCertificates][google.cloud.security.privateca.v1.CertificateAuthorityService.ListCertificates]. - - Attributes: - certificates (MutableSequence[google.cloud.security.privateca_v1.types.Certificate]): - The list of - [Certificates][google.cloud.security.privateca.v1.Certificate]. - next_page_token (str): - A token to retrieve next page of results. Pass this value in - [ListCertificatesRequest.next_page_token][] to retrieve the - next page of results. - unreachable (MutableSequence[str]): - A list of locations (e.g. "us-west1") that - could not be reached. - """ - - @property - def raw_page(self): - return self - - certificates: MutableSequence[resources.Certificate] = proto.RepeatedField( - proto.MESSAGE, - number=1, - message=resources.Certificate, - ) - next_page_token: str = proto.Field( - proto.STRING, - number=2, - ) - unreachable: MutableSequence[str] = proto.RepeatedField( - proto.STRING, - number=3, - ) - - -class RevokeCertificateRequest(proto.Message): - r"""Request message for - [CertificateAuthorityService.RevokeCertificate][google.cloud.security.privateca.v1.CertificateAuthorityService.RevokeCertificate]. - - Attributes: - name (str): - Required. The resource name for this - [Certificate][google.cloud.security.privateca.v1.Certificate] - in the format - ``projects/*/locations/*/caPools/*/certificates/*``. - reason (google.cloud.security.privateca_v1.types.RevocationReason): - Required. The - [RevocationReason][google.cloud.security.privateca.v1.RevocationReason] - for revoking this certificate. - request_id (str): - Optional. An ID to identify requests. Specify - a unique request ID so that if you must retry - your request, the server will know to ignore the - request if it has already been completed. The - server will guarantee that for at least 60 - minutes since the first request. - - For example, consider a situation where you make - an initial request and t he request times out. - If you make the request again with the same - request ID, the server can check if original - operation with the same request ID was received, - and if so, will ignore the second request. This - prevents clients from accidentally creating - duplicate commitments. - The request ID must be a valid UUID with the - exception that zero UUID is not supported - (00000000-0000-0000-0000-000000000000). - """ - - name: str = proto.Field( - proto.STRING, - number=1, - ) - reason: resources.RevocationReason = proto.Field( - proto.ENUM, - number=2, - enum=resources.RevocationReason, - ) - request_id: str = proto.Field( - proto.STRING, - number=3, - ) - - -class UpdateCertificateRequest(proto.Message): - r"""Request message for - [CertificateAuthorityService.UpdateCertificate][google.cloud.security.privateca.v1.CertificateAuthorityService.UpdateCertificate]. - - Attributes: - certificate (google.cloud.security.privateca_v1.types.Certificate): - Required. - [Certificate][google.cloud.security.privateca.v1.Certificate] - with updated values. - update_mask (google.protobuf.field_mask_pb2.FieldMask): - Required. A list of fields to be updated in - this request. - request_id (str): - Optional. An ID to identify requests. Specify - a unique request ID so that if you must retry - your request, the server will know to ignore the - request if it has already been completed. The - server will guarantee that for at least 60 - minutes since the first request. - - For example, consider a situation where you make - an initial request and t he request times out. - If you make the request again with the same - request ID, the server can check if original - operation with the same request ID was received, - and if so, will ignore the second request. This - prevents clients from accidentally creating - duplicate commitments. - The request ID must be a valid UUID with the - exception that zero UUID is not supported - (00000000-0000-0000-0000-000000000000). - """ - - certificate: resources.Certificate = proto.Field( - proto.MESSAGE, - number=1, - message=resources.Certificate, - ) - update_mask: field_mask_pb2.FieldMask = proto.Field( - proto.MESSAGE, - number=2, - message=field_mask_pb2.FieldMask, - ) - request_id: str = proto.Field( - proto.STRING, - number=3, - ) - - -class ActivateCertificateAuthorityRequest(proto.Message): - r"""Request message for - [CertificateAuthorityService.ActivateCertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthorityService.ActivateCertificateAuthority]. - - Attributes: - name (str): - Required. The resource name for this - [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority] - in the format - ``projects/*/locations/*/caPools/*/certificateAuthorities/*``. - pem_ca_certificate (str): - Required. The signed CA certificate issued from - [FetchCertificateAuthorityCsrResponse.pem_csr][google.cloud.security.privateca.v1.FetchCertificateAuthorityCsrResponse.pem_csr]. - subordinate_config (google.cloud.security.privateca_v1.types.SubordinateConfig): - Required. Must include information about the issuer of - 'pem_ca_certificate', and any further issuers until the - self-signed CA. - request_id (str): - Optional. An ID to identify requests. Specify - a unique request ID so that if you must retry - your request, the server will know to ignore the - request if it has already been completed. The - server will guarantee that for at least 60 - minutes since the first request. - - For example, consider a situation where you make - an initial request and t he request times out. - If you make the request again with the same - request ID, the server can check if original - operation with the same request ID was received, - and if so, will ignore the second request. This - prevents clients from accidentally creating - duplicate commitments. - The request ID must be a valid UUID with the - exception that zero UUID is not supported - (00000000-0000-0000-0000-000000000000). - """ - - name: str = proto.Field( - proto.STRING, - number=1, - ) - pem_ca_certificate: str = proto.Field( - proto.STRING, - number=2, - ) - subordinate_config: resources.SubordinateConfig = proto.Field( - proto.MESSAGE, - number=3, - message=resources.SubordinateConfig, - ) - request_id: str = proto.Field( - proto.STRING, - number=4, - ) - - -class CreateCertificateAuthorityRequest(proto.Message): - r"""Request message for - [CertificateAuthorityService.CreateCertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthorityService.CreateCertificateAuthority]. - - Attributes: - parent (str): - Required. The resource name of the - [CaPool][google.cloud.security.privateca.v1.CaPool] - associated with the - [CertificateAuthorities][google.cloud.security.privateca.v1.CertificateAuthority], - in the format ``projects/*/locations/*/caPools/*``. - certificate_authority_id (str): - Required. It must be unique within a location and match the - regular expression ``[a-zA-Z0-9_-]{1,63}`` - certificate_authority (google.cloud.security.privateca_v1.types.CertificateAuthority): - Required. A - [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority] - with initial field values. - request_id (str): - Optional. An ID to identify requests. Specify - a unique request ID so that if you must retry - your request, the server will know to ignore the - request if it has already been completed. The - server will guarantee that for at least 60 - minutes since the first request. - - For example, consider a situation where you make - an initial request and t he request times out. - If you make the request again with the same - request ID, the server can check if original - operation with the same request ID was received, - and if so, will ignore the second request. This - prevents clients from accidentally creating - duplicate commitments. - The request ID must be a valid UUID with the - exception that zero UUID is not supported - (00000000-0000-0000-0000-000000000000). - """ - - parent: str = proto.Field( - proto.STRING, - number=1, - ) - certificate_authority_id: str = proto.Field( - proto.STRING, - number=2, - ) - certificate_authority: resources.CertificateAuthority = proto.Field( - proto.MESSAGE, - number=3, - message=resources.CertificateAuthority, - ) - request_id: str = proto.Field( - proto.STRING, - number=4, - ) - - -class DisableCertificateAuthorityRequest(proto.Message): - r"""Request message for - [CertificateAuthorityService.DisableCertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthorityService.DisableCertificateAuthority]. - - Attributes: - name (str): - Required. The resource name for this - [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority] - in the format - ``projects/*/locations/*/caPools/*/certificateAuthorities/*``. - request_id (str): - Optional. An ID to identify requests. Specify - a unique request ID so that if you must retry - your request, the server will know to ignore the - request if it has already been completed. The - server will guarantee that for at least 60 - minutes since the first request. - - For example, consider a situation where you make - an initial request and t he request times out. - If you make the request again with the same - request ID, the server can check if original - operation with the same request ID was received, - and if so, will ignore the second request. This - prevents clients from accidentally creating - duplicate commitments. - The request ID must be a valid UUID with the - exception that zero UUID is not supported - (00000000-0000-0000-0000-000000000000). - """ - - name: str = proto.Field( - proto.STRING, - number=1, - ) - request_id: str = proto.Field( - proto.STRING, - number=2, - ) - - -class EnableCertificateAuthorityRequest(proto.Message): - r"""Request message for - [CertificateAuthorityService.EnableCertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthorityService.EnableCertificateAuthority]. - - Attributes: - name (str): - Required. The resource name for this - [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority] - in the format - ``projects/*/locations/*/caPools/*/certificateAuthorities/*``. - request_id (str): - Optional. An ID to identify requests. Specify - a unique request ID so that if you must retry - your request, the server will know to ignore the - request if it has already been completed. The - server will guarantee that for at least 60 - minutes since the first request. - - For example, consider a situation where you make - an initial request and t he request times out. - If you make the request again with the same - request ID, the server can check if original - operation with the same request ID was received, - and if so, will ignore the second request. This - prevents clients from accidentally creating - duplicate commitments. - The request ID must be a valid UUID with the - exception that zero UUID is not supported - (00000000-0000-0000-0000-000000000000). - """ - - name: str = proto.Field( - proto.STRING, - number=1, - ) - request_id: str = proto.Field( - proto.STRING, - number=2, - ) - - -class FetchCertificateAuthorityCsrRequest(proto.Message): - r"""Request message for - [CertificateAuthorityService.FetchCertificateAuthorityCsr][google.cloud.security.privateca.v1.CertificateAuthorityService.FetchCertificateAuthorityCsr]. - - Attributes: - name (str): - Required. The resource name for this - [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority] - in the format - ``projects/*/locations/*/caPools/*/certificateAuthorities/*``. - """ - - name: str = proto.Field( - proto.STRING, - number=1, - ) - - -class FetchCertificateAuthorityCsrResponse(proto.Message): - r"""Response message for - [CertificateAuthorityService.FetchCertificateAuthorityCsr][google.cloud.security.privateca.v1.CertificateAuthorityService.FetchCertificateAuthorityCsr]. - - Attributes: - pem_csr (str): - Output only. The PEM-encoded signed - certificate signing request (CSR). - """ - - pem_csr: str = proto.Field( - proto.STRING, - number=1, - ) - - -class GetCertificateAuthorityRequest(proto.Message): - r"""Request message for - [CertificateAuthorityService.GetCertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthorityService.GetCertificateAuthority]. - - Attributes: - name (str): - Required. The - [name][google.cloud.security.privateca.v1.CertificateAuthority.name] - of the - [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority] - to get. - """ - - name: str = proto.Field( - proto.STRING, - number=1, - ) - - -class ListCertificateAuthoritiesRequest(proto.Message): - r"""Request message for - [CertificateAuthorityService.ListCertificateAuthorities][google.cloud.security.privateca.v1.CertificateAuthorityService.ListCertificateAuthorities]. - - Attributes: - parent (str): - Required. The resource name of the - [CaPool][google.cloud.security.privateca.v1.CaPool] - associated with the - [CertificateAuthorities][google.cloud.security.privateca.v1.CertificateAuthority], - in the format ``projects/*/locations/*/caPools/*``. - page_size (int): - Optional. Limit on the number of - [CertificateAuthorities][google.cloud.security.privateca.v1.CertificateAuthority] - to include in the response. Further - [CertificateAuthorities][google.cloud.security.privateca.v1.CertificateAuthority] - can subsequently be obtained by including the - [ListCertificateAuthoritiesResponse.next_page_token][google.cloud.security.privateca.v1.ListCertificateAuthoritiesResponse.next_page_token] - in a subsequent request. If unspecified, the server will - pick an appropriate default. - page_token (str): - Optional. Pagination token, returned earlier via - [ListCertificateAuthoritiesResponse.next_page_token][google.cloud.security.privateca.v1.ListCertificateAuthoritiesResponse.next_page_token]. - filter (str): - Optional. Only include resources that match - the filter in the response. - order_by (str): - Optional. Specify how the results should be - sorted. - """ - - parent: str = proto.Field( - proto.STRING, - number=1, - ) - page_size: int = proto.Field( - proto.INT32, - number=2, - ) - page_token: str = proto.Field( - proto.STRING, - number=3, - ) - filter: str = proto.Field( - proto.STRING, - number=4, - ) - order_by: str = proto.Field( - proto.STRING, - number=5, - ) - - -class ListCertificateAuthoritiesResponse(proto.Message): - r"""Response message for - [CertificateAuthorityService.ListCertificateAuthorities][google.cloud.security.privateca.v1.CertificateAuthorityService.ListCertificateAuthorities]. - - Attributes: - certificate_authorities (MutableSequence[google.cloud.security.privateca_v1.types.CertificateAuthority]): - The list of - [CertificateAuthorities][google.cloud.security.privateca.v1.CertificateAuthority]. - next_page_token (str): - A token to retrieve next page of results. Pass this value in - [ListCertificateAuthoritiesRequest.next_page_token][] to - retrieve the next page of results. - unreachable (MutableSequence[str]): - A list of locations (e.g. "us-west1") that - could not be reached. - """ - - @property - def raw_page(self): - return self - - certificate_authorities: MutableSequence[resources.CertificateAuthority] = proto.RepeatedField( - proto.MESSAGE, - number=1, - message=resources.CertificateAuthority, - ) - next_page_token: str = proto.Field( - proto.STRING, - number=2, - ) - unreachable: MutableSequence[str] = proto.RepeatedField( - proto.STRING, - number=3, - ) - - -class UndeleteCertificateAuthorityRequest(proto.Message): - r"""Request message for - [CertificateAuthorityService.UndeleteCertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthorityService.UndeleteCertificateAuthority]. - - Attributes: - name (str): - Required. The resource name for this - [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority] - in the format - ``projects/*/locations/*/caPools/*/certificateAuthorities/*``. - request_id (str): - Optional. An ID to identify requests. Specify - a unique request ID so that if you must retry - your request, the server will know to ignore the - request if it has already been completed. The - server will guarantee that for at least 60 - minutes since the first request. - - For example, consider a situation where you make - an initial request and t he request times out. - If you make the request again with the same - request ID, the server can check if original - operation with the same request ID was received, - and if so, will ignore the second request. This - prevents clients from accidentally creating - duplicate commitments. - The request ID must be a valid UUID with the - exception that zero UUID is not supported - (00000000-0000-0000-0000-000000000000). - """ - - name: str = proto.Field( - proto.STRING, - number=1, - ) - request_id: str = proto.Field( - proto.STRING, - number=2, - ) - - -class DeleteCertificateAuthorityRequest(proto.Message): - r"""Request message for - [CertificateAuthorityService.DeleteCertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthorityService.DeleteCertificateAuthority]. - - Attributes: - name (str): - Required. The resource name for this - [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority] - in the format - ``projects/*/locations/*/caPools/*/certificateAuthorities/*``. - request_id (str): - Optional. An ID to identify requests. Specify - a unique request ID so that if you must retry - your request, the server will know to ignore the - request if it has already been completed. The - server will guarantee that for at least 60 - minutes since the first request. - - For example, consider a situation where you make - an initial request and t he request times out. - If you make the request again with the same - request ID, the server can check if original - operation with the same request ID was received, - and if so, will ignore the second request. This - prevents clients from accidentally creating - duplicate commitments. - The request ID must be a valid UUID with the - exception that zero UUID is not supported - (00000000-0000-0000-0000-000000000000). - ignore_active_certificates (bool): - Optional. This field allows the CA to be - deleted even if the CA has active certs. Active - certs include both unrevoked and unexpired - certs. - skip_grace_period (bool): - Optional. If this flag is set, the - Certificate Authority will be deleted as soon as - possible without a 30-day grace period where - undeletion would have been allowed. If you - proceed, there will be no way to recover this - CA. - """ - - name: str = proto.Field( - proto.STRING, - number=1, - ) - request_id: str = proto.Field( - proto.STRING, - number=2, - ) - ignore_active_certificates: bool = proto.Field( - proto.BOOL, - number=4, - ) - skip_grace_period: bool = proto.Field( - proto.BOOL, - number=5, - ) - - -class UpdateCertificateAuthorityRequest(proto.Message): - r"""Request message for - [CertificateAuthorityService.UpdateCertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthorityService.UpdateCertificateAuthority]. - - Attributes: - certificate_authority (google.cloud.security.privateca_v1.types.CertificateAuthority): - Required. - [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority] - with updated values. - update_mask (google.protobuf.field_mask_pb2.FieldMask): - Required. A list of fields to be updated in - this request. - request_id (str): - Optional. An ID to identify requests. Specify - a unique request ID so that if you must retry - your request, the server will know to ignore the - request if it has already been completed. The - server will guarantee that for at least 60 - minutes since the first request. - - For example, consider a situation where you make - an initial request and t he request times out. - If you make the request again with the same - request ID, the server can check if original - operation with the same request ID was received, - and if so, will ignore the second request. This - prevents clients from accidentally creating - duplicate commitments. - The request ID must be a valid UUID with the - exception that zero UUID is not supported - (00000000-0000-0000-0000-000000000000). - """ - - certificate_authority: resources.CertificateAuthority = proto.Field( - proto.MESSAGE, - number=1, - message=resources.CertificateAuthority, - ) - update_mask: field_mask_pb2.FieldMask = proto.Field( - proto.MESSAGE, - number=2, - message=field_mask_pb2.FieldMask, - ) - request_id: str = proto.Field( - proto.STRING, - number=3, - ) - - -class CreateCaPoolRequest(proto.Message): - r"""Request message for - [CertificateAuthorityService.CreateCaPool][google.cloud.security.privateca.v1.CertificateAuthorityService.CreateCaPool]. - - Attributes: - parent (str): - Required. The resource name of the location associated with - the [CaPool][google.cloud.security.privateca.v1.CaPool], in - the format ``projects/*/locations/*``. - ca_pool_id (str): - Required. It must be unique within a location and match the - regular expression ``[a-zA-Z0-9_-]{1,63}`` - ca_pool (google.cloud.security.privateca_v1.types.CaPool): - Required. A - [CaPool][google.cloud.security.privateca.v1.CaPool] with - initial field values. - request_id (str): - Optional. An ID to identify requests. Specify - a unique request ID so that if you must retry - your request, the server will know to ignore the - request if it has already been completed. The - server will guarantee that for at least 60 - minutes since the first request. - - For example, consider a situation where you make - an initial request and t he request times out. - If you make the request again with the same - request ID, the server can check if original - operation with the same request ID was received, - and if so, will ignore the second request. This - prevents clients from accidentally creating - duplicate commitments. - The request ID must be a valid UUID with the - exception that zero UUID is not supported - (00000000-0000-0000-0000-000000000000). - """ - - parent: str = proto.Field( - proto.STRING, - number=1, - ) - ca_pool_id: str = proto.Field( - proto.STRING, - number=2, - ) - ca_pool: resources.CaPool = proto.Field( - proto.MESSAGE, - number=3, - message=resources.CaPool, - ) - request_id: str = proto.Field( - proto.STRING, - number=4, - ) - - -class UpdateCaPoolRequest(proto.Message): - r"""Request message for - [CertificateAuthorityService.UpdateCaPool][google.cloud.security.privateca.v1.CertificateAuthorityService.UpdateCaPool]. - - Attributes: - ca_pool (google.cloud.security.privateca_v1.types.CaPool): - Required. - [CaPool][google.cloud.security.privateca.v1.CaPool] with - updated values. - update_mask (google.protobuf.field_mask_pb2.FieldMask): - Required. A list of fields to be updated in - this request. - request_id (str): - Optional. An ID to identify requests. Specify - a unique request ID so that if you must retry - your request, the server will know to ignore the - request if it has already been completed. The - server will guarantee that for at least 60 - minutes since the first request. - - For example, consider a situation where you make - an initial request and t he request times out. - If you make the request again with the same - request ID, the server can check if original - operation with the same request ID was received, - and if so, will ignore the second request. This - prevents clients from accidentally creating - duplicate commitments. - The request ID must be a valid UUID with the - exception that zero UUID is not supported - (00000000-0000-0000-0000-000000000000). - """ - - ca_pool: resources.CaPool = proto.Field( - proto.MESSAGE, - number=1, - message=resources.CaPool, - ) - update_mask: field_mask_pb2.FieldMask = proto.Field( - proto.MESSAGE, - number=2, - message=field_mask_pb2.FieldMask, - ) - request_id: str = proto.Field( - proto.STRING, - number=3, - ) - - -class DeleteCaPoolRequest(proto.Message): - r"""Request message for - [CertificateAuthorityService.DeleteCaPool][google.cloud.security.privateca.v1.CertificateAuthorityService.DeleteCaPool]. - - Attributes: - name (str): - Required. The resource name for this - [CaPool][google.cloud.security.privateca.v1.CaPool] in the - format ``projects/*/locations/*/caPools/*``. - request_id (str): - Optional. An ID to identify requests. Specify - a unique request ID so that if you must retry - your request, the server will know to ignore the - request if it has already been completed. The - server will guarantee that for at least 60 - minutes since the first request. - - For example, consider a situation where you make - an initial request and t he request times out. - If you make the request again with the same - request ID, the server can check if original - operation with the same request ID was received, - and if so, will ignore the second request. This - prevents clients from accidentally creating - duplicate commitments. - The request ID must be a valid UUID with the - exception that zero UUID is not supported - (00000000-0000-0000-0000-000000000000). - """ - - name: str = proto.Field( - proto.STRING, - number=1, - ) - request_id: str = proto.Field( - proto.STRING, - number=2, - ) - - -class FetchCaCertsRequest(proto.Message): - r"""Request message for - [CertificateAuthorityService.FetchCaCerts][google.cloud.security.privateca.v1.CertificateAuthorityService.FetchCaCerts]. - - Attributes: - ca_pool (str): - Required. The resource name for the - [CaPool][google.cloud.security.privateca.v1.CaPool] in the - format ``projects/*/locations/*/caPools/*``. - request_id (str): - Optional. An ID to identify requests. Specify - a unique request ID so that if you must retry - your request, the server will know to ignore the - request if it has already been completed. The - server will guarantee that for at least 60 - minutes since the first request. - - For example, consider a situation where you make - an initial request and t he request times out. - If you make the request again with the same - request ID, the server can check if original - operation with the same request ID was received, - and if so, will ignore the second request. This - prevents clients from accidentally creating - duplicate commitments. - The request ID must be a valid UUID with the - exception that zero UUID is not supported - (00000000-0000-0000-0000-000000000000). - """ - - ca_pool: str = proto.Field( - proto.STRING, - number=1, - ) - request_id: str = proto.Field( - proto.STRING, - number=2, - ) - - -class FetchCaCertsResponse(proto.Message): - r"""Response message for - [CertificateAuthorityService.FetchCaCerts][google.cloud.security.privateca.v1.CertificateAuthorityService.FetchCaCerts]. - - Attributes: - ca_certs (MutableSequence[google.cloud.security.privateca_v1.types.FetchCaCertsResponse.CertChain]): - The PEM encoded CA certificate chains of all - [ACTIVE][CertificateAuthority.State.ACTIVE] - [CertificateAuthority][google.cloud.security.privateca.v1.CertificateAuthority] - resources in this - [CaPool][google.cloud.security.privateca.v1.CaPool]. - """ - - class CertChain(proto.Message): - r""" - - Attributes: - certificates (MutableSequence[str]): - The certificates that form the CA chain, from - leaf to root order. - """ - - certificates: MutableSequence[str] = proto.RepeatedField( - proto.STRING, - number=1, - ) - - ca_certs: MutableSequence[CertChain] = proto.RepeatedField( - proto.MESSAGE, - number=1, - message=CertChain, - ) - - -class GetCaPoolRequest(proto.Message): - r"""Request message for - [CertificateAuthorityService.GetCaPool][google.cloud.security.privateca.v1.CertificateAuthorityService.GetCaPool]. - - Attributes: - name (str): - Required. The - [name][google.cloud.security.privateca.v1.CaPool.name] of - the [CaPool][google.cloud.security.privateca.v1.CaPool] to - get. - """ - - name: str = proto.Field( - proto.STRING, - number=1, - ) - - -class ListCaPoolsRequest(proto.Message): - r"""Request message for - [CertificateAuthorityService.ListCaPools][google.cloud.security.privateca.v1.CertificateAuthorityService.ListCaPools]. - - Attributes: - parent (str): - Required. The resource name of the location associated with - the [CaPools][google.cloud.security.privateca.v1.CaPool], in - the format ``projects/*/locations/*``. - page_size (int): - Optional. Limit on the number of - [CaPools][google.cloud.security.privateca.v1.CaPool] to - include in the response. Further - [CaPools][google.cloud.security.privateca.v1.CaPool] can - subsequently be obtained by including the - [ListCaPoolsResponse.next_page_token][google.cloud.security.privateca.v1.ListCaPoolsResponse.next_page_token] - in a subsequent request. If unspecified, the server will - pick an appropriate default. - page_token (str): - Optional. Pagination token, returned earlier via - [ListCaPoolsResponse.next_page_token][google.cloud.security.privateca.v1.ListCaPoolsResponse.next_page_token]. - filter (str): - Optional. Only include resources that match - the filter in the response. - order_by (str): - Optional. Specify how the results should be - sorted. - """ - - parent: str = proto.Field( - proto.STRING, - number=1, - ) - page_size: int = proto.Field( - proto.INT32, - number=2, - ) - page_token: str = proto.Field( - proto.STRING, - number=3, - ) - filter: str = proto.Field( - proto.STRING, - number=4, - ) - order_by: str = proto.Field( - proto.STRING, - number=5, - ) - - -class ListCaPoolsResponse(proto.Message): - r"""Response message for - [CertificateAuthorityService.ListCaPools][google.cloud.security.privateca.v1.CertificateAuthorityService.ListCaPools]. - - Attributes: - ca_pools (MutableSequence[google.cloud.security.privateca_v1.types.CaPool]): - The list of - [CaPools][google.cloud.security.privateca.v1.CaPool]. - next_page_token (str): - A token to retrieve next page of results. Pass this value in - [ListCertificateAuthoritiesRequest.next_page_token][] to - retrieve the next page of results. - unreachable (MutableSequence[str]): - A list of locations (e.g. "us-west1") that - could not be reached. - """ - - @property - def raw_page(self): - return self - - ca_pools: MutableSequence[resources.CaPool] = proto.RepeatedField( - proto.MESSAGE, - number=1, - message=resources.CaPool, - ) - next_page_token: str = proto.Field( - proto.STRING, - number=2, - ) - unreachable: MutableSequence[str] = proto.RepeatedField( - proto.STRING, - number=3, - ) - - -class GetCertificateRevocationListRequest(proto.Message): - r"""Request message for - [CertificateAuthorityService.GetCertificateRevocationList][google.cloud.security.privateca.v1.CertificateAuthorityService.GetCertificateRevocationList]. - - Attributes: - name (str): - Required. The - [name][google.cloud.security.privateca.v1.CertificateRevocationList.name] - of the - [CertificateRevocationList][google.cloud.security.privateca.v1.CertificateRevocationList] - to get. - """ - - name: str = proto.Field( - proto.STRING, - number=1, - ) - - -class ListCertificateRevocationListsRequest(proto.Message): - r"""Request message for - [CertificateAuthorityService.ListCertificateRevocationLists][google.cloud.security.privateca.v1.CertificateAuthorityService.ListCertificateRevocationLists]. - - Attributes: - parent (str): - Required. The resource name of the location associated with - the - [CertificateRevocationLists][google.cloud.security.privateca.v1.CertificateRevocationList], - in the format - ``projects/*/locations/*/caPools/*/certificateAuthorities/*``. - page_size (int): - Optional. Limit on the number of - [CertificateRevocationLists][google.cloud.security.privateca.v1.CertificateRevocationList] - to include in the response. Further - [CertificateRevocationLists][google.cloud.security.privateca.v1.CertificateRevocationList] - can subsequently be obtained by including the - [ListCertificateRevocationListsResponse.next_page_token][google.cloud.security.privateca.v1.ListCertificateRevocationListsResponse.next_page_token] - in a subsequent request. If unspecified, the server will - pick an appropriate default. - page_token (str): - Optional. Pagination token, returned earlier via - [ListCertificateRevocationListsResponse.next_page_token][google.cloud.security.privateca.v1.ListCertificateRevocationListsResponse.next_page_token]. - filter (str): - Optional. Only include resources that match - the filter in the response. - order_by (str): - Optional. Specify how the results should be - sorted. - """ - - parent: str = proto.Field( - proto.STRING, - number=1, - ) - page_size: int = proto.Field( - proto.INT32, - number=2, - ) - page_token: str = proto.Field( - proto.STRING, - number=3, - ) - filter: str = proto.Field( - proto.STRING, - number=4, - ) - order_by: str = proto.Field( - proto.STRING, - number=5, - ) - - -class ListCertificateRevocationListsResponse(proto.Message): - r"""Response message for - [CertificateAuthorityService.ListCertificateRevocationLists][google.cloud.security.privateca.v1.CertificateAuthorityService.ListCertificateRevocationLists]. - - Attributes: - certificate_revocation_lists (MutableSequence[google.cloud.security.privateca_v1.types.CertificateRevocationList]): - The list of - [CertificateRevocationLists][google.cloud.security.privateca.v1.CertificateRevocationList]. - next_page_token (str): - A token to retrieve next page of results. Pass this value in - [ListCertificateRevocationListsRequest.next_page_token][] to - retrieve the next page of results. - unreachable (MutableSequence[str]): - A list of locations (e.g. "us-west1") that - could not be reached. - """ - - @property - def raw_page(self): - return self - - certificate_revocation_lists: MutableSequence[resources.CertificateRevocationList] = proto.RepeatedField( - proto.MESSAGE, - number=1, - message=resources.CertificateRevocationList, - ) - next_page_token: str = proto.Field( - proto.STRING, - number=2, - ) - unreachable: MutableSequence[str] = proto.RepeatedField( - proto.STRING, - number=3, - ) - - -class UpdateCertificateRevocationListRequest(proto.Message): - r"""Request message for - [CertificateAuthorityService.UpdateCertificateRevocationList][google.cloud.security.privateca.v1.CertificateAuthorityService.UpdateCertificateRevocationList]. - - Attributes: - certificate_revocation_list (google.cloud.security.privateca_v1.types.CertificateRevocationList): - Required. - [CertificateRevocationList][google.cloud.security.privateca.v1.CertificateRevocationList] - with updated values. - update_mask (google.protobuf.field_mask_pb2.FieldMask): - Required. A list of fields to be updated in - this request. - request_id (str): - Optional. An ID to identify requests. Specify - a unique request ID so that if you must retry - your request, the server will know to ignore the - request if it has already been completed. The - server will guarantee that for at least 60 - minutes since the first request. - - For example, consider a situation where you make - an initial request and t he request times out. - If you make the request again with the same - request ID, the server can check if original - operation with the same request ID was received, - and if so, will ignore the second request. This - prevents clients from accidentally creating - duplicate commitments. - The request ID must be a valid UUID with the - exception that zero UUID is not supported - (00000000-0000-0000-0000-000000000000). - """ - - certificate_revocation_list: resources.CertificateRevocationList = proto.Field( - proto.MESSAGE, - number=1, - message=resources.CertificateRevocationList, - ) - update_mask: field_mask_pb2.FieldMask = proto.Field( - proto.MESSAGE, - number=2, - message=field_mask_pb2.FieldMask, - ) - request_id: str = proto.Field( - proto.STRING, - number=3, - ) - - -class CreateCertificateTemplateRequest(proto.Message): - r"""Request message for - [CertificateAuthorityService.CreateCertificateTemplate][google.cloud.security.privateca.v1.CertificateAuthorityService.CreateCertificateTemplate]. - - Attributes: - parent (str): - Required. The resource name of the location associated with - the - [CertificateTemplate][google.cloud.security.privateca.v1.CertificateTemplate], - in the format ``projects/*/locations/*``. - certificate_template_id (str): - Required. It must be unique within a location and match the - regular expression ``[a-zA-Z0-9_-]{1,63}`` - certificate_template (google.cloud.security.privateca_v1.types.CertificateTemplate): - Required. A - [CertificateTemplate][google.cloud.security.privateca.v1.CertificateTemplate] - with initial field values. - request_id (str): - Optional. An ID to identify requests. Specify - a unique request ID so that if you must retry - your request, the server will know to ignore the - request if it has already been completed. The - server will guarantee that for at least 60 - minutes since the first request. - - For example, consider a situation where you make - an initial request and t he request times out. - If you make the request again with the same - request ID, the server can check if original - operation with the same request ID was received, - and if so, will ignore the second request. This - prevents clients from accidentally creating - duplicate commitments. - The request ID must be a valid UUID with the - exception that zero UUID is not supported - (00000000-0000-0000-0000-000000000000). - """ - - parent: str = proto.Field( - proto.STRING, - number=1, - ) - certificate_template_id: str = proto.Field( - proto.STRING, - number=2, - ) - certificate_template: resources.CertificateTemplate = proto.Field( - proto.MESSAGE, - number=3, - message=resources.CertificateTemplate, - ) - request_id: str = proto.Field( - proto.STRING, - number=4, - ) - - -class DeleteCertificateTemplateRequest(proto.Message): - r"""Request message for - [CertificateAuthorityService.DeleteCertificateTemplate][google.cloud.security.privateca.v1.CertificateAuthorityService.DeleteCertificateTemplate]. - - Attributes: - name (str): - Required. The resource name for this - [CertificateTemplate][google.cloud.security.privateca.v1.CertificateTemplate] - in the format - ``projects/*/locations/*/certificateTemplates/*``. - request_id (str): - Optional. An ID to identify requests. Specify - a unique request ID so that if you must retry - your request, the server will know to ignore the - request if it has already been completed. The - server will guarantee that for at least 60 - minutes since the first request. - - For example, consider a situation where you make - an initial request and t he request times out. - If you make the request again with the same - request ID, the server can check if original - operation with the same request ID was received, - and if so, will ignore the second request. This - prevents clients from accidentally creating - duplicate commitments. - The request ID must be a valid UUID with the - exception that zero UUID is not supported - (00000000-0000-0000-0000-000000000000). - """ - - name: str = proto.Field( - proto.STRING, - number=1, - ) - request_id: str = proto.Field( - proto.STRING, - number=2, - ) - - -class GetCertificateTemplateRequest(proto.Message): - r"""Request message for - [CertificateAuthorityService.GetCertificateTemplate][google.cloud.security.privateca.v1.CertificateAuthorityService.GetCertificateTemplate]. - - Attributes: - name (str): - Required. The - [name][google.cloud.security.privateca.v1.CertificateTemplate.name] - of the - [CertificateTemplate][google.cloud.security.privateca.v1.CertificateTemplate] - to get. - """ - - name: str = proto.Field( - proto.STRING, - number=1, - ) - - -class ListCertificateTemplatesRequest(proto.Message): - r"""Request message for - [CertificateAuthorityService.ListCertificateTemplates][google.cloud.security.privateca.v1.CertificateAuthorityService.ListCertificateTemplates]. - - Attributes: - parent (str): - Required. The resource name of the location associated with - the - [CertificateTemplates][google.cloud.security.privateca.v1.CertificateTemplate], - in the format ``projects/*/locations/*``. - page_size (int): - Optional. Limit on the number of - [CertificateTemplates][google.cloud.security.privateca.v1.CertificateTemplate] - to include in the response. Further - [CertificateTemplates][google.cloud.security.privateca.v1.CertificateTemplate] - can subsequently be obtained by including the - [ListCertificateTemplatesResponse.next_page_token][google.cloud.security.privateca.v1.ListCertificateTemplatesResponse.next_page_token] - in a subsequent request. If unspecified, the server will - pick an appropriate default. - page_token (str): - Optional. Pagination token, returned earlier via - [ListCertificateTemplatesResponse.next_page_token][google.cloud.security.privateca.v1.ListCertificateTemplatesResponse.next_page_token]. - filter (str): - Optional. Only include resources that match - the filter in the response. - order_by (str): - Optional. Specify how the results should be - sorted. - """ - - parent: str = proto.Field( - proto.STRING, - number=1, - ) - page_size: int = proto.Field( - proto.INT32, - number=2, - ) - page_token: str = proto.Field( - proto.STRING, - number=3, - ) - filter: str = proto.Field( - proto.STRING, - number=4, - ) - order_by: str = proto.Field( - proto.STRING, - number=5, - ) - - -class ListCertificateTemplatesResponse(proto.Message): - r"""Response message for - [CertificateAuthorityService.ListCertificateTemplates][google.cloud.security.privateca.v1.CertificateAuthorityService.ListCertificateTemplates]. - - Attributes: - certificate_templates (MutableSequence[google.cloud.security.privateca_v1.types.CertificateTemplate]): - The list of - [CertificateTemplates][google.cloud.security.privateca.v1.CertificateTemplate]. - next_page_token (str): - A token to retrieve next page of results. Pass this value in - [ListCertificateTemplatesRequest.next_page_token][] to - retrieve the next page of results. - unreachable (MutableSequence[str]): - A list of locations (e.g. "us-west1") that - could not be reached. - """ - - @property - def raw_page(self): - return self - - certificate_templates: MutableSequence[resources.CertificateTemplate] = proto.RepeatedField( - proto.MESSAGE, - number=1, - message=resources.CertificateTemplate, - ) - next_page_token: str = proto.Field( - proto.STRING, - number=2, - ) - unreachable: MutableSequence[str] = proto.RepeatedField( - proto.STRING, - number=3, - ) - - -class UpdateCertificateTemplateRequest(proto.Message): - r"""Request message for - [CertificateAuthorityService.UpdateCertificateTemplate][google.cloud.security.privateca.v1.CertificateAuthorityService.UpdateCertificateTemplate]. - - Attributes: - certificate_template (google.cloud.security.privateca_v1.types.CertificateTemplate): - Required. - [CertificateTemplate][google.cloud.security.privateca.v1.CertificateTemplate] - with updated values. - update_mask (google.protobuf.field_mask_pb2.FieldMask): - Required. A list of fields to be updated in - this request. - request_id (str): - Optional. An ID to identify requests. Specify - a unique request ID so that if you must retry - your request, the server will know to ignore the - request if it has already been completed. The - server will guarantee that for at least 60 - minutes since the first request. - - For example, consider a situation where you make - an initial request and t he request times out. - If you make the request again with the same - request ID, the server can check if original - operation with the same request ID was received, - and if so, will ignore the second request. This - prevents clients from accidentally creating - duplicate commitments. - The request ID must be a valid UUID with the - exception that zero UUID is not supported - (00000000-0000-0000-0000-000000000000). - """ - - certificate_template: resources.CertificateTemplate = proto.Field( - proto.MESSAGE, - number=1, - message=resources.CertificateTemplate, - ) - update_mask: field_mask_pb2.FieldMask = proto.Field( - proto.MESSAGE, - number=2, - message=field_mask_pb2.FieldMask, - ) - request_id: str = 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 - created. - end_time (google.protobuf.timestamp_pb2.Timestamp): - Output only. The time the operation finished - running. - target (str): - Output only. Server-defined resource path for - the target of the operation. - verb (str): - Output only. Name of the verb executed by the - operation. - status_message (str): - Output only. Human-readable status of the - operation, if any. - requested_cancellation (bool): - Output only. Identifies whether the user has requested - cancellation of the operation. Operations that have - successfully been cancelled have [Operation.error][] value - with a [google.rpc.Status.code][google.rpc.Status.code] of - 1, corresponding to ``Code.CANCELLED``. - api_version (str): - Output only. API version used to start the - operation. - """ - - create_time: timestamp_pb2.Timestamp = proto.Field( - proto.MESSAGE, - number=1, - message=timestamp_pb2.Timestamp, - ) - end_time: timestamp_pb2.Timestamp = proto.Field( - proto.MESSAGE, - number=2, - message=timestamp_pb2.Timestamp, - ) - target: str = proto.Field( - proto.STRING, - number=3, - ) - verb: str = proto.Field( - proto.STRING, - number=4, - ) - status_message: str = proto.Field( - proto.STRING, - number=5, - ) - requested_cancellation: bool = proto.Field( - proto.BOOL, - number=6, - ) - api_version: str = proto.Field( - proto.STRING, - number=7, - ) - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/owl-bot-staging/v1/mypy.ini b/owl-bot-staging/v1/mypy.ini deleted file mode 100644 index 574c5ae..0000000 --- a/owl-bot-staging/v1/mypy.ini +++ /dev/null @@ -1,3 +0,0 @@ -[mypy] -python_version = 3.7 -namespace_packages = True diff --git a/owl-bot-staging/v1/noxfile.py b/owl-bot-staging/v1/noxfile.py deleted file mode 100644 index ffd32a7..0000000 --- a/owl-bot-staging/v1/noxfile.py +++ /dev/null @@ -1,184 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -import os -import pathlib -import shutil -import subprocess -import sys - - -import nox # type: ignore - -ALL_PYTHON = [ - "3.7", - "3.8", - "3.9", - "3.10", - "3.11", -] - -CURRENT_DIRECTORY = pathlib.Path(__file__).parent.absolute() - -LOWER_BOUND_CONSTRAINTS_FILE = CURRENT_DIRECTORY / "constraints.txt" -PACKAGE_NAME = subprocess.check_output([sys.executable, "setup.py", "--name"], encoding="utf-8") - -BLACK_VERSION = "black==22.3.0" -BLACK_PATHS = ["docs", "google", "tests", "samples", "noxfile.py", "setup.py"] -DEFAULT_PYTHON_VERSION = "3.11" - -nox.sessions = [ - "unit", - "cover", - "mypy", - "check_lower_bounds" - # exclude update_lower_bounds from default - "docs", - "blacken", - "lint", - "lint_setup_py", -] - -@nox.session(python=ALL_PYTHON) -def unit(session): - """Run the unit test suite.""" - - session.install('coverage', 'pytest', 'pytest-cov', 'pytest-asyncio', 'asyncmock; python_version < "3.8"') - session.install('-e', '.') - - session.run( - 'py.test', - '--quiet', - '--cov=google/cloud/security/privateca_v1/', - '--cov=tests/', - '--cov-config=.coveragerc', - '--cov-report=term', - '--cov-report=html', - os.path.join('tests', 'unit', ''.join(session.posargs)) - ) - - -@nox.session(python=DEFAULT_PYTHON_VERSION) -def cover(session): - """Run the final coverage report. - This outputs the coverage report aggregating coverage from the unit - test runs (not system test runs), and then erases coverage data. - """ - session.install("coverage", "pytest-cov") - session.run("coverage", "report", "--show-missing", "--fail-under=100") - - session.run("coverage", "erase") - - -@nox.session(python=ALL_PYTHON) -def mypy(session): - """Run the type checker.""" - session.install( - 'mypy', - 'types-requests', - 'types-protobuf' - ) - session.install('.') - session.run( - 'mypy', - '--explicit-package-bases', - 'google', - ) - - -@nox.session -def update_lower_bounds(session): - """Update lower bounds in constraints.txt to match setup.py""" - session.install('google-cloud-testutils') - session.install('.') - - session.run( - 'lower-bound-checker', - 'update', - '--package-name', - PACKAGE_NAME, - '--constraints-file', - str(LOWER_BOUND_CONSTRAINTS_FILE), - ) - - -@nox.session -def check_lower_bounds(session): - """Check lower bounds in setup.py are reflected in constraints file""" - session.install('google-cloud-testutils') - session.install('.') - - session.run( - 'lower-bound-checker', - 'check', - '--package-name', - PACKAGE_NAME, - '--constraints-file', - str(LOWER_BOUND_CONSTRAINTS_FILE), - ) - -@nox.session(python=DEFAULT_PYTHON_VERSION) -def docs(session): - """Build the docs for this library.""" - - session.install("-e", ".") - session.install("sphinx==4.0.1", "alabaster", "recommonmark") - - shutil.rmtree(os.path.join("docs", "_build"), ignore_errors=True) - session.run( - "sphinx-build", - "-W", # warnings as errors - "-T", # show full traceback on exception - "-N", # no colors - "-b", - "html", - "-d", - os.path.join("docs", "_build", "doctrees", ""), - os.path.join("docs", ""), - os.path.join("docs", "_build", "html", ""), - ) - - -@nox.session(python=DEFAULT_PYTHON_VERSION) -def lint(session): - """Run linters. - - Returns a failure if the linters find linting errors or sufficiently - serious code quality issues. - """ - session.install("flake8", BLACK_VERSION) - session.run( - "black", - "--check", - *BLACK_PATHS, - ) - session.run("flake8", "google", "tests", "samples") - - -@nox.session(python=DEFAULT_PYTHON_VERSION) -def blacken(session): - """Run black. Format code to uniform standard.""" - session.install(BLACK_VERSION) - session.run( - "black", - *BLACK_PATHS, - ) - - -@nox.session(python=DEFAULT_PYTHON_VERSION) -def lint_setup_py(session): - """Verify that setup.py is valid (including RST check).""" - session.install("docutils", "pygments") - session.run("python", "setup.py", "check", "--restructuredtext", "--strict") diff --git a/owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_activate_certificate_authority_async.py b/owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_activate_certificate_authority_async.py deleted file mode 100644 index 2d9a827..0000000 --- a/owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_activate_certificate_authority_async.py +++ /dev/null @@ -1,61 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for ActivateCertificateAuthority -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-private-ca - - -# [START privateca_v1_generated_CertificateAuthorityService_ActivateCertificateAuthority_async] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud.security import privateca_v1 - - -async def sample_activate_certificate_authority(): - # Create a client - client = privateca_v1.CertificateAuthorityServiceAsyncClient() - - # Initialize request argument(s) - subordinate_config = privateca_v1.SubordinateConfig() - subordinate_config.certificate_authority = "certificate_authority_value" - - request = privateca_v1.ActivateCertificateAuthorityRequest( - name="name_value", - pem_ca_certificate="pem_ca_certificate_value", - subordinate_config=subordinate_config, - ) - - # Make the request - operation = client.activate_certificate_authority(request=request) - - print("Waiting for operation to complete...") - - response = (await operation).result() - - # Handle the response - print(response) - -# [END privateca_v1_generated_CertificateAuthorityService_ActivateCertificateAuthority_async] diff --git a/owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_activate_certificate_authority_sync.py b/owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_activate_certificate_authority_sync.py deleted file mode 100644 index 481e240..0000000 --- a/owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_activate_certificate_authority_sync.py +++ /dev/null @@ -1,61 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for ActivateCertificateAuthority -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-private-ca - - -# [START privateca_v1_generated_CertificateAuthorityService_ActivateCertificateAuthority_sync] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud.security import privateca_v1 - - -def sample_activate_certificate_authority(): - # Create a client - client = privateca_v1.CertificateAuthorityServiceClient() - - # Initialize request argument(s) - subordinate_config = privateca_v1.SubordinateConfig() - subordinate_config.certificate_authority = "certificate_authority_value" - - request = privateca_v1.ActivateCertificateAuthorityRequest( - name="name_value", - pem_ca_certificate="pem_ca_certificate_value", - subordinate_config=subordinate_config, - ) - - # Make the request - operation = client.activate_certificate_authority(request=request) - - print("Waiting for operation to complete...") - - response = operation.result() - - # Handle the response - print(response) - -# [END privateca_v1_generated_CertificateAuthorityService_ActivateCertificateAuthority_sync] diff --git a/owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_create_ca_pool_async.py b/owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_create_ca_pool_async.py deleted file mode 100644 index 47d8176..0000000 --- a/owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_create_ca_pool_async.py +++ /dev/null @@ -1,61 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for CreateCaPool -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-private-ca - - -# [START privateca_v1_generated_CertificateAuthorityService_CreateCaPool_async] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud.security import privateca_v1 - - -async def sample_create_ca_pool(): - # Create a client - client = privateca_v1.CertificateAuthorityServiceAsyncClient() - - # Initialize request argument(s) - ca_pool = privateca_v1.CaPool() - ca_pool.tier = "DEVOPS" - - request = privateca_v1.CreateCaPoolRequest( - parent="parent_value", - ca_pool_id="ca_pool_id_value", - ca_pool=ca_pool, - ) - - # Make the request - operation = client.create_ca_pool(request=request) - - print("Waiting for operation to complete...") - - response = (await operation).result() - - # Handle the response - print(response) - -# [END privateca_v1_generated_CertificateAuthorityService_CreateCaPool_async] diff --git a/owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_create_ca_pool_sync.py b/owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_create_ca_pool_sync.py deleted file mode 100644 index c9d01e2..0000000 --- a/owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_create_ca_pool_sync.py +++ /dev/null @@ -1,61 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for CreateCaPool -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-private-ca - - -# [START privateca_v1_generated_CertificateAuthorityService_CreateCaPool_sync] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud.security import privateca_v1 - - -def sample_create_ca_pool(): - # Create a client - client = privateca_v1.CertificateAuthorityServiceClient() - - # Initialize request argument(s) - ca_pool = privateca_v1.CaPool() - ca_pool.tier = "DEVOPS" - - request = privateca_v1.CreateCaPoolRequest( - parent="parent_value", - ca_pool_id="ca_pool_id_value", - ca_pool=ca_pool, - ) - - # Make the request - operation = client.create_ca_pool(request=request) - - print("Waiting for operation to complete...") - - response = operation.result() - - # Handle the response - print(response) - -# [END privateca_v1_generated_CertificateAuthorityService_CreateCaPool_sync] diff --git a/owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_create_certificate_async.py b/owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_create_certificate_async.py deleted file mode 100644 index fbdd1d5..0000000 --- a/owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_create_certificate_async.py +++ /dev/null @@ -1,56 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for CreateCertificate -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-private-ca - - -# [START privateca_v1_generated_CertificateAuthorityService_CreateCertificate_async] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud.security import privateca_v1 - - -async def sample_create_certificate(): - # Create a client - client = privateca_v1.CertificateAuthorityServiceAsyncClient() - - # Initialize request argument(s) - certificate = privateca_v1.Certificate() - certificate.pem_csr = "pem_csr_value" - - request = privateca_v1.CreateCertificateRequest( - parent="parent_value", - certificate=certificate, - ) - - # Make the request - response = await client.create_certificate(request=request) - - # Handle the response - print(response) - -# [END privateca_v1_generated_CertificateAuthorityService_CreateCertificate_async] diff --git a/owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_create_certificate_authority_async.py b/owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_create_certificate_authority_async.py deleted file mode 100644 index 3364910..0000000 --- a/owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_create_certificate_authority_async.py +++ /dev/null @@ -1,62 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for CreateCertificateAuthority -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-private-ca - - -# [START privateca_v1_generated_CertificateAuthorityService_CreateCertificateAuthority_async] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud.security import privateca_v1 - - -async def sample_create_certificate_authority(): - # Create a client - client = privateca_v1.CertificateAuthorityServiceAsyncClient() - - # Initialize request argument(s) - certificate_authority = privateca_v1.CertificateAuthority() - certificate_authority.type_ = "SUBORDINATE" - certificate_authority.key_spec.cloud_kms_key_version = "cloud_kms_key_version_value" - - request = privateca_v1.CreateCertificateAuthorityRequest( - parent="parent_value", - certificate_authority_id="certificate_authority_id_value", - certificate_authority=certificate_authority, - ) - - # Make the request - operation = client.create_certificate_authority(request=request) - - print("Waiting for operation to complete...") - - response = (await operation).result() - - # Handle the response - print(response) - -# [END privateca_v1_generated_CertificateAuthorityService_CreateCertificateAuthority_async] diff --git a/owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_create_certificate_authority_sync.py b/owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_create_certificate_authority_sync.py deleted file mode 100644 index 5da1b58..0000000 --- a/owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_create_certificate_authority_sync.py +++ /dev/null @@ -1,62 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for CreateCertificateAuthority -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-private-ca - - -# [START privateca_v1_generated_CertificateAuthorityService_CreateCertificateAuthority_sync] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud.security import privateca_v1 - - -def sample_create_certificate_authority(): - # Create a client - client = privateca_v1.CertificateAuthorityServiceClient() - - # Initialize request argument(s) - certificate_authority = privateca_v1.CertificateAuthority() - certificate_authority.type_ = "SUBORDINATE" - certificate_authority.key_spec.cloud_kms_key_version = "cloud_kms_key_version_value" - - request = privateca_v1.CreateCertificateAuthorityRequest( - parent="parent_value", - certificate_authority_id="certificate_authority_id_value", - certificate_authority=certificate_authority, - ) - - # Make the request - operation = client.create_certificate_authority(request=request) - - print("Waiting for operation to complete...") - - response = operation.result() - - # Handle the response - print(response) - -# [END privateca_v1_generated_CertificateAuthorityService_CreateCertificateAuthority_sync] diff --git a/owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_create_certificate_sync.py b/owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_create_certificate_sync.py deleted file mode 100644 index c9a50c8..0000000 --- a/owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_create_certificate_sync.py +++ /dev/null @@ -1,56 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for CreateCertificate -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-private-ca - - -# [START privateca_v1_generated_CertificateAuthorityService_CreateCertificate_sync] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud.security import privateca_v1 - - -def sample_create_certificate(): - # Create a client - client = privateca_v1.CertificateAuthorityServiceClient() - - # Initialize request argument(s) - certificate = privateca_v1.Certificate() - certificate.pem_csr = "pem_csr_value" - - request = privateca_v1.CreateCertificateRequest( - parent="parent_value", - certificate=certificate, - ) - - # Make the request - response = client.create_certificate(request=request) - - # Handle the response - print(response) - -# [END privateca_v1_generated_CertificateAuthorityService_CreateCertificate_sync] diff --git a/owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_create_certificate_template_async.py b/owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_create_certificate_template_async.py deleted file mode 100644 index 077af94..0000000 --- a/owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_create_certificate_template_async.py +++ /dev/null @@ -1,57 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for CreateCertificateTemplate -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-private-ca - - -# [START privateca_v1_generated_CertificateAuthorityService_CreateCertificateTemplate_async] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud.security import privateca_v1 - - -async def sample_create_certificate_template(): - # Create a client - client = privateca_v1.CertificateAuthorityServiceAsyncClient() - - # Initialize request argument(s) - request = privateca_v1.CreateCertificateTemplateRequest( - parent="parent_value", - certificate_template_id="certificate_template_id_value", - ) - - # Make the request - operation = client.create_certificate_template(request=request) - - print("Waiting for operation to complete...") - - response = (await operation).result() - - # Handle the response - print(response) - -# [END privateca_v1_generated_CertificateAuthorityService_CreateCertificateTemplate_async] diff --git a/owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_create_certificate_template_sync.py b/owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_create_certificate_template_sync.py deleted file mode 100644 index 3a50d32..0000000 --- a/owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_create_certificate_template_sync.py +++ /dev/null @@ -1,57 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for CreateCertificateTemplate -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-private-ca - - -# [START privateca_v1_generated_CertificateAuthorityService_CreateCertificateTemplate_sync] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud.security import privateca_v1 - - -def sample_create_certificate_template(): - # Create a client - client = privateca_v1.CertificateAuthorityServiceClient() - - # Initialize request argument(s) - request = privateca_v1.CreateCertificateTemplateRequest( - parent="parent_value", - certificate_template_id="certificate_template_id_value", - ) - - # Make the request - operation = client.create_certificate_template(request=request) - - print("Waiting for operation to complete...") - - response = operation.result() - - # Handle the response - print(response) - -# [END privateca_v1_generated_CertificateAuthorityService_CreateCertificateTemplate_sync] diff --git a/owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_delete_ca_pool_async.py b/owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_delete_ca_pool_async.py deleted file mode 100644 index 73f21f9..0000000 --- a/owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_delete_ca_pool_async.py +++ /dev/null @@ -1,56 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for DeleteCaPool -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-private-ca - - -# [START privateca_v1_generated_CertificateAuthorityService_DeleteCaPool_async] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud.security import privateca_v1 - - -async def sample_delete_ca_pool(): - # Create a client - client = privateca_v1.CertificateAuthorityServiceAsyncClient() - - # Initialize request argument(s) - request = privateca_v1.DeleteCaPoolRequest( - name="name_value", - ) - - # Make the request - operation = client.delete_ca_pool(request=request) - - print("Waiting for operation to complete...") - - response = (await operation).result() - - # Handle the response - print(response) - -# [END privateca_v1_generated_CertificateAuthorityService_DeleteCaPool_async] diff --git a/owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_delete_ca_pool_sync.py b/owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_delete_ca_pool_sync.py deleted file mode 100644 index eda61b0..0000000 --- a/owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_delete_ca_pool_sync.py +++ /dev/null @@ -1,56 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for DeleteCaPool -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-private-ca - - -# [START privateca_v1_generated_CertificateAuthorityService_DeleteCaPool_sync] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud.security import privateca_v1 - - -def sample_delete_ca_pool(): - # Create a client - client = privateca_v1.CertificateAuthorityServiceClient() - - # Initialize request argument(s) - request = privateca_v1.DeleteCaPoolRequest( - name="name_value", - ) - - # Make the request - operation = client.delete_ca_pool(request=request) - - print("Waiting for operation to complete...") - - response = operation.result() - - # Handle the response - print(response) - -# [END privateca_v1_generated_CertificateAuthorityService_DeleteCaPool_sync] diff --git a/owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_delete_certificate_authority_async.py b/owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_delete_certificate_authority_async.py deleted file mode 100644 index 12ad27b..0000000 --- a/owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_delete_certificate_authority_async.py +++ /dev/null @@ -1,56 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for DeleteCertificateAuthority -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-private-ca - - -# [START privateca_v1_generated_CertificateAuthorityService_DeleteCertificateAuthority_async] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud.security import privateca_v1 - - -async def sample_delete_certificate_authority(): - # Create a client - client = privateca_v1.CertificateAuthorityServiceAsyncClient() - - # Initialize request argument(s) - request = privateca_v1.DeleteCertificateAuthorityRequest( - name="name_value", - ) - - # Make the request - operation = client.delete_certificate_authority(request=request) - - print("Waiting for operation to complete...") - - response = (await operation).result() - - # Handle the response - print(response) - -# [END privateca_v1_generated_CertificateAuthorityService_DeleteCertificateAuthority_async] diff --git a/owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_delete_certificate_authority_sync.py b/owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_delete_certificate_authority_sync.py deleted file mode 100644 index 7ae0813..0000000 --- a/owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_delete_certificate_authority_sync.py +++ /dev/null @@ -1,56 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for DeleteCertificateAuthority -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-private-ca - - -# [START privateca_v1_generated_CertificateAuthorityService_DeleteCertificateAuthority_sync] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud.security import privateca_v1 - - -def sample_delete_certificate_authority(): - # Create a client - client = privateca_v1.CertificateAuthorityServiceClient() - - # Initialize request argument(s) - request = privateca_v1.DeleteCertificateAuthorityRequest( - name="name_value", - ) - - # Make the request - operation = client.delete_certificate_authority(request=request) - - print("Waiting for operation to complete...") - - response = operation.result() - - # Handle the response - print(response) - -# [END privateca_v1_generated_CertificateAuthorityService_DeleteCertificateAuthority_sync] diff --git a/owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_delete_certificate_template_async.py b/owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_delete_certificate_template_async.py deleted file mode 100644 index 8f38739..0000000 --- a/owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_delete_certificate_template_async.py +++ /dev/null @@ -1,56 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for DeleteCertificateTemplate -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-private-ca - - -# [START privateca_v1_generated_CertificateAuthorityService_DeleteCertificateTemplate_async] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud.security import privateca_v1 - - -async def sample_delete_certificate_template(): - # Create a client - client = privateca_v1.CertificateAuthorityServiceAsyncClient() - - # Initialize request argument(s) - request = privateca_v1.DeleteCertificateTemplateRequest( - name="name_value", - ) - - # Make the request - operation = client.delete_certificate_template(request=request) - - print("Waiting for operation to complete...") - - response = (await operation).result() - - # Handle the response - print(response) - -# [END privateca_v1_generated_CertificateAuthorityService_DeleteCertificateTemplate_async] diff --git a/owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_delete_certificate_template_sync.py b/owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_delete_certificate_template_sync.py deleted file mode 100644 index f7d352b..0000000 --- a/owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_delete_certificate_template_sync.py +++ /dev/null @@ -1,56 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for DeleteCertificateTemplate -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-private-ca - - -# [START privateca_v1_generated_CertificateAuthorityService_DeleteCertificateTemplate_sync] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud.security import privateca_v1 - - -def sample_delete_certificate_template(): - # Create a client - client = privateca_v1.CertificateAuthorityServiceClient() - - # Initialize request argument(s) - request = privateca_v1.DeleteCertificateTemplateRequest( - name="name_value", - ) - - # Make the request - operation = client.delete_certificate_template(request=request) - - print("Waiting for operation to complete...") - - response = operation.result() - - # Handle the response - print(response) - -# [END privateca_v1_generated_CertificateAuthorityService_DeleteCertificateTemplate_sync] diff --git a/owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_disable_certificate_authority_async.py b/owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_disable_certificate_authority_async.py deleted file mode 100644 index a60c3c6..0000000 --- a/owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_disable_certificate_authority_async.py +++ /dev/null @@ -1,56 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for DisableCertificateAuthority -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-private-ca - - -# [START privateca_v1_generated_CertificateAuthorityService_DisableCertificateAuthority_async] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud.security import privateca_v1 - - -async def sample_disable_certificate_authority(): - # Create a client - client = privateca_v1.CertificateAuthorityServiceAsyncClient() - - # Initialize request argument(s) - request = privateca_v1.DisableCertificateAuthorityRequest( - name="name_value", - ) - - # Make the request - operation = client.disable_certificate_authority(request=request) - - print("Waiting for operation to complete...") - - response = (await operation).result() - - # Handle the response - print(response) - -# [END privateca_v1_generated_CertificateAuthorityService_DisableCertificateAuthority_async] diff --git a/owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_disable_certificate_authority_sync.py b/owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_disable_certificate_authority_sync.py deleted file mode 100644 index 90e7039..0000000 --- a/owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_disable_certificate_authority_sync.py +++ /dev/null @@ -1,56 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for DisableCertificateAuthority -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-private-ca - - -# [START privateca_v1_generated_CertificateAuthorityService_DisableCertificateAuthority_sync] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud.security import privateca_v1 - - -def sample_disable_certificate_authority(): - # Create a client - client = privateca_v1.CertificateAuthorityServiceClient() - - # Initialize request argument(s) - request = privateca_v1.DisableCertificateAuthorityRequest( - name="name_value", - ) - - # Make the request - operation = client.disable_certificate_authority(request=request) - - print("Waiting for operation to complete...") - - response = operation.result() - - # Handle the response - print(response) - -# [END privateca_v1_generated_CertificateAuthorityService_DisableCertificateAuthority_sync] diff --git a/owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_enable_certificate_authority_async.py b/owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_enable_certificate_authority_async.py deleted file mode 100644 index 0ab6aa1..0000000 --- a/owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_enable_certificate_authority_async.py +++ /dev/null @@ -1,56 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for EnableCertificateAuthority -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-private-ca - - -# [START privateca_v1_generated_CertificateAuthorityService_EnableCertificateAuthority_async] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud.security import privateca_v1 - - -async def sample_enable_certificate_authority(): - # Create a client - client = privateca_v1.CertificateAuthorityServiceAsyncClient() - - # Initialize request argument(s) - request = privateca_v1.EnableCertificateAuthorityRequest( - name="name_value", - ) - - # Make the request - operation = client.enable_certificate_authority(request=request) - - print("Waiting for operation to complete...") - - response = (await operation).result() - - # Handle the response - print(response) - -# [END privateca_v1_generated_CertificateAuthorityService_EnableCertificateAuthority_async] diff --git a/owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_enable_certificate_authority_sync.py b/owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_enable_certificate_authority_sync.py deleted file mode 100644 index 3f030c7..0000000 --- a/owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_enable_certificate_authority_sync.py +++ /dev/null @@ -1,56 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for EnableCertificateAuthority -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-private-ca - - -# [START privateca_v1_generated_CertificateAuthorityService_EnableCertificateAuthority_sync] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud.security import privateca_v1 - - -def sample_enable_certificate_authority(): - # Create a client - client = privateca_v1.CertificateAuthorityServiceClient() - - # Initialize request argument(s) - request = privateca_v1.EnableCertificateAuthorityRequest( - name="name_value", - ) - - # Make the request - operation = client.enable_certificate_authority(request=request) - - print("Waiting for operation to complete...") - - response = operation.result() - - # Handle the response - print(response) - -# [END privateca_v1_generated_CertificateAuthorityService_EnableCertificateAuthority_sync] diff --git a/owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_fetch_ca_certs_async.py b/owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_fetch_ca_certs_async.py deleted file mode 100644 index 0811813..0000000 --- a/owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_fetch_ca_certs_async.py +++ /dev/null @@ -1,52 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for FetchCaCerts -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-private-ca - - -# [START privateca_v1_generated_CertificateAuthorityService_FetchCaCerts_async] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud.security import privateca_v1 - - -async def sample_fetch_ca_certs(): - # Create a client - client = privateca_v1.CertificateAuthorityServiceAsyncClient() - - # Initialize request argument(s) - request = privateca_v1.FetchCaCertsRequest( - ca_pool="ca_pool_value", - ) - - # Make the request - response = await client.fetch_ca_certs(request=request) - - # Handle the response - print(response) - -# [END privateca_v1_generated_CertificateAuthorityService_FetchCaCerts_async] diff --git a/owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_fetch_ca_certs_sync.py b/owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_fetch_ca_certs_sync.py deleted file mode 100644 index 4cb78a7..0000000 --- a/owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_fetch_ca_certs_sync.py +++ /dev/null @@ -1,52 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for FetchCaCerts -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-private-ca - - -# [START privateca_v1_generated_CertificateAuthorityService_FetchCaCerts_sync] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud.security import privateca_v1 - - -def sample_fetch_ca_certs(): - # Create a client - client = privateca_v1.CertificateAuthorityServiceClient() - - # Initialize request argument(s) - request = privateca_v1.FetchCaCertsRequest( - ca_pool="ca_pool_value", - ) - - # Make the request - response = client.fetch_ca_certs(request=request) - - # Handle the response - print(response) - -# [END privateca_v1_generated_CertificateAuthorityService_FetchCaCerts_sync] diff --git a/owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_fetch_certificate_authority_csr_async.py b/owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_fetch_certificate_authority_csr_async.py deleted file mode 100644 index 6462118..0000000 --- a/owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_fetch_certificate_authority_csr_async.py +++ /dev/null @@ -1,52 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for FetchCertificateAuthorityCsr -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-private-ca - - -# [START privateca_v1_generated_CertificateAuthorityService_FetchCertificateAuthorityCsr_async] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud.security import privateca_v1 - - -async def sample_fetch_certificate_authority_csr(): - # Create a client - client = privateca_v1.CertificateAuthorityServiceAsyncClient() - - # Initialize request argument(s) - request = privateca_v1.FetchCertificateAuthorityCsrRequest( - name="name_value", - ) - - # Make the request - response = await client.fetch_certificate_authority_csr(request=request) - - # Handle the response - print(response) - -# [END privateca_v1_generated_CertificateAuthorityService_FetchCertificateAuthorityCsr_async] diff --git a/owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_fetch_certificate_authority_csr_sync.py b/owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_fetch_certificate_authority_csr_sync.py deleted file mode 100644 index 3983c7c..0000000 --- a/owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_fetch_certificate_authority_csr_sync.py +++ /dev/null @@ -1,52 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for FetchCertificateAuthorityCsr -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-private-ca - - -# [START privateca_v1_generated_CertificateAuthorityService_FetchCertificateAuthorityCsr_sync] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud.security import privateca_v1 - - -def sample_fetch_certificate_authority_csr(): - # Create a client - client = privateca_v1.CertificateAuthorityServiceClient() - - # Initialize request argument(s) - request = privateca_v1.FetchCertificateAuthorityCsrRequest( - name="name_value", - ) - - # Make the request - response = client.fetch_certificate_authority_csr(request=request) - - # Handle the response - print(response) - -# [END privateca_v1_generated_CertificateAuthorityService_FetchCertificateAuthorityCsr_sync] diff --git a/owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_get_ca_pool_async.py b/owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_get_ca_pool_async.py deleted file mode 100644 index 78e3911..0000000 --- a/owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_get_ca_pool_async.py +++ /dev/null @@ -1,52 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for GetCaPool -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-private-ca - - -# [START privateca_v1_generated_CertificateAuthorityService_GetCaPool_async] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud.security import privateca_v1 - - -async def sample_get_ca_pool(): - # Create a client - client = privateca_v1.CertificateAuthorityServiceAsyncClient() - - # Initialize request argument(s) - request = privateca_v1.GetCaPoolRequest( - name="name_value", - ) - - # Make the request - response = await client.get_ca_pool(request=request) - - # Handle the response - print(response) - -# [END privateca_v1_generated_CertificateAuthorityService_GetCaPool_async] diff --git a/owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_get_ca_pool_sync.py b/owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_get_ca_pool_sync.py deleted file mode 100644 index 125d3d6..0000000 --- a/owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_get_ca_pool_sync.py +++ /dev/null @@ -1,52 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for GetCaPool -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-private-ca - - -# [START privateca_v1_generated_CertificateAuthorityService_GetCaPool_sync] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud.security import privateca_v1 - - -def sample_get_ca_pool(): - # Create a client - client = privateca_v1.CertificateAuthorityServiceClient() - - # Initialize request argument(s) - request = privateca_v1.GetCaPoolRequest( - name="name_value", - ) - - # Make the request - response = client.get_ca_pool(request=request) - - # Handle the response - print(response) - -# [END privateca_v1_generated_CertificateAuthorityService_GetCaPool_sync] diff --git a/owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_get_certificate_async.py b/owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_get_certificate_async.py deleted file mode 100644 index abda7fe..0000000 --- a/owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_get_certificate_async.py +++ /dev/null @@ -1,52 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for GetCertificate -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-private-ca - - -# [START privateca_v1_generated_CertificateAuthorityService_GetCertificate_async] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud.security import privateca_v1 - - -async def sample_get_certificate(): - # Create a client - client = privateca_v1.CertificateAuthorityServiceAsyncClient() - - # Initialize request argument(s) - request = privateca_v1.GetCertificateRequest( - name="name_value", - ) - - # Make the request - response = await client.get_certificate(request=request) - - # Handle the response - print(response) - -# [END privateca_v1_generated_CertificateAuthorityService_GetCertificate_async] diff --git a/owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_get_certificate_authority_async.py b/owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_get_certificate_authority_async.py deleted file mode 100644 index b0b0622..0000000 --- a/owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_get_certificate_authority_async.py +++ /dev/null @@ -1,52 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for GetCertificateAuthority -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-private-ca - - -# [START privateca_v1_generated_CertificateAuthorityService_GetCertificateAuthority_async] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud.security import privateca_v1 - - -async def sample_get_certificate_authority(): - # Create a client - client = privateca_v1.CertificateAuthorityServiceAsyncClient() - - # Initialize request argument(s) - request = privateca_v1.GetCertificateAuthorityRequest( - name="name_value", - ) - - # Make the request - response = await client.get_certificate_authority(request=request) - - # Handle the response - print(response) - -# [END privateca_v1_generated_CertificateAuthorityService_GetCertificateAuthority_async] diff --git a/owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_get_certificate_authority_sync.py b/owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_get_certificate_authority_sync.py deleted file mode 100644 index f1a9a94..0000000 --- a/owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_get_certificate_authority_sync.py +++ /dev/null @@ -1,52 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for GetCertificateAuthority -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-private-ca - - -# [START privateca_v1_generated_CertificateAuthorityService_GetCertificateAuthority_sync] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud.security import privateca_v1 - - -def sample_get_certificate_authority(): - # Create a client - client = privateca_v1.CertificateAuthorityServiceClient() - - # Initialize request argument(s) - request = privateca_v1.GetCertificateAuthorityRequest( - name="name_value", - ) - - # Make the request - response = client.get_certificate_authority(request=request) - - # Handle the response - print(response) - -# [END privateca_v1_generated_CertificateAuthorityService_GetCertificateAuthority_sync] diff --git a/owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_get_certificate_revocation_list_async.py b/owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_get_certificate_revocation_list_async.py deleted file mode 100644 index b332b11..0000000 --- a/owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_get_certificate_revocation_list_async.py +++ /dev/null @@ -1,52 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for GetCertificateRevocationList -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-private-ca - - -# [START privateca_v1_generated_CertificateAuthorityService_GetCertificateRevocationList_async] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud.security import privateca_v1 - - -async def sample_get_certificate_revocation_list(): - # Create a client - client = privateca_v1.CertificateAuthorityServiceAsyncClient() - - # Initialize request argument(s) - request = privateca_v1.GetCertificateRevocationListRequest( - name="name_value", - ) - - # Make the request - response = await client.get_certificate_revocation_list(request=request) - - # Handle the response - print(response) - -# [END privateca_v1_generated_CertificateAuthorityService_GetCertificateRevocationList_async] diff --git a/owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_get_certificate_revocation_list_sync.py b/owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_get_certificate_revocation_list_sync.py deleted file mode 100644 index 22ece54..0000000 --- a/owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_get_certificate_revocation_list_sync.py +++ /dev/null @@ -1,52 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for GetCertificateRevocationList -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-private-ca - - -# [START privateca_v1_generated_CertificateAuthorityService_GetCertificateRevocationList_sync] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud.security import privateca_v1 - - -def sample_get_certificate_revocation_list(): - # Create a client - client = privateca_v1.CertificateAuthorityServiceClient() - - # Initialize request argument(s) - request = privateca_v1.GetCertificateRevocationListRequest( - name="name_value", - ) - - # Make the request - response = client.get_certificate_revocation_list(request=request) - - # Handle the response - print(response) - -# [END privateca_v1_generated_CertificateAuthorityService_GetCertificateRevocationList_sync] diff --git a/owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_get_certificate_sync.py b/owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_get_certificate_sync.py deleted file mode 100644 index 1ea19a8..0000000 --- a/owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_get_certificate_sync.py +++ /dev/null @@ -1,52 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for GetCertificate -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-private-ca - - -# [START privateca_v1_generated_CertificateAuthorityService_GetCertificate_sync] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud.security import privateca_v1 - - -def sample_get_certificate(): - # Create a client - client = privateca_v1.CertificateAuthorityServiceClient() - - # Initialize request argument(s) - request = privateca_v1.GetCertificateRequest( - name="name_value", - ) - - # Make the request - response = client.get_certificate(request=request) - - # Handle the response - print(response) - -# [END privateca_v1_generated_CertificateAuthorityService_GetCertificate_sync] diff --git a/owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_get_certificate_template_async.py b/owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_get_certificate_template_async.py deleted file mode 100644 index 17e5024..0000000 --- a/owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_get_certificate_template_async.py +++ /dev/null @@ -1,52 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for GetCertificateTemplate -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-private-ca - - -# [START privateca_v1_generated_CertificateAuthorityService_GetCertificateTemplate_async] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud.security import privateca_v1 - - -async def sample_get_certificate_template(): - # Create a client - client = privateca_v1.CertificateAuthorityServiceAsyncClient() - - # Initialize request argument(s) - request = privateca_v1.GetCertificateTemplateRequest( - name="name_value", - ) - - # Make the request - response = await client.get_certificate_template(request=request) - - # Handle the response - print(response) - -# [END privateca_v1_generated_CertificateAuthorityService_GetCertificateTemplate_async] diff --git a/owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_get_certificate_template_sync.py b/owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_get_certificate_template_sync.py deleted file mode 100644 index 7fa2c4e..0000000 --- a/owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_get_certificate_template_sync.py +++ /dev/null @@ -1,52 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for GetCertificateTemplate -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-private-ca - - -# [START privateca_v1_generated_CertificateAuthorityService_GetCertificateTemplate_sync] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud.security import privateca_v1 - - -def sample_get_certificate_template(): - # Create a client - client = privateca_v1.CertificateAuthorityServiceClient() - - # Initialize request argument(s) - request = privateca_v1.GetCertificateTemplateRequest( - name="name_value", - ) - - # Make the request - response = client.get_certificate_template(request=request) - - # Handle the response - print(response) - -# [END privateca_v1_generated_CertificateAuthorityService_GetCertificateTemplate_sync] diff --git a/owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_list_ca_pools_async.py b/owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_list_ca_pools_async.py deleted file mode 100644 index f202c29..0000000 --- a/owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_list_ca_pools_async.py +++ /dev/null @@ -1,53 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for ListCaPools -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-private-ca - - -# [START privateca_v1_generated_CertificateAuthorityService_ListCaPools_async] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud.security import privateca_v1 - - -async def sample_list_ca_pools(): - # Create a client - client = privateca_v1.CertificateAuthorityServiceAsyncClient() - - # Initialize request argument(s) - request = privateca_v1.ListCaPoolsRequest( - parent="parent_value", - ) - - # Make the request - page_result = client.list_ca_pools(request=request) - - # Handle the response - async for response in page_result: - print(response) - -# [END privateca_v1_generated_CertificateAuthorityService_ListCaPools_async] diff --git a/owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_list_ca_pools_sync.py b/owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_list_ca_pools_sync.py deleted file mode 100644 index d875eb9..0000000 --- a/owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_list_ca_pools_sync.py +++ /dev/null @@ -1,53 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for ListCaPools -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-private-ca - - -# [START privateca_v1_generated_CertificateAuthorityService_ListCaPools_sync] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud.security import privateca_v1 - - -def sample_list_ca_pools(): - # Create a client - client = privateca_v1.CertificateAuthorityServiceClient() - - # Initialize request argument(s) - request = privateca_v1.ListCaPoolsRequest( - parent="parent_value", - ) - - # Make the request - page_result = client.list_ca_pools(request=request) - - # Handle the response - for response in page_result: - print(response) - -# [END privateca_v1_generated_CertificateAuthorityService_ListCaPools_sync] diff --git a/owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_list_certificate_authorities_async.py b/owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_list_certificate_authorities_async.py deleted file mode 100644 index 3ebacd5..0000000 --- a/owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_list_certificate_authorities_async.py +++ /dev/null @@ -1,53 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for ListCertificateAuthorities -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-private-ca - - -# [START privateca_v1_generated_CertificateAuthorityService_ListCertificateAuthorities_async] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud.security import privateca_v1 - - -async def sample_list_certificate_authorities(): - # Create a client - client = privateca_v1.CertificateAuthorityServiceAsyncClient() - - # Initialize request argument(s) - request = privateca_v1.ListCertificateAuthoritiesRequest( - parent="parent_value", - ) - - # Make the request - page_result = client.list_certificate_authorities(request=request) - - # Handle the response - async for response in page_result: - print(response) - -# [END privateca_v1_generated_CertificateAuthorityService_ListCertificateAuthorities_async] diff --git a/owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_list_certificate_authorities_sync.py b/owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_list_certificate_authorities_sync.py deleted file mode 100644 index ce41c0e..0000000 --- a/owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_list_certificate_authorities_sync.py +++ /dev/null @@ -1,53 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for ListCertificateAuthorities -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-private-ca - - -# [START privateca_v1_generated_CertificateAuthorityService_ListCertificateAuthorities_sync] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud.security import privateca_v1 - - -def sample_list_certificate_authorities(): - # Create a client - client = privateca_v1.CertificateAuthorityServiceClient() - - # Initialize request argument(s) - request = privateca_v1.ListCertificateAuthoritiesRequest( - parent="parent_value", - ) - - # Make the request - page_result = client.list_certificate_authorities(request=request) - - # Handle the response - for response in page_result: - print(response) - -# [END privateca_v1_generated_CertificateAuthorityService_ListCertificateAuthorities_sync] diff --git a/owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_list_certificate_revocation_lists_async.py b/owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_list_certificate_revocation_lists_async.py deleted file mode 100644 index c74051b..0000000 --- a/owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_list_certificate_revocation_lists_async.py +++ /dev/null @@ -1,53 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for ListCertificateRevocationLists -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-private-ca - - -# [START privateca_v1_generated_CertificateAuthorityService_ListCertificateRevocationLists_async] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud.security import privateca_v1 - - -async def sample_list_certificate_revocation_lists(): - # Create a client - client = privateca_v1.CertificateAuthorityServiceAsyncClient() - - # Initialize request argument(s) - request = privateca_v1.ListCertificateRevocationListsRequest( - parent="parent_value", - ) - - # Make the request - page_result = client.list_certificate_revocation_lists(request=request) - - # Handle the response - async for response in page_result: - print(response) - -# [END privateca_v1_generated_CertificateAuthorityService_ListCertificateRevocationLists_async] diff --git a/owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_list_certificate_revocation_lists_sync.py b/owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_list_certificate_revocation_lists_sync.py deleted file mode 100644 index 0a6efa7..0000000 --- a/owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_list_certificate_revocation_lists_sync.py +++ /dev/null @@ -1,53 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for ListCertificateRevocationLists -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-private-ca - - -# [START privateca_v1_generated_CertificateAuthorityService_ListCertificateRevocationLists_sync] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud.security import privateca_v1 - - -def sample_list_certificate_revocation_lists(): - # Create a client - client = privateca_v1.CertificateAuthorityServiceClient() - - # Initialize request argument(s) - request = privateca_v1.ListCertificateRevocationListsRequest( - parent="parent_value", - ) - - # Make the request - page_result = client.list_certificate_revocation_lists(request=request) - - # Handle the response - for response in page_result: - print(response) - -# [END privateca_v1_generated_CertificateAuthorityService_ListCertificateRevocationLists_sync] diff --git a/owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_list_certificate_templates_async.py b/owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_list_certificate_templates_async.py deleted file mode 100644 index 831eb0a..0000000 --- a/owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_list_certificate_templates_async.py +++ /dev/null @@ -1,53 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for ListCertificateTemplates -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-private-ca - - -# [START privateca_v1_generated_CertificateAuthorityService_ListCertificateTemplates_async] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud.security import privateca_v1 - - -async def sample_list_certificate_templates(): - # Create a client - client = privateca_v1.CertificateAuthorityServiceAsyncClient() - - # Initialize request argument(s) - request = privateca_v1.ListCertificateTemplatesRequest( - parent="parent_value", - ) - - # Make the request - page_result = client.list_certificate_templates(request=request) - - # Handle the response - async for response in page_result: - print(response) - -# [END privateca_v1_generated_CertificateAuthorityService_ListCertificateTemplates_async] diff --git a/owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_list_certificate_templates_sync.py b/owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_list_certificate_templates_sync.py deleted file mode 100644 index 50a9277..0000000 --- a/owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_list_certificate_templates_sync.py +++ /dev/null @@ -1,53 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for ListCertificateTemplates -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-private-ca - - -# [START privateca_v1_generated_CertificateAuthorityService_ListCertificateTemplates_sync] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud.security import privateca_v1 - - -def sample_list_certificate_templates(): - # Create a client - client = privateca_v1.CertificateAuthorityServiceClient() - - # Initialize request argument(s) - request = privateca_v1.ListCertificateTemplatesRequest( - parent="parent_value", - ) - - # Make the request - page_result = client.list_certificate_templates(request=request) - - # Handle the response - for response in page_result: - print(response) - -# [END privateca_v1_generated_CertificateAuthorityService_ListCertificateTemplates_sync] diff --git a/owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_list_certificates_async.py b/owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_list_certificates_async.py deleted file mode 100644 index 3f5ce09..0000000 --- a/owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_list_certificates_async.py +++ /dev/null @@ -1,53 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for ListCertificates -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-private-ca - - -# [START privateca_v1_generated_CertificateAuthorityService_ListCertificates_async] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud.security import privateca_v1 - - -async def sample_list_certificates(): - # Create a client - client = privateca_v1.CertificateAuthorityServiceAsyncClient() - - # Initialize request argument(s) - request = privateca_v1.ListCertificatesRequest( - parent="parent_value", - ) - - # Make the request - page_result = client.list_certificates(request=request) - - # Handle the response - async for response in page_result: - print(response) - -# [END privateca_v1_generated_CertificateAuthorityService_ListCertificates_async] diff --git a/owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_list_certificates_sync.py b/owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_list_certificates_sync.py deleted file mode 100644 index 9048d80..0000000 --- a/owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_list_certificates_sync.py +++ /dev/null @@ -1,53 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for ListCertificates -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-private-ca - - -# [START privateca_v1_generated_CertificateAuthorityService_ListCertificates_sync] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud.security import privateca_v1 - - -def sample_list_certificates(): - # Create a client - client = privateca_v1.CertificateAuthorityServiceClient() - - # Initialize request argument(s) - request = privateca_v1.ListCertificatesRequest( - parent="parent_value", - ) - - # Make the request - page_result = client.list_certificates(request=request) - - # Handle the response - for response in page_result: - print(response) - -# [END privateca_v1_generated_CertificateAuthorityService_ListCertificates_sync] diff --git a/owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_revoke_certificate_async.py b/owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_revoke_certificate_async.py deleted file mode 100644 index a75a4e0..0000000 --- a/owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_revoke_certificate_async.py +++ /dev/null @@ -1,53 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for RevokeCertificate -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-private-ca - - -# [START privateca_v1_generated_CertificateAuthorityService_RevokeCertificate_async] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud.security import privateca_v1 - - -async def sample_revoke_certificate(): - # Create a client - client = privateca_v1.CertificateAuthorityServiceAsyncClient() - - # Initialize request argument(s) - request = privateca_v1.RevokeCertificateRequest( - name="name_value", - reason="ATTRIBUTE_AUTHORITY_COMPROMISE", - ) - - # Make the request - response = await client.revoke_certificate(request=request) - - # Handle the response - print(response) - -# [END privateca_v1_generated_CertificateAuthorityService_RevokeCertificate_async] diff --git a/owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_revoke_certificate_sync.py b/owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_revoke_certificate_sync.py deleted file mode 100644 index b65e819..0000000 --- a/owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_revoke_certificate_sync.py +++ /dev/null @@ -1,53 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for RevokeCertificate -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-private-ca - - -# [START privateca_v1_generated_CertificateAuthorityService_RevokeCertificate_sync] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud.security import privateca_v1 - - -def sample_revoke_certificate(): - # Create a client - client = privateca_v1.CertificateAuthorityServiceClient() - - # Initialize request argument(s) - request = privateca_v1.RevokeCertificateRequest( - name="name_value", - reason="ATTRIBUTE_AUTHORITY_COMPROMISE", - ) - - # Make the request - response = client.revoke_certificate(request=request) - - # Handle the response - print(response) - -# [END privateca_v1_generated_CertificateAuthorityService_RevokeCertificate_sync] diff --git a/owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_undelete_certificate_authority_async.py b/owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_undelete_certificate_authority_async.py deleted file mode 100644 index 2152997..0000000 --- a/owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_undelete_certificate_authority_async.py +++ /dev/null @@ -1,56 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for UndeleteCertificateAuthority -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-private-ca - - -# [START privateca_v1_generated_CertificateAuthorityService_UndeleteCertificateAuthority_async] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud.security import privateca_v1 - - -async def sample_undelete_certificate_authority(): - # Create a client - client = privateca_v1.CertificateAuthorityServiceAsyncClient() - - # Initialize request argument(s) - request = privateca_v1.UndeleteCertificateAuthorityRequest( - name="name_value", - ) - - # Make the request - operation = client.undelete_certificate_authority(request=request) - - print("Waiting for operation to complete...") - - response = (await operation).result() - - # Handle the response - print(response) - -# [END privateca_v1_generated_CertificateAuthorityService_UndeleteCertificateAuthority_async] diff --git a/owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_undelete_certificate_authority_sync.py b/owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_undelete_certificate_authority_sync.py deleted file mode 100644 index 640c77b..0000000 --- a/owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_undelete_certificate_authority_sync.py +++ /dev/null @@ -1,56 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for UndeleteCertificateAuthority -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-private-ca - - -# [START privateca_v1_generated_CertificateAuthorityService_UndeleteCertificateAuthority_sync] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud.security import privateca_v1 - - -def sample_undelete_certificate_authority(): - # Create a client - client = privateca_v1.CertificateAuthorityServiceClient() - - # Initialize request argument(s) - request = privateca_v1.UndeleteCertificateAuthorityRequest( - name="name_value", - ) - - # Make the request - operation = client.undelete_certificate_authority(request=request) - - print("Waiting for operation to complete...") - - response = operation.result() - - # Handle the response - print(response) - -# [END privateca_v1_generated_CertificateAuthorityService_UndeleteCertificateAuthority_sync] diff --git a/owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_update_ca_pool_async.py b/owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_update_ca_pool_async.py deleted file mode 100644 index e8995ba..0000000 --- a/owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_update_ca_pool_async.py +++ /dev/null @@ -1,59 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for UpdateCaPool -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-private-ca - - -# [START privateca_v1_generated_CertificateAuthorityService_UpdateCaPool_async] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud.security import privateca_v1 - - -async def sample_update_ca_pool(): - # Create a client - client = privateca_v1.CertificateAuthorityServiceAsyncClient() - - # Initialize request argument(s) - ca_pool = privateca_v1.CaPool() - ca_pool.tier = "DEVOPS" - - request = privateca_v1.UpdateCaPoolRequest( - ca_pool=ca_pool, - ) - - # Make the request - operation = client.update_ca_pool(request=request) - - print("Waiting for operation to complete...") - - response = (await operation).result() - - # Handle the response - print(response) - -# [END privateca_v1_generated_CertificateAuthorityService_UpdateCaPool_async] diff --git a/owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_update_ca_pool_sync.py b/owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_update_ca_pool_sync.py deleted file mode 100644 index 278831e..0000000 --- a/owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_update_ca_pool_sync.py +++ /dev/null @@ -1,59 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for UpdateCaPool -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-private-ca - - -# [START privateca_v1_generated_CertificateAuthorityService_UpdateCaPool_sync] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud.security import privateca_v1 - - -def sample_update_ca_pool(): - # Create a client - client = privateca_v1.CertificateAuthorityServiceClient() - - # Initialize request argument(s) - ca_pool = privateca_v1.CaPool() - ca_pool.tier = "DEVOPS" - - request = privateca_v1.UpdateCaPoolRequest( - ca_pool=ca_pool, - ) - - # Make the request - operation = client.update_ca_pool(request=request) - - print("Waiting for operation to complete...") - - response = operation.result() - - # Handle the response - print(response) - -# [END privateca_v1_generated_CertificateAuthorityService_UpdateCaPool_sync] diff --git a/owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_update_certificate_async.py b/owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_update_certificate_async.py deleted file mode 100644 index 251865f..0000000 --- a/owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_update_certificate_async.py +++ /dev/null @@ -1,55 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for UpdateCertificate -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-private-ca - - -# [START privateca_v1_generated_CertificateAuthorityService_UpdateCertificate_async] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud.security import privateca_v1 - - -async def sample_update_certificate(): - # Create a client - client = privateca_v1.CertificateAuthorityServiceAsyncClient() - - # Initialize request argument(s) - certificate = privateca_v1.Certificate() - certificate.pem_csr = "pem_csr_value" - - request = privateca_v1.UpdateCertificateRequest( - certificate=certificate, - ) - - # Make the request - response = await client.update_certificate(request=request) - - # Handle the response - print(response) - -# [END privateca_v1_generated_CertificateAuthorityService_UpdateCertificate_async] diff --git a/owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_update_certificate_authority_async.py b/owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_update_certificate_authority_async.py deleted file mode 100644 index c5fc602..0000000 --- a/owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_update_certificate_authority_async.py +++ /dev/null @@ -1,60 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for UpdateCertificateAuthority -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-private-ca - - -# [START privateca_v1_generated_CertificateAuthorityService_UpdateCertificateAuthority_async] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud.security import privateca_v1 - - -async def sample_update_certificate_authority(): - # Create a client - client = privateca_v1.CertificateAuthorityServiceAsyncClient() - - # Initialize request argument(s) - certificate_authority = privateca_v1.CertificateAuthority() - certificate_authority.type_ = "SUBORDINATE" - certificate_authority.key_spec.cloud_kms_key_version = "cloud_kms_key_version_value" - - request = privateca_v1.UpdateCertificateAuthorityRequest( - certificate_authority=certificate_authority, - ) - - # Make the request - operation = client.update_certificate_authority(request=request) - - print("Waiting for operation to complete...") - - response = (await operation).result() - - # Handle the response - print(response) - -# [END privateca_v1_generated_CertificateAuthorityService_UpdateCertificateAuthority_async] diff --git a/owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_update_certificate_authority_sync.py b/owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_update_certificate_authority_sync.py deleted file mode 100644 index cbd3b8d..0000000 --- a/owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_update_certificate_authority_sync.py +++ /dev/null @@ -1,60 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for UpdateCertificateAuthority -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-private-ca - - -# [START privateca_v1_generated_CertificateAuthorityService_UpdateCertificateAuthority_sync] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud.security import privateca_v1 - - -def sample_update_certificate_authority(): - # Create a client - client = privateca_v1.CertificateAuthorityServiceClient() - - # Initialize request argument(s) - certificate_authority = privateca_v1.CertificateAuthority() - certificate_authority.type_ = "SUBORDINATE" - certificate_authority.key_spec.cloud_kms_key_version = "cloud_kms_key_version_value" - - request = privateca_v1.UpdateCertificateAuthorityRequest( - certificate_authority=certificate_authority, - ) - - # Make the request - operation = client.update_certificate_authority(request=request) - - print("Waiting for operation to complete...") - - response = operation.result() - - # Handle the response - print(response) - -# [END privateca_v1_generated_CertificateAuthorityService_UpdateCertificateAuthority_sync] diff --git a/owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_update_certificate_revocation_list_async.py b/owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_update_certificate_revocation_list_async.py deleted file mode 100644 index a422713..0000000 --- a/owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_update_certificate_revocation_list_async.py +++ /dev/null @@ -1,55 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for UpdateCertificateRevocationList -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-private-ca - - -# [START privateca_v1_generated_CertificateAuthorityService_UpdateCertificateRevocationList_async] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud.security import privateca_v1 - - -async def sample_update_certificate_revocation_list(): - # Create a client - client = privateca_v1.CertificateAuthorityServiceAsyncClient() - - # Initialize request argument(s) - request = privateca_v1.UpdateCertificateRevocationListRequest( - ) - - # Make the request - operation = client.update_certificate_revocation_list(request=request) - - print("Waiting for operation to complete...") - - response = (await operation).result() - - # Handle the response - print(response) - -# [END privateca_v1_generated_CertificateAuthorityService_UpdateCertificateRevocationList_async] diff --git a/owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_update_certificate_revocation_list_sync.py b/owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_update_certificate_revocation_list_sync.py deleted file mode 100644 index e29909e..0000000 --- a/owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_update_certificate_revocation_list_sync.py +++ /dev/null @@ -1,55 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for UpdateCertificateRevocationList -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-private-ca - - -# [START privateca_v1_generated_CertificateAuthorityService_UpdateCertificateRevocationList_sync] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud.security import privateca_v1 - - -def sample_update_certificate_revocation_list(): - # Create a client - client = privateca_v1.CertificateAuthorityServiceClient() - - # Initialize request argument(s) - request = privateca_v1.UpdateCertificateRevocationListRequest( - ) - - # Make the request - operation = client.update_certificate_revocation_list(request=request) - - print("Waiting for operation to complete...") - - response = operation.result() - - # Handle the response - print(response) - -# [END privateca_v1_generated_CertificateAuthorityService_UpdateCertificateRevocationList_sync] diff --git a/owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_update_certificate_sync.py b/owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_update_certificate_sync.py deleted file mode 100644 index 2f4ad51..0000000 --- a/owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_update_certificate_sync.py +++ /dev/null @@ -1,55 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for UpdateCertificate -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-private-ca - - -# [START privateca_v1_generated_CertificateAuthorityService_UpdateCertificate_sync] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud.security import privateca_v1 - - -def sample_update_certificate(): - # Create a client - client = privateca_v1.CertificateAuthorityServiceClient() - - # Initialize request argument(s) - certificate = privateca_v1.Certificate() - certificate.pem_csr = "pem_csr_value" - - request = privateca_v1.UpdateCertificateRequest( - certificate=certificate, - ) - - # Make the request - response = client.update_certificate(request=request) - - # Handle the response - print(response) - -# [END privateca_v1_generated_CertificateAuthorityService_UpdateCertificate_sync] diff --git a/owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_update_certificate_template_async.py b/owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_update_certificate_template_async.py deleted file mode 100644 index adb35a9..0000000 --- a/owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_update_certificate_template_async.py +++ /dev/null @@ -1,55 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for UpdateCertificateTemplate -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-private-ca - - -# [START privateca_v1_generated_CertificateAuthorityService_UpdateCertificateTemplate_async] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud.security import privateca_v1 - - -async def sample_update_certificate_template(): - # Create a client - client = privateca_v1.CertificateAuthorityServiceAsyncClient() - - # Initialize request argument(s) - request = privateca_v1.UpdateCertificateTemplateRequest( - ) - - # Make the request - operation = client.update_certificate_template(request=request) - - print("Waiting for operation to complete...") - - response = (await operation).result() - - # Handle the response - print(response) - -# [END privateca_v1_generated_CertificateAuthorityService_UpdateCertificateTemplate_async] diff --git a/owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_update_certificate_template_sync.py b/owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_update_certificate_template_sync.py deleted file mode 100644 index 3a6fd82..0000000 --- a/owl-bot-staging/v1/samples/generated_samples/privateca_v1_generated_certificate_authority_service_update_certificate_template_sync.py +++ /dev/null @@ -1,55 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for UpdateCertificateTemplate -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-private-ca - - -# [START privateca_v1_generated_CertificateAuthorityService_UpdateCertificateTemplate_sync] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud.security import privateca_v1 - - -def sample_update_certificate_template(): - # Create a client - client = privateca_v1.CertificateAuthorityServiceClient() - - # Initialize request argument(s) - request = privateca_v1.UpdateCertificateTemplateRequest( - ) - - # Make the request - operation = client.update_certificate_template(request=request) - - print("Waiting for operation to complete...") - - response = operation.result() - - # Handle the response - print(response) - -# [END privateca_v1_generated_CertificateAuthorityService_UpdateCertificateTemplate_sync] diff --git a/owl-bot-staging/v1/samples/generated_samples/snippet_metadata_google.cloud.security.privateca.v1.json b/owl-bot-staging/v1/samples/generated_samples/snippet_metadata_google.cloud.security.privateca.v1.json deleted file mode 100644 index 2ae53b3..0000000 --- a/owl-bot-staging/v1/samples/generated_samples/snippet_metadata_google.cloud.security.privateca.v1.json +++ /dev/null @@ -1,4788 +0,0 @@ -{ - "clientLibrary": { - "apis": [ - { - "id": "google.cloud.security.privateca.v1", - "version": "v1" - } - ], - "language": "PYTHON", - "name": "google-cloud-private-ca", - "version": "0.1.0" - }, - "snippets": [ - { - "canonical": true, - "clientMethod": { - "async": true, - "client": { - "fullName": "google.cloud.security.privateca_v1.CertificateAuthorityServiceAsyncClient", - "shortName": "CertificateAuthorityServiceAsyncClient" - }, - "fullName": "google.cloud.security.privateca_v1.CertificateAuthorityServiceAsyncClient.activate_certificate_authority", - "method": { - "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService.ActivateCertificateAuthority", - "service": { - "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService", - "shortName": "CertificateAuthorityService" - }, - "shortName": "ActivateCertificateAuthority" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.security.privateca_v1.types.ActivateCertificateAuthorityRequest" - }, - { - "name": "name", - "type": "str" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.api_core.operation_async.AsyncOperation", - "shortName": "activate_certificate_authority" - }, - "description": "Sample for ActivateCertificateAuthority", - "file": "privateca_v1_generated_certificate_authority_service_activate_certificate_authority_async.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "privateca_v1_generated_CertificateAuthorityService_ActivateCertificateAuthority_async", - "segments": [ - { - "end": 60, - "start": 27, - "type": "FULL" - }, - { - "end": 60, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 50, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 57, - "start": 51, - "type": "REQUEST_EXECUTION" - }, - { - "end": 61, - "start": 58, - "type": "RESPONSE_HANDLING" - } - ], - "title": "privateca_v1_generated_certificate_authority_service_activate_certificate_authority_async.py" - }, - { - "canonical": true, - "clientMethod": { - "client": { - "fullName": "google.cloud.security.privateca_v1.CertificateAuthorityServiceClient", - "shortName": "CertificateAuthorityServiceClient" - }, - "fullName": "google.cloud.security.privateca_v1.CertificateAuthorityServiceClient.activate_certificate_authority", - "method": { - "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService.ActivateCertificateAuthority", - "service": { - "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService", - "shortName": "CertificateAuthorityService" - }, - "shortName": "ActivateCertificateAuthority" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.security.privateca_v1.types.ActivateCertificateAuthorityRequest" - }, - { - "name": "name", - "type": "str" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.api_core.operation.Operation", - "shortName": "activate_certificate_authority" - }, - "description": "Sample for ActivateCertificateAuthority", - "file": "privateca_v1_generated_certificate_authority_service_activate_certificate_authority_sync.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "privateca_v1_generated_CertificateAuthorityService_ActivateCertificateAuthority_sync", - "segments": [ - { - "end": 60, - "start": 27, - "type": "FULL" - }, - { - "end": 60, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 50, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 57, - "start": 51, - "type": "REQUEST_EXECUTION" - }, - { - "end": 61, - "start": 58, - "type": "RESPONSE_HANDLING" - } - ], - "title": "privateca_v1_generated_certificate_authority_service_activate_certificate_authority_sync.py" - }, - { - "canonical": true, - "clientMethod": { - "async": true, - "client": { - "fullName": "google.cloud.security.privateca_v1.CertificateAuthorityServiceAsyncClient", - "shortName": "CertificateAuthorityServiceAsyncClient" - }, - "fullName": "google.cloud.security.privateca_v1.CertificateAuthorityServiceAsyncClient.create_ca_pool", - "method": { - "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService.CreateCaPool", - "service": { - "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService", - "shortName": "CertificateAuthorityService" - }, - "shortName": "CreateCaPool" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.security.privateca_v1.types.CreateCaPoolRequest" - }, - { - "name": "parent", - "type": "str" - }, - { - "name": "ca_pool", - "type": "google.cloud.security.privateca_v1.types.CaPool" - }, - { - "name": "ca_pool_id", - "type": "str" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.api_core.operation_async.AsyncOperation", - "shortName": "create_ca_pool" - }, - "description": "Sample for CreateCaPool", - "file": "privateca_v1_generated_certificate_authority_service_create_ca_pool_async.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "privateca_v1_generated_CertificateAuthorityService_CreateCaPool_async", - "segments": [ - { - "end": 60, - "start": 27, - "type": "FULL" - }, - { - "end": 60, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 50, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 57, - "start": 51, - "type": "REQUEST_EXECUTION" - }, - { - "end": 61, - "start": 58, - "type": "RESPONSE_HANDLING" - } - ], - "title": "privateca_v1_generated_certificate_authority_service_create_ca_pool_async.py" - }, - { - "canonical": true, - "clientMethod": { - "client": { - "fullName": "google.cloud.security.privateca_v1.CertificateAuthorityServiceClient", - "shortName": "CertificateAuthorityServiceClient" - }, - "fullName": "google.cloud.security.privateca_v1.CertificateAuthorityServiceClient.create_ca_pool", - "method": { - "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService.CreateCaPool", - "service": { - "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService", - "shortName": "CertificateAuthorityService" - }, - "shortName": "CreateCaPool" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.security.privateca_v1.types.CreateCaPoolRequest" - }, - { - "name": "parent", - "type": "str" - }, - { - "name": "ca_pool", - "type": "google.cloud.security.privateca_v1.types.CaPool" - }, - { - "name": "ca_pool_id", - "type": "str" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.api_core.operation.Operation", - "shortName": "create_ca_pool" - }, - "description": "Sample for CreateCaPool", - "file": "privateca_v1_generated_certificate_authority_service_create_ca_pool_sync.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "privateca_v1_generated_CertificateAuthorityService_CreateCaPool_sync", - "segments": [ - { - "end": 60, - "start": 27, - "type": "FULL" - }, - { - "end": 60, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 50, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 57, - "start": 51, - "type": "REQUEST_EXECUTION" - }, - { - "end": 61, - "start": 58, - "type": "RESPONSE_HANDLING" - } - ], - "title": "privateca_v1_generated_certificate_authority_service_create_ca_pool_sync.py" - }, - { - "canonical": true, - "clientMethod": { - "async": true, - "client": { - "fullName": "google.cloud.security.privateca_v1.CertificateAuthorityServiceAsyncClient", - "shortName": "CertificateAuthorityServiceAsyncClient" - }, - "fullName": "google.cloud.security.privateca_v1.CertificateAuthorityServiceAsyncClient.create_certificate_authority", - "method": { - "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService.CreateCertificateAuthority", - "service": { - "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService", - "shortName": "CertificateAuthorityService" - }, - "shortName": "CreateCertificateAuthority" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.security.privateca_v1.types.CreateCertificateAuthorityRequest" - }, - { - "name": "parent", - "type": "str" - }, - { - "name": "certificate_authority", - "type": "google.cloud.security.privateca_v1.types.CertificateAuthority" - }, - { - "name": "certificate_authority_id", - "type": "str" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.api_core.operation_async.AsyncOperation", - "shortName": "create_certificate_authority" - }, - "description": "Sample for CreateCertificateAuthority", - "file": "privateca_v1_generated_certificate_authority_service_create_certificate_authority_async.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "privateca_v1_generated_CertificateAuthorityService_CreateCertificateAuthority_async", - "segments": [ - { - "end": 61, - "start": 27, - "type": "FULL" - }, - { - "end": 61, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 51, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 58, - "start": 52, - "type": "REQUEST_EXECUTION" - }, - { - "end": 62, - "start": 59, - "type": "RESPONSE_HANDLING" - } - ], - "title": "privateca_v1_generated_certificate_authority_service_create_certificate_authority_async.py" - }, - { - "canonical": true, - "clientMethod": { - "client": { - "fullName": "google.cloud.security.privateca_v1.CertificateAuthorityServiceClient", - "shortName": "CertificateAuthorityServiceClient" - }, - "fullName": "google.cloud.security.privateca_v1.CertificateAuthorityServiceClient.create_certificate_authority", - "method": { - "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService.CreateCertificateAuthority", - "service": { - "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService", - "shortName": "CertificateAuthorityService" - }, - "shortName": "CreateCertificateAuthority" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.security.privateca_v1.types.CreateCertificateAuthorityRequest" - }, - { - "name": "parent", - "type": "str" - }, - { - "name": "certificate_authority", - "type": "google.cloud.security.privateca_v1.types.CertificateAuthority" - }, - { - "name": "certificate_authority_id", - "type": "str" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.api_core.operation.Operation", - "shortName": "create_certificate_authority" - }, - "description": "Sample for CreateCertificateAuthority", - "file": "privateca_v1_generated_certificate_authority_service_create_certificate_authority_sync.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "privateca_v1_generated_CertificateAuthorityService_CreateCertificateAuthority_sync", - "segments": [ - { - "end": 61, - "start": 27, - "type": "FULL" - }, - { - "end": 61, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 51, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 58, - "start": 52, - "type": "REQUEST_EXECUTION" - }, - { - "end": 62, - "start": 59, - "type": "RESPONSE_HANDLING" - } - ], - "title": "privateca_v1_generated_certificate_authority_service_create_certificate_authority_sync.py" - }, - { - "canonical": true, - "clientMethod": { - "async": true, - "client": { - "fullName": "google.cloud.security.privateca_v1.CertificateAuthorityServiceAsyncClient", - "shortName": "CertificateAuthorityServiceAsyncClient" - }, - "fullName": "google.cloud.security.privateca_v1.CertificateAuthorityServiceAsyncClient.create_certificate_template", - "method": { - "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService.CreateCertificateTemplate", - "service": { - "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService", - "shortName": "CertificateAuthorityService" - }, - "shortName": "CreateCertificateTemplate" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.security.privateca_v1.types.CreateCertificateTemplateRequest" - }, - { - "name": "parent", - "type": "str" - }, - { - "name": "certificate_template", - "type": "google.cloud.security.privateca_v1.types.CertificateTemplate" - }, - { - "name": "certificate_template_id", - "type": "str" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.api_core.operation_async.AsyncOperation", - "shortName": "create_certificate_template" - }, - "description": "Sample for CreateCertificateTemplate", - "file": "privateca_v1_generated_certificate_authority_service_create_certificate_template_async.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "privateca_v1_generated_CertificateAuthorityService_CreateCertificateTemplate_async", - "segments": [ - { - "end": 56, - "start": 27, - "type": "FULL" - }, - { - "end": 56, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 46, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 53, - "start": 47, - "type": "REQUEST_EXECUTION" - }, - { - "end": 57, - "start": 54, - "type": "RESPONSE_HANDLING" - } - ], - "title": "privateca_v1_generated_certificate_authority_service_create_certificate_template_async.py" - }, - { - "canonical": true, - "clientMethod": { - "client": { - "fullName": "google.cloud.security.privateca_v1.CertificateAuthorityServiceClient", - "shortName": "CertificateAuthorityServiceClient" - }, - "fullName": "google.cloud.security.privateca_v1.CertificateAuthorityServiceClient.create_certificate_template", - "method": { - "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService.CreateCertificateTemplate", - "service": { - "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService", - "shortName": "CertificateAuthorityService" - }, - "shortName": "CreateCertificateTemplate" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.security.privateca_v1.types.CreateCertificateTemplateRequest" - }, - { - "name": "parent", - "type": "str" - }, - { - "name": "certificate_template", - "type": "google.cloud.security.privateca_v1.types.CertificateTemplate" - }, - { - "name": "certificate_template_id", - "type": "str" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.api_core.operation.Operation", - "shortName": "create_certificate_template" - }, - "description": "Sample for CreateCertificateTemplate", - "file": "privateca_v1_generated_certificate_authority_service_create_certificate_template_sync.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "privateca_v1_generated_CertificateAuthorityService_CreateCertificateTemplate_sync", - "segments": [ - { - "end": 56, - "start": 27, - "type": "FULL" - }, - { - "end": 56, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 46, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 53, - "start": 47, - "type": "REQUEST_EXECUTION" - }, - { - "end": 57, - "start": 54, - "type": "RESPONSE_HANDLING" - } - ], - "title": "privateca_v1_generated_certificate_authority_service_create_certificate_template_sync.py" - }, - { - "canonical": true, - "clientMethod": { - "async": true, - "client": { - "fullName": "google.cloud.security.privateca_v1.CertificateAuthorityServiceAsyncClient", - "shortName": "CertificateAuthorityServiceAsyncClient" - }, - "fullName": "google.cloud.security.privateca_v1.CertificateAuthorityServiceAsyncClient.create_certificate", - "method": { - "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService.CreateCertificate", - "service": { - "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService", - "shortName": "CertificateAuthorityService" - }, - "shortName": "CreateCertificate" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.security.privateca_v1.types.CreateCertificateRequest" - }, - { - "name": "parent", - "type": "str" - }, - { - "name": "certificate", - "type": "google.cloud.security.privateca_v1.types.Certificate" - }, - { - "name": "certificate_id", - "type": "str" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.cloud.security.privateca_v1.types.Certificate", - "shortName": "create_certificate" - }, - "description": "Sample for CreateCertificate", - "file": "privateca_v1_generated_certificate_authority_service_create_certificate_async.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "privateca_v1_generated_CertificateAuthorityService_CreateCertificate_async", - "segments": [ - { - "end": 55, - "start": 27, - "type": "FULL" - }, - { - "end": 55, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 49, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 52, - "start": 50, - "type": "REQUEST_EXECUTION" - }, - { - "end": 56, - "start": 53, - "type": "RESPONSE_HANDLING" - } - ], - "title": "privateca_v1_generated_certificate_authority_service_create_certificate_async.py" - }, - { - "canonical": true, - "clientMethod": { - "client": { - "fullName": "google.cloud.security.privateca_v1.CertificateAuthorityServiceClient", - "shortName": "CertificateAuthorityServiceClient" - }, - "fullName": "google.cloud.security.privateca_v1.CertificateAuthorityServiceClient.create_certificate", - "method": { - "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService.CreateCertificate", - "service": { - "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService", - "shortName": "CertificateAuthorityService" - }, - "shortName": "CreateCertificate" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.security.privateca_v1.types.CreateCertificateRequest" - }, - { - "name": "parent", - "type": "str" - }, - { - "name": "certificate", - "type": "google.cloud.security.privateca_v1.types.Certificate" - }, - { - "name": "certificate_id", - "type": "str" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.cloud.security.privateca_v1.types.Certificate", - "shortName": "create_certificate" - }, - "description": "Sample for CreateCertificate", - "file": "privateca_v1_generated_certificate_authority_service_create_certificate_sync.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "privateca_v1_generated_CertificateAuthorityService_CreateCertificate_sync", - "segments": [ - { - "end": 55, - "start": 27, - "type": "FULL" - }, - { - "end": 55, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 49, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 52, - "start": 50, - "type": "REQUEST_EXECUTION" - }, - { - "end": 56, - "start": 53, - "type": "RESPONSE_HANDLING" - } - ], - "title": "privateca_v1_generated_certificate_authority_service_create_certificate_sync.py" - }, - { - "canonical": true, - "clientMethod": { - "async": true, - "client": { - "fullName": "google.cloud.security.privateca_v1.CertificateAuthorityServiceAsyncClient", - "shortName": "CertificateAuthorityServiceAsyncClient" - }, - "fullName": "google.cloud.security.privateca_v1.CertificateAuthorityServiceAsyncClient.delete_ca_pool", - "method": { - "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService.DeleteCaPool", - "service": { - "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService", - "shortName": "CertificateAuthorityService" - }, - "shortName": "DeleteCaPool" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.security.privateca_v1.types.DeleteCaPoolRequest" - }, - { - "name": "name", - "type": "str" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.api_core.operation_async.AsyncOperation", - "shortName": "delete_ca_pool" - }, - "description": "Sample for DeleteCaPool", - "file": "privateca_v1_generated_certificate_authority_service_delete_ca_pool_async.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "privateca_v1_generated_CertificateAuthorityService_DeleteCaPool_async", - "segments": [ - { - "end": 55, - "start": 27, - "type": "FULL" - }, - { - "end": 55, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 45, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 52, - "start": 46, - "type": "REQUEST_EXECUTION" - }, - { - "end": 56, - "start": 53, - "type": "RESPONSE_HANDLING" - } - ], - "title": "privateca_v1_generated_certificate_authority_service_delete_ca_pool_async.py" - }, - { - "canonical": true, - "clientMethod": { - "client": { - "fullName": "google.cloud.security.privateca_v1.CertificateAuthorityServiceClient", - "shortName": "CertificateAuthorityServiceClient" - }, - "fullName": "google.cloud.security.privateca_v1.CertificateAuthorityServiceClient.delete_ca_pool", - "method": { - "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService.DeleteCaPool", - "service": { - "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService", - "shortName": "CertificateAuthorityService" - }, - "shortName": "DeleteCaPool" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.security.privateca_v1.types.DeleteCaPoolRequest" - }, - { - "name": "name", - "type": "str" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.api_core.operation.Operation", - "shortName": "delete_ca_pool" - }, - "description": "Sample for DeleteCaPool", - "file": "privateca_v1_generated_certificate_authority_service_delete_ca_pool_sync.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "privateca_v1_generated_CertificateAuthorityService_DeleteCaPool_sync", - "segments": [ - { - "end": 55, - "start": 27, - "type": "FULL" - }, - { - "end": 55, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 45, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 52, - "start": 46, - "type": "REQUEST_EXECUTION" - }, - { - "end": 56, - "start": 53, - "type": "RESPONSE_HANDLING" - } - ], - "title": "privateca_v1_generated_certificate_authority_service_delete_ca_pool_sync.py" - }, - { - "canonical": true, - "clientMethod": { - "async": true, - "client": { - "fullName": "google.cloud.security.privateca_v1.CertificateAuthorityServiceAsyncClient", - "shortName": "CertificateAuthorityServiceAsyncClient" - }, - "fullName": "google.cloud.security.privateca_v1.CertificateAuthorityServiceAsyncClient.delete_certificate_authority", - "method": { - "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService.DeleteCertificateAuthority", - "service": { - "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService", - "shortName": "CertificateAuthorityService" - }, - "shortName": "DeleteCertificateAuthority" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.security.privateca_v1.types.DeleteCertificateAuthorityRequest" - }, - { - "name": "name", - "type": "str" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.api_core.operation_async.AsyncOperation", - "shortName": "delete_certificate_authority" - }, - "description": "Sample for DeleteCertificateAuthority", - "file": "privateca_v1_generated_certificate_authority_service_delete_certificate_authority_async.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "privateca_v1_generated_CertificateAuthorityService_DeleteCertificateAuthority_async", - "segments": [ - { - "end": 55, - "start": 27, - "type": "FULL" - }, - { - "end": 55, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 45, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 52, - "start": 46, - "type": "REQUEST_EXECUTION" - }, - { - "end": 56, - "start": 53, - "type": "RESPONSE_HANDLING" - } - ], - "title": "privateca_v1_generated_certificate_authority_service_delete_certificate_authority_async.py" - }, - { - "canonical": true, - "clientMethod": { - "client": { - "fullName": "google.cloud.security.privateca_v1.CertificateAuthorityServiceClient", - "shortName": "CertificateAuthorityServiceClient" - }, - "fullName": "google.cloud.security.privateca_v1.CertificateAuthorityServiceClient.delete_certificate_authority", - "method": { - "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService.DeleteCertificateAuthority", - "service": { - "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService", - "shortName": "CertificateAuthorityService" - }, - "shortName": "DeleteCertificateAuthority" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.security.privateca_v1.types.DeleteCertificateAuthorityRequest" - }, - { - "name": "name", - "type": "str" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.api_core.operation.Operation", - "shortName": "delete_certificate_authority" - }, - "description": "Sample for DeleteCertificateAuthority", - "file": "privateca_v1_generated_certificate_authority_service_delete_certificate_authority_sync.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "privateca_v1_generated_CertificateAuthorityService_DeleteCertificateAuthority_sync", - "segments": [ - { - "end": 55, - "start": 27, - "type": "FULL" - }, - { - "end": 55, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 45, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 52, - "start": 46, - "type": "REQUEST_EXECUTION" - }, - { - "end": 56, - "start": 53, - "type": "RESPONSE_HANDLING" - } - ], - "title": "privateca_v1_generated_certificate_authority_service_delete_certificate_authority_sync.py" - }, - { - "canonical": true, - "clientMethod": { - "async": true, - "client": { - "fullName": "google.cloud.security.privateca_v1.CertificateAuthorityServiceAsyncClient", - "shortName": "CertificateAuthorityServiceAsyncClient" - }, - "fullName": "google.cloud.security.privateca_v1.CertificateAuthorityServiceAsyncClient.delete_certificate_template", - "method": { - "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService.DeleteCertificateTemplate", - "service": { - "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService", - "shortName": "CertificateAuthorityService" - }, - "shortName": "DeleteCertificateTemplate" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.security.privateca_v1.types.DeleteCertificateTemplateRequest" - }, - { - "name": "name", - "type": "str" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.api_core.operation_async.AsyncOperation", - "shortName": "delete_certificate_template" - }, - "description": "Sample for DeleteCertificateTemplate", - "file": "privateca_v1_generated_certificate_authority_service_delete_certificate_template_async.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "privateca_v1_generated_CertificateAuthorityService_DeleteCertificateTemplate_async", - "segments": [ - { - "end": 55, - "start": 27, - "type": "FULL" - }, - { - "end": 55, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 45, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 52, - "start": 46, - "type": "REQUEST_EXECUTION" - }, - { - "end": 56, - "start": 53, - "type": "RESPONSE_HANDLING" - } - ], - "title": "privateca_v1_generated_certificate_authority_service_delete_certificate_template_async.py" - }, - { - "canonical": true, - "clientMethod": { - "client": { - "fullName": "google.cloud.security.privateca_v1.CertificateAuthorityServiceClient", - "shortName": "CertificateAuthorityServiceClient" - }, - "fullName": "google.cloud.security.privateca_v1.CertificateAuthorityServiceClient.delete_certificate_template", - "method": { - "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService.DeleteCertificateTemplate", - "service": { - "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService", - "shortName": "CertificateAuthorityService" - }, - "shortName": "DeleteCertificateTemplate" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.security.privateca_v1.types.DeleteCertificateTemplateRequest" - }, - { - "name": "name", - "type": "str" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.api_core.operation.Operation", - "shortName": "delete_certificate_template" - }, - "description": "Sample for DeleteCertificateTemplate", - "file": "privateca_v1_generated_certificate_authority_service_delete_certificate_template_sync.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "privateca_v1_generated_CertificateAuthorityService_DeleteCertificateTemplate_sync", - "segments": [ - { - "end": 55, - "start": 27, - "type": "FULL" - }, - { - "end": 55, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 45, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 52, - "start": 46, - "type": "REQUEST_EXECUTION" - }, - { - "end": 56, - "start": 53, - "type": "RESPONSE_HANDLING" - } - ], - "title": "privateca_v1_generated_certificate_authority_service_delete_certificate_template_sync.py" - }, - { - "canonical": true, - "clientMethod": { - "async": true, - "client": { - "fullName": "google.cloud.security.privateca_v1.CertificateAuthorityServiceAsyncClient", - "shortName": "CertificateAuthorityServiceAsyncClient" - }, - "fullName": "google.cloud.security.privateca_v1.CertificateAuthorityServiceAsyncClient.disable_certificate_authority", - "method": { - "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService.DisableCertificateAuthority", - "service": { - "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService", - "shortName": "CertificateAuthorityService" - }, - "shortName": "DisableCertificateAuthority" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.security.privateca_v1.types.DisableCertificateAuthorityRequest" - }, - { - "name": "name", - "type": "str" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.api_core.operation_async.AsyncOperation", - "shortName": "disable_certificate_authority" - }, - "description": "Sample for DisableCertificateAuthority", - "file": "privateca_v1_generated_certificate_authority_service_disable_certificate_authority_async.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "privateca_v1_generated_CertificateAuthorityService_DisableCertificateAuthority_async", - "segments": [ - { - "end": 55, - "start": 27, - "type": "FULL" - }, - { - "end": 55, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 45, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 52, - "start": 46, - "type": "REQUEST_EXECUTION" - }, - { - "end": 56, - "start": 53, - "type": "RESPONSE_HANDLING" - } - ], - "title": "privateca_v1_generated_certificate_authority_service_disable_certificate_authority_async.py" - }, - { - "canonical": true, - "clientMethod": { - "client": { - "fullName": "google.cloud.security.privateca_v1.CertificateAuthorityServiceClient", - "shortName": "CertificateAuthorityServiceClient" - }, - "fullName": "google.cloud.security.privateca_v1.CertificateAuthorityServiceClient.disable_certificate_authority", - "method": { - "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService.DisableCertificateAuthority", - "service": { - "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService", - "shortName": "CertificateAuthorityService" - }, - "shortName": "DisableCertificateAuthority" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.security.privateca_v1.types.DisableCertificateAuthorityRequest" - }, - { - "name": "name", - "type": "str" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.api_core.operation.Operation", - "shortName": "disable_certificate_authority" - }, - "description": "Sample for DisableCertificateAuthority", - "file": "privateca_v1_generated_certificate_authority_service_disable_certificate_authority_sync.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "privateca_v1_generated_CertificateAuthorityService_DisableCertificateAuthority_sync", - "segments": [ - { - "end": 55, - "start": 27, - "type": "FULL" - }, - { - "end": 55, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 45, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 52, - "start": 46, - "type": "REQUEST_EXECUTION" - }, - { - "end": 56, - "start": 53, - "type": "RESPONSE_HANDLING" - } - ], - "title": "privateca_v1_generated_certificate_authority_service_disable_certificate_authority_sync.py" - }, - { - "canonical": true, - "clientMethod": { - "async": true, - "client": { - "fullName": "google.cloud.security.privateca_v1.CertificateAuthorityServiceAsyncClient", - "shortName": "CertificateAuthorityServiceAsyncClient" - }, - "fullName": "google.cloud.security.privateca_v1.CertificateAuthorityServiceAsyncClient.enable_certificate_authority", - "method": { - "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService.EnableCertificateAuthority", - "service": { - "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService", - "shortName": "CertificateAuthorityService" - }, - "shortName": "EnableCertificateAuthority" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.security.privateca_v1.types.EnableCertificateAuthorityRequest" - }, - { - "name": "name", - "type": "str" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.api_core.operation_async.AsyncOperation", - "shortName": "enable_certificate_authority" - }, - "description": "Sample for EnableCertificateAuthority", - "file": "privateca_v1_generated_certificate_authority_service_enable_certificate_authority_async.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "privateca_v1_generated_CertificateAuthorityService_EnableCertificateAuthority_async", - "segments": [ - { - "end": 55, - "start": 27, - "type": "FULL" - }, - { - "end": 55, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 45, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 52, - "start": 46, - "type": "REQUEST_EXECUTION" - }, - { - "end": 56, - "start": 53, - "type": "RESPONSE_HANDLING" - } - ], - "title": "privateca_v1_generated_certificate_authority_service_enable_certificate_authority_async.py" - }, - { - "canonical": true, - "clientMethod": { - "client": { - "fullName": "google.cloud.security.privateca_v1.CertificateAuthorityServiceClient", - "shortName": "CertificateAuthorityServiceClient" - }, - "fullName": "google.cloud.security.privateca_v1.CertificateAuthorityServiceClient.enable_certificate_authority", - "method": { - "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService.EnableCertificateAuthority", - "service": { - "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService", - "shortName": "CertificateAuthorityService" - }, - "shortName": "EnableCertificateAuthority" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.security.privateca_v1.types.EnableCertificateAuthorityRequest" - }, - { - "name": "name", - "type": "str" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.api_core.operation.Operation", - "shortName": "enable_certificate_authority" - }, - "description": "Sample for EnableCertificateAuthority", - "file": "privateca_v1_generated_certificate_authority_service_enable_certificate_authority_sync.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "privateca_v1_generated_CertificateAuthorityService_EnableCertificateAuthority_sync", - "segments": [ - { - "end": 55, - "start": 27, - "type": "FULL" - }, - { - "end": 55, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 45, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 52, - "start": 46, - "type": "REQUEST_EXECUTION" - }, - { - "end": 56, - "start": 53, - "type": "RESPONSE_HANDLING" - } - ], - "title": "privateca_v1_generated_certificate_authority_service_enable_certificate_authority_sync.py" - }, - { - "canonical": true, - "clientMethod": { - "async": true, - "client": { - "fullName": "google.cloud.security.privateca_v1.CertificateAuthorityServiceAsyncClient", - "shortName": "CertificateAuthorityServiceAsyncClient" - }, - "fullName": "google.cloud.security.privateca_v1.CertificateAuthorityServiceAsyncClient.fetch_ca_certs", - "method": { - "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService.FetchCaCerts", - "service": { - "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService", - "shortName": "CertificateAuthorityService" - }, - "shortName": "FetchCaCerts" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.security.privateca_v1.types.FetchCaCertsRequest" - }, - { - "name": "ca_pool", - "type": "str" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.cloud.security.privateca_v1.types.FetchCaCertsResponse", - "shortName": "fetch_ca_certs" - }, - "description": "Sample for FetchCaCerts", - "file": "privateca_v1_generated_certificate_authority_service_fetch_ca_certs_async.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "privateca_v1_generated_CertificateAuthorityService_FetchCaCerts_async", - "segments": [ - { - "end": 51, - "start": 27, - "type": "FULL" - }, - { - "end": 51, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 45, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 48, - "start": 46, - "type": "REQUEST_EXECUTION" - }, - { - "end": 52, - "start": 49, - "type": "RESPONSE_HANDLING" - } - ], - "title": "privateca_v1_generated_certificate_authority_service_fetch_ca_certs_async.py" - }, - { - "canonical": true, - "clientMethod": { - "client": { - "fullName": "google.cloud.security.privateca_v1.CertificateAuthorityServiceClient", - "shortName": "CertificateAuthorityServiceClient" - }, - "fullName": "google.cloud.security.privateca_v1.CertificateAuthorityServiceClient.fetch_ca_certs", - "method": { - "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService.FetchCaCerts", - "service": { - "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService", - "shortName": "CertificateAuthorityService" - }, - "shortName": "FetchCaCerts" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.security.privateca_v1.types.FetchCaCertsRequest" - }, - { - "name": "ca_pool", - "type": "str" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.cloud.security.privateca_v1.types.FetchCaCertsResponse", - "shortName": "fetch_ca_certs" - }, - "description": "Sample for FetchCaCerts", - "file": "privateca_v1_generated_certificate_authority_service_fetch_ca_certs_sync.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "privateca_v1_generated_CertificateAuthorityService_FetchCaCerts_sync", - "segments": [ - { - "end": 51, - "start": 27, - "type": "FULL" - }, - { - "end": 51, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 45, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 48, - "start": 46, - "type": "REQUEST_EXECUTION" - }, - { - "end": 52, - "start": 49, - "type": "RESPONSE_HANDLING" - } - ], - "title": "privateca_v1_generated_certificate_authority_service_fetch_ca_certs_sync.py" - }, - { - "canonical": true, - "clientMethod": { - "async": true, - "client": { - "fullName": "google.cloud.security.privateca_v1.CertificateAuthorityServiceAsyncClient", - "shortName": "CertificateAuthorityServiceAsyncClient" - }, - "fullName": "google.cloud.security.privateca_v1.CertificateAuthorityServiceAsyncClient.fetch_certificate_authority_csr", - "method": { - "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService.FetchCertificateAuthorityCsr", - "service": { - "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService", - "shortName": "CertificateAuthorityService" - }, - "shortName": "FetchCertificateAuthorityCsr" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.security.privateca_v1.types.FetchCertificateAuthorityCsrRequest" - }, - { - "name": "name", - "type": "str" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.cloud.security.privateca_v1.types.FetchCertificateAuthorityCsrResponse", - "shortName": "fetch_certificate_authority_csr" - }, - "description": "Sample for FetchCertificateAuthorityCsr", - "file": "privateca_v1_generated_certificate_authority_service_fetch_certificate_authority_csr_async.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "privateca_v1_generated_CertificateAuthorityService_FetchCertificateAuthorityCsr_async", - "segments": [ - { - "end": 51, - "start": 27, - "type": "FULL" - }, - { - "end": 51, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 45, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 48, - "start": 46, - "type": "REQUEST_EXECUTION" - }, - { - "end": 52, - "start": 49, - "type": "RESPONSE_HANDLING" - } - ], - "title": "privateca_v1_generated_certificate_authority_service_fetch_certificate_authority_csr_async.py" - }, - { - "canonical": true, - "clientMethod": { - "client": { - "fullName": "google.cloud.security.privateca_v1.CertificateAuthorityServiceClient", - "shortName": "CertificateAuthorityServiceClient" - }, - "fullName": "google.cloud.security.privateca_v1.CertificateAuthorityServiceClient.fetch_certificate_authority_csr", - "method": { - "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService.FetchCertificateAuthorityCsr", - "service": { - "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService", - "shortName": "CertificateAuthorityService" - }, - "shortName": "FetchCertificateAuthorityCsr" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.security.privateca_v1.types.FetchCertificateAuthorityCsrRequest" - }, - { - "name": "name", - "type": "str" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.cloud.security.privateca_v1.types.FetchCertificateAuthorityCsrResponse", - "shortName": "fetch_certificate_authority_csr" - }, - "description": "Sample for FetchCertificateAuthorityCsr", - "file": "privateca_v1_generated_certificate_authority_service_fetch_certificate_authority_csr_sync.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "privateca_v1_generated_CertificateAuthorityService_FetchCertificateAuthorityCsr_sync", - "segments": [ - { - "end": 51, - "start": 27, - "type": "FULL" - }, - { - "end": 51, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 45, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 48, - "start": 46, - "type": "REQUEST_EXECUTION" - }, - { - "end": 52, - "start": 49, - "type": "RESPONSE_HANDLING" - } - ], - "title": "privateca_v1_generated_certificate_authority_service_fetch_certificate_authority_csr_sync.py" - }, - { - "canonical": true, - "clientMethod": { - "async": true, - "client": { - "fullName": "google.cloud.security.privateca_v1.CertificateAuthorityServiceAsyncClient", - "shortName": "CertificateAuthorityServiceAsyncClient" - }, - "fullName": "google.cloud.security.privateca_v1.CertificateAuthorityServiceAsyncClient.get_ca_pool", - "method": { - "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService.GetCaPool", - "service": { - "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService", - "shortName": "CertificateAuthorityService" - }, - "shortName": "GetCaPool" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.security.privateca_v1.types.GetCaPoolRequest" - }, - { - "name": "name", - "type": "str" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.cloud.security.privateca_v1.types.CaPool", - "shortName": "get_ca_pool" - }, - "description": "Sample for GetCaPool", - "file": "privateca_v1_generated_certificate_authority_service_get_ca_pool_async.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "privateca_v1_generated_CertificateAuthorityService_GetCaPool_async", - "segments": [ - { - "end": 51, - "start": 27, - "type": "FULL" - }, - { - "end": 51, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 45, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 48, - "start": 46, - "type": "REQUEST_EXECUTION" - }, - { - "end": 52, - "start": 49, - "type": "RESPONSE_HANDLING" - } - ], - "title": "privateca_v1_generated_certificate_authority_service_get_ca_pool_async.py" - }, - { - "canonical": true, - "clientMethod": { - "client": { - "fullName": "google.cloud.security.privateca_v1.CertificateAuthorityServiceClient", - "shortName": "CertificateAuthorityServiceClient" - }, - "fullName": "google.cloud.security.privateca_v1.CertificateAuthorityServiceClient.get_ca_pool", - "method": { - "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService.GetCaPool", - "service": { - "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService", - "shortName": "CertificateAuthorityService" - }, - "shortName": "GetCaPool" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.security.privateca_v1.types.GetCaPoolRequest" - }, - { - "name": "name", - "type": "str" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.cloud.security.privateca_v1.types.CaPool", - "shortName": "get_ca_pool" - }, - "description": "Sample for GetCaPool", - "file": "privateca_v1_generated_certificate_authority_service_get_ca_pool_sync.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "privateca_v1_generated_CertificateAuthorityService_GetCaPool_sync", - "segments": [ - { - "end": 51, - "start": 27, - "type": "FULL" - }, - { - "end": 51, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 45, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 48, - "start": 46, - "type": "REQUEST_EXECUTION" - }, - { - "end": 52, - "start": 49, - "type": "RESPONSE_HANDLING" - } - ], - "title": "privateca_v1_generated_certificate_authority_service_get_ca_pool_sync.py" - }, - { - "canonical": true, - "clientMethod": { - "async": true, - "client": { - "fullName": "google.cloud.security.privateca_v1.CertificateAuthorityServiceAsyncClient", - "shortName": "CertificateAuthorityServiceAsyncClient" - }, - "fullName": "google.cloud.security.privateca_v1.CertificateAuthorityServiceAsyncClient.get_certificate_authority", - "method": { - "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService.GetCertificateAuthority", - "service": { - "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService", - "shortName": "CertificateAuthorityService" - }, - "shortName": "GetCertificateAuthority" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.security.privateca_v1.types.GetCertificateAuthorityRequest" - }, - { - "name": "name", - "type": "str" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.cloud.security.privateca_v1.types.CertificateAuthority", - "shortName": "get_certificate_authority" - }, - "description": "Sample for GetCertificateAuthority", - "file": "privateca_v1_generated_certificate_authority_service_get_certificate_authority_async.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "privateca_v1_generated_CertificateAuthorityService_GetCertificateAuthority_async", - "segments": [ - { - "end": 51, - "start": 27, - "type": "FULL" - }, - { - "end": 51, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 45, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 48, - "start": 46, - "type": "REQUEST_EXECUTION" - }, - { - "end": 52, - "start": 49, - "type": "RESPONSE_HANDLING" - } - ], - "title": "privateca_v1_generated_certificate_authority_service_get_certificate_authority_async.py" - }, - { - "canonical": true, - "clientMethod": { - "client": { - "fullName": "google.cloud.security.privateca_v1.CertificateAuthorityServiceClient", - "shortName": "CertificateAuthorityServiceClient" - }, - "fullName": "google.cloud.security.privateca_v1.CertificateAuthorityServiceClient.get_certificate_authority", - "method": { - "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService.GetCertificateAuthority", - "service": { - "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService", - "shortName": "CertificateAuthorityService" - }, - "shortName": "GetCertificateAuthority" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.security.privateca_v1.types.GetCertificateAuthorityRequest" - }, - { - "name": "name", - "type": "str" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.cloud.security.privateca_v1.types.CertificateAuthority", - "shortName": "get_certificate_authority" - }, - "description": "Sample for GetCertificateAuthority", - "file": "privateca_v1_generated_certificate_authority_service_get_certificate_authority_sync.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "privateca_v1_generated_CertificateAuthorityService_GetCertificateAuthority_sync", - "segments": [ - { - "end": 51, - "start": 27, - "type": "FULL" - }, - { - "end": 51, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 45, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 48, - "start": 46, - "type": "REQUEST_EXECUTION" - }, - { - "end": 52, - "start": 49, - "type": "RESPONSE_HANDLING" - } - ], - "title": "privateca_v1_generated_certificate_authority_service_get_certificate_authority_sync.py" - }, - { - "canonical": true, - "clientMethod": { - "async": true, - "client": { - "fullName": "google.cloud.security.privateca_v1.CertificateAuthorityServiceAsyncClient", - "shortName": "CertificateAuthorityServiceAsyncClient" - }, - "fullName": "google.cloud.security.privateca_v1.CertificateAuthorityServiceAsyncClient.get_certificate_revocation_list", - "method": { - "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService.GetCertificateRevocationList", - "service": { - "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService", - "shortName": "CertificateAuthorityService" - }, - "shortName": "GetCertificateRevocationList" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.security.privateca_v1.types.GetCertificateRevocationListRequest" - }, - { - "name": "name", - "type": "str" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.cloud.security.privateca_v1.types.CertificateRevocationList", - "shortName": "get_certificate_revocation_list" - }, - "description": "Sample for GetCertificateRevocationList", - "file": "privateca_v1_generated_certificate_authority_service_get_certificate_revocation_list_async.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "privateca_v1_generated_CertificateAuthorityService_GetCertificateRevocationList_async", - "segments": [ - { - "end": 51, - "start": 27, - "type": "FULL" - }, - { - "end": 51, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 45, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 48, - "start": 46, - "type": "REQUEST_EXECUTION" - }, - { - "end": 52, - "start": 49, - "type": "RESPONSE_HANDLING" - } - ], - "title": "privateca_v1_generated_certificate_authority_service_get_certificate_revocation_list_async.py" - }, - { - "canonical": true, - "clientMethod": { - "client": { - "fullName": "google.cloud.security.privateca_v1.CertificateAuthorityServiceClient", - "shortName": "CertificateAuthorityServiceClient" - }, - "fullName": "google.cloud.security.privateca_v1.CertificateAuthorityServiceClient.get_certificate_revocation_list", - "method": { - "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService.GetCertificateRevocationList", - "service": { - "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService", - "shortName": "CertificateAuthorityService" - }, - "shortName": "GetCertificateRevocationList" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.security.privateca_v1.types.GetCertificateRevocationListRequest" - }, - { - "name": "name", - "type": "str" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.cloud.security.privateca_v1.types.CertificateRevocationList", - "shortName": "get_certificate_revocation_list" - }, - "description": "Sample for GetCertificateRevocationList", - "file": "privateca_v1_generated_certificate_authority_service_get_certificate_revocation_list_sync.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "privateca_v1_generated_CertificateAuthorityService_GetCertificateRevocationList_sync", - "segments": [ - { - "end": 51, - "start": 27, - "type": "FULL" - }, - { - "end": 51, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 45, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 48, - "start": 46, - "type": "REQUEST_EXECUTION" - }, - { - "end": 52, - "start": 49, - "type": "RESPONSE_HANDLING" - } - ], - "title": "privateca_v1_generated_certificate_authority_service_get_certificate_revocation_list_sync.py" - }, - { - "canonical": true, - "clientMethod": { - "async": true, - "client": { - "fullName": "google.cloud.security.privateca_v1.CertificateAuthorityServiceAsyncClient", - "shortName": "CertificateAuthorityServiceAsyncClient" - }, - "fullName": "google.cloud.security.privateca_v1.CertificateAuthorityServiceAsyncClient.get_certificate_template", - "method": { - "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService.GetCertificateTemplate", - "service": { - "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService", - "shortName": "CertificateAuthorityService" - }, - "shortName": "GetCertificateTemplate" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.security.privateca_v1.types.GetCertificateTemplateRequest" - }, - { - "name": "name", - "type": "str" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.cloud.security.privateca_v1.types.CertificateTemplate", - "shortName": "get_certificate_template" - }, - "description": "Sample for GetCertificateTemplate", - "file": "privateca_v1_generated_certificate_authority_service_get_certificate_template_async.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "privateca_v1_generated_CertificateAuthorityService_GetCertificateTemplate_async", - "segments": [ - { - "end": 51, - "start": 27, - "type": "FULL" - }, - { - "end": 51, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 45, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 48, - "start": 46, - "type": "REQUEST_EXECUTION" - }, - { - "end": 52, - "start": 49, - "type": "RESPONSE_HANDLING" - } - ], - "title": "privateca_v1_generated_certificate_authority_service_get_certificate_template_async.py" - }, - { - "canonical": true, - "clientMethod": { - "client": { - "fullName": "google.cloud.security.privateca_v1.CertificateAuthorityServiceClient", - "shortName": "CertificateAuthorityServiceClient" - }, - "fullName": "google.cloud.security.privateca_v1.CertificateAuthorityServiceClient.get_certificate_template", - "method": { - "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService.GetCertificateTemplate", - "service": { - "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService", - "shortName": "CertificateAuthorityService" - }, - "shortName": "GetCertificateTemplate" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.security.privateca_v1.types.GetCertificateTemplateRequest" - }, - { - "name": "name", - "type": "str" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.cloud.security.privateca_v1.types.CertificateTemplate", - "shortName": "get_certificate_template" - }, - "description": "Sample for GetCertificateTemplate", - "file": "privateca_v1_generated_certificate_authority_service_get_certificate_template_sync.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "privateca_v1_generated_CertificateAuthorityService_GetCertificateTemplate_sync", - "segments": [ - { - "end": 51, - "start": 27, - "type": "FULL" - }, - { - "end": 51, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 45, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 48, - "start": 46, - "type": "REQUEST_EXECUTION" - }, - { - "end": 52, - "start": 49, - "type": "RESPONSE_HANDLING" - } - ], - "title": "privateca_v1_generated_certificate_authority_service_get_certificate_template_sync.py" - }, - { - "canonical": true, - "clientMethod": { - "async": true, - "client": { - "fullName": "google.cloud.security.privateca_v1.CertificateAuthorityServiceAsyncClient", - "shortName": "CertificateAuthorityServiceAsyncClient" - }, - "fullName": "google.cloud.security.privateca_v1.CertificateAuthorityServiceAsyncClient.get_certificate", - "method": { - "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService.GetCertificate", - "service": { - "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService", - "shortName": "CertificateAuthorityService" - }, - "shortName": "GetCertificate" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.security.privateca_v1.types.GetCertificateRequest" - }, - { - "name": "name", - "type": "str" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.cloud.security.privateca_v1.types.Certificate", - "shortName": "get_certificate" - }, - "description": "Sample for GetCertificate", - "file": "privateca_v1_generated_certificate_authority_service_get_certificate_async.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "privateca_v1_generated_CertificateAuthorityService_GetCertificate_async", - "segments": [ - { - "end": 51, - "start": 27, - "type": "FULL" - }, - { - "end": 51, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 45, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 48, - "start": 46, - "type": "REQUEST_EXECUTION" - }, - { - "end": 52, - "start": 49, - "type": "RESPONSE_HANDLING" - } - ], - "title": "privateca_v1_generated_certificate_authority_service_get_certificate_async.py" - }, - { - "canonical": true, - "clientMethod": { - "client": { - "fullName": "google.cloud.security.privateca_v1.CertificateAuthorityServiceClient", - "shortName": "CertificateAuthorityServiceClient" - }, - "fullName": "google.cloud.security.privateca_v1.CertificateAuthorityServiceClient.get_certificate", - "method": { - "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService.GetCertificate", - "service": { - "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService", - "shortName": "CertificateAuthorityService" - }, - "shortName": "GetCertificate" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.security.privateca_v1.types.GetCertificateRequest" - }, - { - "name": "name", - "type": "str" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.cloud.security.privateca_v1.types.Certificate", - "shortName": "get_certificate" - }, - "description": "Sample for GetCertificate", - "file": "privateca_v1_generated_certificate_authority_service_get_certificate_sync.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "privateca_v1_generated_CertificateAuthorityService_GetCertificate_sync", - "segments": [ - { - "end": 51, - "start": 27, - "type": "FULL" - }, - { - "end": 51, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 45, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 48, - "start": 46, - "type": "REQUEST_EXECUTION" - }, - { - "end": 52, - "start": 49, - "type": "RESPONSE_HANDLING" - } - ], - "title": "privateca_v1_generated_certificate_authority_service_get_certificate_sync.py" - }, - { - "canonical": true, - "clientMethod": { - "async": true, - "client": { - "fullName": "google.cloud.security.privateca_v1.CertificateAuthorityServiceAsyncClient", - "shortName": "CertificateAuthorityServiceAsyncClient" - }, - "fullName": "google.cloud.security.privateca_v1.CertificateAuthorityServiceAsyncClient.list_ca_pools", - "method": { - "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService.ListCaPools", - "service": { - "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService", - "shortName": "CertificateAuthorityService" - }, - "shortName": "ListCaPools" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.security.privateca_v1.types.ListCaPoolsRequest" - }, - { - "name": "parent", - "type": "str" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.cloud.security.privateca_v1.services.certificate_authority_service.pagers.ListCaPoolsAsyncPager", - "shortName": "list_ca_pools" - }, - "description": "Sample for ListCaPools", - "file": "privateca_v1_generated_certificate_authority_service_list_ca_pools_async.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "privateca_v1_generated_CertificateAuthorityService_ListCaPools_async", - "segments": [ - { - "end": 52, - "start": 27, - "type": "FULL" - }, - { - "end": 52, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 45, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 48, - "start": 46, - "type": "REQUEST_EXECUTION" - }, - { - "end": 53, - "start": 49, - "type": "RESPONSE_HANDLING" - } - ], - "title": "privateca_v1_generated_certificate_authority_service_list_ca_pools_async.py" - }, - { - "canonical": true, - "clientMethod": { - "client": { - "fullName": "google.cloud.security.privateca_v1.CertificateAuthorityServiceClient", - "shortName": "CertificateAuthorityServiceClient" - }, - "fullName": "google.cloud.security.privateca_v1.CertificateAuthorityServiceClient.list_ca_pools", - "method": { - "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService.ListCaPools", - "service": { - "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService", - "shortName": "CertificateAuthorityService" - }, - "shortName": "ListCaPools" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.security.privateca_v1.types.ListCaPoolsRequest" - }, - { - "name": "parent", - "type": "str" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.cloud.security.privateca_v1.services.certificate_authority_service.pagers.ListCaPoolsPager", - "shortName": "list_ca_pools" - }, - "description": "Sample for ListCaPools", - "file": "privateca_v1_generated_certificate_authority_service_list_ca_pools_sync.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "privateca_v1_generated_CertificateAuthorityService_ListCaPools_sync", - "segments": [ - { - "end": 52, - "start": 27, - "type": "FULL" - }, - { - "end": 52, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 45, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 48, - "start": 46, - "type": "REQUEST_EXECUTION" - }, - { - "end": 53, - "start": 49, - "type": "RESPONSE_HANDLING" - } - ], - "title": "privateca_v1_generated_certificate_authority_service_list_ca_pools_sync.py" - }, - { - "canonical": true, - "clientMethod": { - "async": true, - "client": { - "fullName": "google.cloud.security.privateca_v1.CertificateAuthorityServiceAsyncClient", - "shortName": "CertificateAuthorityServiceAsyncClient" - }, - "fullName": "google.cloud.security.privateca_v1.CertificateAuthorityServiceAsyncClient.list_certificate_authorities", - "method": { - "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService.ListCertificateAuthorities", - "service": { - "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService", - "shortName": "CertificateAuthorityService" - }, - "shortName": "ListCertificateAuthorities" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.security.privateca_v1.types.ListCertificateAuthoritiesRequest" - }, - { - "name": "parent", - "type": "str" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.cloud.security.privateca_v1.services.certificate_authority_service.pagers.ListCertificateAuthoritiesAsyncPager", - "shortName": "list_certificate_authorities" - }, - "description": "Sample for ListCertificateAuthorities", - "file": "privateca_v1_generated_certificate_authority_service_list_certificate_authorities_async.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "privateca_v1_generated_CertificateAuthorityService_ListCertificateAuthorities_async", - "segments": [ - { - "end": 52, - "start": 27, - "type": "FULL" - }, - { - "end": 52, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 45, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 48, - "start": 46, - "type": "REQUEST_EXECUTION" - }, - { - "end": 53, - "start": 49, - "type": "RESPONSE_HANDLING" - } - ], - "title": "privateca_v1_generated_certificate_authority_service_list_certificate_authorities_async.py" - }, - { - "canonical": true, - "clientMethod": { - "client": { - "fullName": "google.cloud.security.privateca_v1.CertificateAuthorityServiceClient", - "shortName": "CertificateAuthorityServiceClient" - }, - "fullName": "google.cloud.security.privateca_v1.CertificateAuthorityServiceClient.list_certificate_authorities", - "method": { - "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService.ListCertificateAuthorities", - "service": { - "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService", - "shortName": "CertificateAuthorityService" - }, - "shortName": "ListCertificateAuthorities" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.security.privateca_v1.types.ListCertificateAuthoritiesRequest" - }, - { - "name": "parent", - "type": "str" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.cloud.security.privateca_v1.services.certificate_authority_service.pagers.ListCertificateAuthoritiesPager", - "shortName": "list_certificate_authorities" - }, - "description": "Sample for ListCertificateAuthorities", - "file": "privateca_v1_generated_certificate_authority_service_list_certificate_authorities_sync.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "privateca_v1_generated_CertificateAuthorityService_ListCertificateAuthorities_sync", - "segments": [ - { - "end": 52, - "start": 27, - "type": "FULL" - }, - { - "end": 52, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 45, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 48, - "start": 46, - "type": "REQUEST_EXECUTION" - }, - { - "end": 53, - "start": 49, - "type": "RESPONSE_HANDLING" - } - ], - "title": "privateca_v1_generated_certificate_authority_service_list_certificate_authorities_sync.py" - }, - { - "canonical": true, - "clientMethod": { - "async": true, - "client": { - "fullName": "google.cloud.security.privateca_v1.CertificateAuthorityServiceAsyncClient", - "shortName": "CertificateAuthorityServiceAsyncClient" - }, - "fullName": "google.cloud.security.privateca_v1.CertificateAuthorityServiceAsyncClient.list_certificate_revocation_lists", - "method": { - "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService.ListCertificateRevocationLists", - "service": { - "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService", - "shortName": "CertificateAuthorityService" - }, - "shortName": "ListCertificateRevocationLists" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.security.privateca_v1.types.ListCertificateRevocationListsRequest" - }, - { - "name": "parent", - "type": "str" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.cloud.security.privateca_v1.services.certificate_authority_service.pagers.ListCertificateRevocationListsAsyncPager", - "shortName": "list_certificate_revocation_lists" - }, - "description": "Sample for ListCertificateRevocationLists", - "file": "privateca_v1_generated_certificate_authority_service_list_certificate_revocation_lists_async.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "privateca_v1_generated_CertificateAuthorityService_ListCertificateRevocationLists_async", - "segments": [ - { - "end": 52, - "start": 27, - "type": "FULL" - }, - { - "end": 52, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 45, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 48, - "start": 46, - "type": "REQUEST_EXECUTION" - }, - { - "end": 53, - "start": 49, - "type": "RESPONSE_HANDLING" - } - ], - "title": "privateca_v1_generated_certificate_authority_service_list_certificate_revocation_lists_async.py" - }, - { - "canonical": true, - "clientMethod": { - "client": { - "fullName": "google.cloud.security.privateca_v1.CertificateAuthorityServiceClient", - "shortName": "CertificateAuthorityServiceClient" - }, - "fullName": "google.cloud.security.privateca_v1.CertificateAuthorityServiceClient.list_certificate_revocation_lists", - "method": { - "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService.ListCertificateRevocationLists", - "service": { - "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService", - "shortName": "CertificateAuthorityService" - }, - "shortName": "ListCertificateRevocationLists" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.security.privateca_v1.types.ListCertificateRevocationListsRequest" - }, - { - "name": "parent", - "type": "str" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.cloud.security.privateca_v1.services.certificate_authority_service.pagers.ListCertificateRevocationListsPager", - "shortName": "list_certificate_revocation_lists" - }, - "description": "Sample for ListCertificateRevocationLists", - "file": "privateca_v1_generated_certificate_authority_service_list_certificate_revocation_lists_sync.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "privateca_v1_generated_CertificateAuthorityService_ListCertificateRevocationLists_sync", - "segments": [ - { - "end": 52, - "start": 27, - "type": "FULL" - }, - { - "end": 52, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 45, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 48, - "start": 46, - "type": "REQUEST_EXECUTION" - }, - { - "end": 53, - "start": 49, - "type": "RESPONSE_HANDLING" - } - ], - "title": "privateca_v1_generated_certificate_authority_service_list_certificate_revocation_lists_sync.py" - }, - { - "canonical": true, - "clientMethod": { - "async": true, - "client": { - "fullName": "google.cloud.security.privateca_v1.CertificateAuthorityServiceAsyncClient", - "shortName": "CertificateAuthorityServiceAsyncClient" - }, - "fullName": "google.cloud.security.privateca_v1.CertificateAuthorityServiceAsyncClient.list_certificate_templates", - "method": { - "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService.ListCertificateTemplates", - "service": { - "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService", - "shortName": "CertificateAuthorityService" - }, - "shortName": "ListCertificateTemplates" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.security.privateca_v1.types.ListCertificateTemplatesRequest" - }, - { - "name": "parent", - "type": "str" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.cloud.security.privateca_v1.services.certificate_authority_service.pagers.ListCertificateTemplatesAsyncPager", - "shortName": "list_certificate_templates" - }, - "description": "Sample for ListCertificateTemplates", - "file": "privateca_v1_generated_certificate_authority_service_list_certificate_templates_async.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "privateca_v1_generated_CertificateAuthorityService_ListCertificateTemplates_async", - "segments": [ - { - "end": 52, - "start": 27, - "type": "FULL" - }, - { - "end": 52, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 45, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 48, - "start": 46, - "type": "REQUEST_EXECUTION" - }, - { - "end": 53, - "start": 49, - "type": "RESPONSE_HANDLING" - } - ], - "title": "privateca_v1_generated_certificate_authority_service_list_certificate_templates_async.py" - }, - { - "canonical": true, - "clientMethod": { - "client": { - "fullName": "google.cloud.security.privateca_v1.CertificateAuthorityServiceClient", - "shortName": "CertificateAuthorityServiceClient" - }, - "fullName": "google.cloud.security.privateca_v1.CertificateAuthorityServiceClient.list_certificate_templates", - "method": { - "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService.ListCertificateTemplates", - "service": { - "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService", - "shortName": "CertificateAuthorityService" - }, - "shortName": "ListCertificateTemplates" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.security.privateca_v1.types.ListCertificateTemplatesRequest" - }, - { - "name": "parent", - "type": "str" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.cloud.security.privateca_v1.services.certificate_authority_service.pagers.ListCertificateTemplatesPager", - "shortName": "list_certificate_templates" - }, - "description": "Sample for ListCertificateTemplates", - "file": "privateca_v1_generated_certificate_authority_service_list_certificate_templates_sync.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "privateca_v1_generated_CertificateAuthorityService_ListCertificateTemplates_sync", - "segments": [ - { - "end": 52, - "start": 27, - "type": "FULL" - }, - { - "end": 52, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 45, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 48, - "start": 46, - "type": "REQUEST_EXECUTION" - }, - { - "end": 53, - "start": 49, - "type": "RESPONSE_HANDLING" - } - ], - "title": "privateca_v1_generated_certificate_authority_service_list_certificate_templates_sync.py" - }, - { - "canonical": true, - "clientMethod": { - "async": true, - "client": { - "fullName": "google.cloud.security.privateca_v1.CertificateAuthorityServiceAsyncClient", - "shortName": "CertificateAuthorityServiceAsyncClient" - }, - "fullName": "google.cloud.security.privateca_v1.CertificateAuthorityServiceAsyncClient.list_certificates", - "method": { - "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService.ListCertificates", - "service": { - "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService", - "shortName": "CertificateAuthorityService" - }, - "shortName": "ListCertificates" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.security.privateca_v1.types.ListCertificatesRequest" - }, - { - "name": "parent", - "type": "str" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.cloud.security.privateca_v1.services.certificate_authority_service.pagers.ListCertificatesAsyncPager", - "shortName": "list_certificates" - }, - "description": "Sample for ListCertificates", - "file": "privateca_v1_generated_certificate_authority_service_list_certificates_async.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "privateca_v1_generated_CertificateAuthorityService_ListCertificates_async", - "segments": [ - { - "end": 52, - "start": 27, - "type": "FULL" - }, - { - "end": 52, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 45, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 48, - "start": 46, - "type": "REQUEST_EXECUTION" - }, - { - "end": 53, - "start": 49, - "type": "RESPONSE_HANDLING" - } - ], - "title": "privateca_v1_generated_certificate_authority_service_list_certificates_async.py" - }, - { - "canonical": true, - "clientMethod": { - "client": { - "fullName": "google.cloud.security.privateca_v1.CertificateAuthorityServiceClient", - "shortName": "CertificateAuthorityServiceClient" - }, - "fullName": "google.cloud.security.privateca_v1.CertificateAuthorityServiceClient.list_certificates", - "method": { - "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService.ListCertificates", - "service": { - "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService", - "shortName": "CertificateAuthorityService" - }, - "shortName": "ListCertificates" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.security.privateca_v1.types.ListCertificatesRequest" - }, - { - "name": "parent", - "type": "str" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.cloud.security.privateca_v1.services.certificate_authority_service.pagers.ListCertificatesPager", - "shortName": "list_certificates" - }, - "description": "Sample for ListCertificates", - "file": "privateca_v1_generated_certificate_authority_service_list_certificates_sync.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "privateca_v1_generated_CertificateAuthorityService_ListCertificates_sync", - "segments": [ - { - "end": 52, - "start": 27, - "type": "FULL" - }, - { - "end": 52, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 45, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 48, - "start": 46, - "type": "REQUEST_EXECUTION" - }, - { - "end": 53, - "start": 49, - "type": "RESPONSE_HANDLING" - } - ], - "title": "privateca_v1_generated_certificate_authority_service_list_certificates_sync.py" - }, - { - "canonical": true, - "clientMethod": { - "async": true, - "client": { - "fullName": "google.cloud.security.privateca_v1.CertificateAuthorityServiceAsyncClient", - "shortName": "CertificateAuthorityServiceAsyncClient" - }, - "fullName": "google.cloud.security.privateca_v1.CertificateAuthorityServiceAsyncClient.revoke_certificate", - "method": { - "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService.RevokeCertificate", - "service": { - "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService", - "shortName": "CertificateAuthorityService" - }, - "shortName": "RevokeCertificate" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.security.privateca_v1.types.RevokeCertificateRequest" - }, - { - "name": "name", - "type": "str" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.cloud.security.privateca_v1.types.Certificate", - "shortName": "revoke_certificate" - }, - "description": "Sample for RevokeCertificate", - "file": "privateca_v1_generated_certificate_authority_service_revoke_certificate_async.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "privateca_v1_generated_CertificateAuthorityService_RevokeCertificate_async", - "segments": [ - { - "end": 52, - "start": 27, - "type": "FULL" - }, - { - "end": 52, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 46, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 49, - "start": 47, - "type": "REQUEST_EXECUTION" - }, - { - "end": 53, - "start": 50, - "type": "RESPONSE_HANDLING" - } - ], - "title": "privateca_v1_generated_certificate_authority_service_revoke_certificate_async.py" - }, - { - "canonical": true, - "clientMethod": { - "client": { - "fullName": "google.cloud.security.privateca_v1.CertificateAuthorityServiceClient", - "shortName": "CertificateAuthorityServiceClient" - }, - "fullName": "google.cloud.security.privateca_v1.CertificateAuthorityServiceClient.revoke_certificate", - "method": { - "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService.RevokeCertificate", - "service": { - "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService", - "shortName": "CertificateAuthorityService" - }, - "shortName": "RevokeCertificate" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.security.privateca_v1.types.RevokeCertificateRequest" - }, - { - "name": "name", - "type": "str" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.cloud.security.privateca_v1.types.Certificate", - "shortName": "revoke_certificate" - }, - "description": "Sample for RevokeCertificate", - "file": "privateca_v1_generated_certificate_authority_service_revoke_certificate_sync.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "privateca_v1_generated_CertificateAuthorityService_RevokeCertificate_sync", - "segments": [ - { - "end": 52, - "start": 27, - "type": "FULL" - }, - { - "end": 52, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 46, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 49, - "start": 47, - "type": "REQUEST_EXECUTION" - }, - { - "end": 53, - "start": 50, - "type": "RESPONSE_HANDLING" - } - ], - "title": "privateca_v1_generated_certificate_authority_service_revoke_certificate_sync.py" - }, - { - "canonical": true, - "clientMethod": { - "async": true, - "client": { - "fullName": "google.cloud.security.privateca_v1.CertificateAuthorityServiceAsyncClient", - "shortName": "CertificateAuthorityServiceAsyncClient" - }, - "fullName": "google.cloud.security.privateca_v1.CertificateAuthorityServiceAsyncClient.undelete_certificate_authority", - "method": { - "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService.UndeleteCertificateAuthority", - "service": { - "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService", - "shortName": "CertificateAuthorityService" - }, - "shortName": "UndeleteCertificateAuthority" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.security.privateca_v1.types.UndeleteCertificateAuthorityRequest" - }, - { - "name": "name", - "type": "str" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.api_core.operation_async.AsyncOperation", - "shortName": "undelete_certificate_authority" - }, - "description": "Sample for UndeleteCertificateAuthority", - "file": "privateca_v1_generated_certificate_authority_service_undelete_certificate_authority_async.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "privateca_v1_generated_CertificateAuthorityService_UndeleteCertificateAuthority_async", - "segments": [ - { - "end": 55, - "start": 27, - "type": "FULL" - }, - { - "end": 55, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 45, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 52, - "start": 46, - "type": "REQUEST_EXECUTION" - }, - { - "end": 56, - "start": 53, - "type": "RESPONSE_HANDLING" - } - ], - "title": "privateca_v1_generated_certificate_authority_service_undelete_certificate_authority_async.py" - }, - { - "canonical": true, - "clientMethod": { - "client": { - "fullName": "google.cloud.security.privateca_v1.CertificateAuthorityServiceClient", - "shortName": "CertificateAuthorityServiceClient" - }, - "fullName": "google.cloud.security.privateca_v1.CertificateAuthorityServiceClient.undelete_certificate_authority", - "method": { - "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService.UndeleteCertificateAuthority", - "service": { - "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService", - "shortName": "CertificateAuthorityService" - }, - "shortName": "UndeleteCertificateAuthority" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.security.privateca_v1.types.UndeleteCertificateAuthorityRequest" - }, - { - "name": "name", - "type": "str" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.api_core.operation.Operation", - "shortName": "undelete_certificate_authority" - }, - "description": "Sample for UndeleteCertificateAuthority", - "file": "privateca_v1_generated_certificate_authority_service_undelete_certificate_authority_sync.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "privateca_v1_generated_CertificateAuthorityService_UndeleteCertificateAuthority_sync", - "segments": [ - { - "end": 55, - "start": 27, - "type": "FULL" - }, - { - "end": 55, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 45, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 52, - "start": 46, - "type": "REQUEST_EXECUTION" - }, - { - "end": 56, - "start": 53, - "type": "RESPONSE_HANDLING" - } - ], - "title": "privateca_v1_generated_certificate_authority_service_undelete_certificate_authority_sync.py" - }, - { - "canonical": true, - "clientMethod": { - "async": true, - "client": { - "fullName": "google.cloud.security.privateca_v1.CertificateAuthorityServiceAsyncClient", - "shortName": "CertificateAuthorityServiceAsyncClient" - }, - "fullName": "google.cloud.security.privateca_v1.CertificateAuthorityServiceAsyncClient.update_ca_pool", - "method": { - "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService.UpdateCaPool", - "service": { - "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService", - "shortName": "CertificateAuthorityService" - }, - "shortName": "UpdateCaPool" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.security.privateca_v1.types.UpdateCaPoolRequest" - }, - { - "name": "ca_pool", - "type": "google.cloud.security.privateca_v1.types.CaPool" - }, - { - "name": "update_mask", - "type": "google.protobuf.field_mask_pb2.FieldMask" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.api_core.operation_async.AsyncOperation", - "shortName": "update_ca_pool" - }, - "description": "Sample for UpdateCaPool", - "file": "privateca_v1_generated_certificate_authority_service_update_ca_pool_async.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "privateca_v1_generated_CertificateAuthorityService_UpdateCaPool_async", - "segments": [ - { - "end": 58, - "start": 27, - "type": "FULL" - }, - { - "end": 58, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 48, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 55, - "start": 49, - "type": "REQUEST_EXECUTION" - }, - { - "end": 59, - "start": 56, - "type": "RESPONSE_HANDLING" - } - ], - "title": "privateca_v1_generated_certificate_authority_service_update_ca_pool_async.py" - }, - { - "canonical": true, - "clientMethod": { - "client": { - "fullName": "google.cloud.security.privateca_v1.CertificateAuthorityServiceClient", - "shortName": "CertificateAuthorityServiceClient" - }, - "fullName": "google.cloud.security.privateca_v1.CertificateAuthorityServiceClient.update_ca_pool", - "method": { - "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService.UpdateCaPool", - "service": { - "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService", - "shortName": "CertificateAuthorityService" - }, - "shortName": "UpdateCaPool" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.security.privateca_v1.types.UpdateCaPoolRequest" - }, - { - "name": "ca_pool", - "type": "google.cloud.security.privateca_v1.types.CaPool" - }, - { - "name": "update_mask", - "type": "google.protobuf.field_mask_pb2.FieldMask" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.api_core.operation.Operation", - "shortName": "update_ca_pool" - }, - "description": "Sample for UpdateCaPool", - "file": "privateca_v1_generated_certificate_authority_service_update_ca_pool_sync.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "privateca_v1_generated_CertificateAuthorityService_UpdateCaPool_sync", - "segments": [ - { - "end": 58, - "start": 27, - "type": "FULL" - }, - { - "end": 58, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 48, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 55, - "start": 49, - "type": "REQUEST_EXECUTION" - }, - { - "end": 59, - "start": 56, - "type": "RESPONSE_HANDLING" - } - ], - "title": "privateca_v1_generated_certificate_authority_service_update_ca_pool_sync.py" - }, - { - "canonical": true, - "clientMethod": { - "async": true, - "client": { - "fullName": "google.cloud.security.privateca_v1.CertificateAuthorityServiceAsyncClient", - "shortName": "CertificateAuthorityServiceAsyncClient" - }, - "fullName": "google.cloud.security.privateca_v1.CertificateAuthorityServiceAsyncClient.update_certificate_authority", - "method": { - "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService.UpdateCertificateAuthority", - "service": { - "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService", - "shortName": "CertificateAuthorityService" - }, - "shortName": "UpdateCertificateAuthority" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.security.privateca_v1.types.UpdateCertificateAuthorityRequest" - }, - { - "name": "certificate_authority", - "type": "google.cloud.security.privateca_v1.types.CertificateAuthority" - }, - { - "name": "update_mask", - "type": "google.protobuf.field_mask_pb2.FieldMask" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.api_core.operation_async.AsyncOperation", - "shortName": "update_certificate_authority" - }, - "description": "Sample for UpdateCertificateAuthority", - "file": "privateca_v1_generated_certificate_authority_service_update_certificate_authority_async.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "privateca_v1_generated_CertificateAuthorityService_UpdateCertificateAuthority_async", - "segments": [ - { - "end": 59, - "start": 27, - "type": "FULL" - }, - { - "end": 59, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 49, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 56, - "start": 50, - "type": "REQUEST_EXECUTION" - }, - { - "end": 60, - "start": 57, - "type": "RESPONSE_HANDLING" - } - ], - "title": "privateca_v1_generated_certificate_authority_service_update_certificate_authority_async.py" - }, - { - "canonical": true, - "clientMethod": { - "client": { - "fullName": "google.cloud.security.privateca_v1.CertificateAuthorityServiceClient", - "shortName": "CertificateAuthorityServiceClient" - }, - "fullName": "google.cloud.security.privateca_v1.CertificateAuthorityServiceClient.update_certificate_authority", - "method": { - "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService.UpdateCertificateAuthority", - "service": { - "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService", - "shortName": "CertificateAuthorityService" - }, - "shortName": "UpdateCertificateAuthority" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.security.privateca_v1.types.UpdateCertificateAuthorityRequest" - }, - { - "name": "certificate_authority", - "type": "google.cloud.security.privateca_v1.types.CertificateAuthority" - }, - { - "name": "update_mask", - "type": "google.protobuf.field_mask_pb2.FieldMask" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.api_core.operation.Operation", - "shortName": "update_certificate_authority" - }, - "description": "Sample for UpdateCertificateAuthority", - "file": "privateca_v1_generated_certificate_authority_service_update_certificate_authority_sync.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "privateca_v1_generated_CertificateAuthorityService_UpdateCertificateAuthority_sync", - "segments": [ - { - "end": 59, - "start": 27, - "type": "FULL" - }, - { - "end": 59, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 49, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 56, - "start": 50, - "type": "REQUEST_EXECUTION" - }, - { - "end": 60, - "start": 57, - "type": "RESPONSE_HANDLING" - } - ], - "title": "privateca_v1_generated_certificate_authority_service_update_certificate_authority_sync.py" - }, - { - "canonical": true, - "clientMethod": { - "async": true, - "client": { - "fullName": "google.cloud.security.privateca_v1.CertificateAuthorityServiceAsyncClient", - "shortName": "CertificateAuthorityServiceAsyncClient" - }, - "fullName": "google.cloud.security.privateca_v1.CertificateAuthorityServiceAsyncClient.update_certificate_revocation_list", - "method": { - "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService.UpdateCertificateRevocationList", - "service": { - "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService", - "shortName": "CertificateAuthorityService" - }, - "shortName": "UpdateCertificateRevocationList" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.security.privateca_v1.types.UpdateCertificateRevocationListRequest" - }, - { - "name": "certificate_revocation_list", - "type": "google.cloud.security.privateca_v1.types.CertificateRevocationList" - }, - { - "name": "update_mask", - "type": "google.protobuf.field_mask_pb2.FieldMask" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.api_core.operation_async.AsyncOperation", - "shortName": "update_certificate_revocation_list" - }, - "description": "Sample for UpdateCertificateRevocationList", - "file": "privateca_v1_generated_certificate_authority_service_update_certificate_revocation_list_async.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "privateca_v1_generated_CertificateAuthorityService_UpdateCertificateRevocationList_async", - "segments": [ - { - "end": 54, - "start": 27, - "type": "FULL" - }, - { - "end": 54, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 44, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 51, - "start": 45, - "type": "REQUEST_EXECUTION" - }, - { - "end": 55, - "start": 52, - "type": "RESPONSE_HANDLING" - } - ], - "title": "privateca_v1_generated_certificate_authority_service_update_certificate_revocation_list_async.py" - }, - { - "canonical": true, - "clientMethod": { - "client": { - "fullName": "google.cloud.security.privateca_v1.CertificateAuthorityServiceClient", - "shortName": "CertificateAuthorityServiceClient" - }, - "fullName": "google.cloud.security.privateca_v1.CertificateAuthorityServiceClient.update_certificate_revocation_list", - "method": { - "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService.UpdateCertificateRevocationList", - "service": { - "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService", - "shortName": "CertificateAuthorityService" - }, - "shortName": "UpdateCertificateRevocationList" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.security.privateca_v1.types.UpdateCertificateRevocationListRequest" - }, - { - "name": "certificate_revocation_list", - "type": "google.cloud.security.privateca_v1.types.CertificateRevocationList" - }, - { - "name": "update_mask", - "type": "google.protobuf.field_mask_pb2.FieldMask" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.api_core.operation.Operation", - "shortName": "update_certificate_revocation_list" - }, - "description": "Sample for UpdateCertificateRevocationList", - "file": "privateca_v1_generated_certificate_authority_service_update_certificate_revocation_list_sync.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "privateca_v1_generated_CertificateAuthorityService_UpdateCertificateRevocationList_sync", - "segments": [ - { - "end": 54, - "start": 27, - "type": "FULL" - }, - { - "end": 54, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 44, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 51, - "start": 45, - "type": "REQUEST_EXECUTION" - }, - { - "end": 55, - "start": 52, - "type": "RESPONSE_HANDLING" - } - ], - "title": "privateca_v1_generated_certificate_authority_service_update_certificate_revocation_list_sync.py" - }, - { - "canonical": true, - "clientMethod": { - "async": true, - "client": { - "fullName": "google.cloud.security.privateca_v1.CertificateAuthorityServiceAsyncClient", - "shortName": "CertificateAuthorityServiceAsyncClient" - }, - "fullName": "google.cloud.security.privateca_v1.CertificateAuthorityServiceAsyncClient.update_certificate_template", - "method": { - "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService.UpdateCertificateTemplate", - "service": { - "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService", - "shortName": "CertificateAuthorityService" - }, - "shortName": "UpdateCertificateTemplate" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.security.privateca_v1.types.UpdateCertificateTemplateRequest" - }, - { - "name": "certificate_template", - "type": "google.cloud.security.privateca_v1.types.CertificateTemplate" - }, - { - "name": "update_mask", - "type": "google.protobuf.field_mask_pb2.FieldMask" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.api_core.operation_async.AsyncOperation", - "shortName": "update_certificate_template" - }, - "description": "Sample for UpdateCertificateTemplate", - "file": "privateca_v1_generated_certificate_authority_service_update_certificate_template_async.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "privateca_v1_generated_CertificateAuthorityService_UpdateCertificateTemplate_async", - "segments": [ - { - "end": 54, - "start": 27, - "type": "FULL" - }, - { - "end": 54, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 44, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 51, - "start": 45, - "type": "REQUEST_EXECUTION" - }, - { - "end": 55, - "start": 52, - "type": "RESPONSE_HANDLING" - } - ], - "title": "privateca_v1_generated_certificate_authority_service_update_certificate_template_async.py" - }, - { - "canonical": true, - "clientMethod": { - "client": { - "fullName": "google.cloud.security.privateca_v1.CertificateAuthorityServiceClient", - "shortName": "CertificateAuthorityServiceClient" - }, - "fullName": "google.cloud.security.privateca_v1.CertificateAuthorityServiceClient.update_certificate_template", - "method": { - "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService.UpdateCertificateTemplate", - "service": { - "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService", - "shortName": "CertificateAuthorityService" - }, - "shortName": "UpdateCertificateTemplate" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.security.privateca_v1.types.UpdateCertificateTemplateRequest" - }, - { - "name": "certificate_template", - "type": "google.cloud.security.privateca_v1.types.CertificateTemplate" - }, - { - "name": "update_mask", - "type": "google.protobuf.field_mask_pb2.FieldMask" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.api_core.operation.Operation", - "shortName": "update_certificate_template" - }, - "description": "Sample for UpdateCertificateTemplate", - "file": "privateca_v1_generated_certificate_authority_service_update_certificate_template_sync.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "privateca_v1_generated_CertificateAuthorityService_UpdateCertificateTemplate_sync", - "segments": [ - { - "end": 54, - "start": 27, - "type": "FULL" - }, - { - "end": 54, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 44, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 51, - "start": 45, - "type": "REQUEST_EXECUTION" - }, - { - "end": 55, - "start": 52, - "type": "RESPONSE_HANDLING" - } - ], - "title": "privateca_v1_generated_certificate_authority_service_update_certificate_template_sync.py" - }, - { - "canonical": true, - "clientMethod": { - "async": true, - "client": { - "fullName": "google.cloud.security.privateca_v1.CertificateAuthorityServiceAsyncClient", - "shortName": "CertificateAuthorityServiceAsyncClient" - }, - "fullName": "google.cloud.security.privateca_v1.CertificateAuthorityServiceAsyncClient.update_certificate", - "method": { - "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService.UpdateCertificate", - "service": { - "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService", - "shortName": "CertificateAuthorityService" - }, - "shortName": "UpdateCertificate" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.security.privateca_v1.types.UpdateCertificateRequest" - }, - { - "name": "certificate", - "type": "google.cloud.security.privateca_v1.types.Certificate" - }, - { - "name": "update_mask", - "type": "google.protobuf.field_mask_pb2.FieldMask" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.cloud.security.privateca_v1.types.Certificate", - "shortName": "update_certificate" - }, - "description": "Sample for UpdateCertificate", - "file": "privateca_v1_generated_certificate_authority_service_update_certificate_async.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "privateca_v1_generated_CertificateAuthorityService_UpdateCertificate_async", - "segments": [ - { - "end": 54, - "start": 27, - "type": "FULL" - }, - { - "end": 54, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 48, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 51, - "start": 49, - "type": "REQUEST_EXECUTION" - }, - { - "end": 55, - "start": 52, - "type": "RESPONSE_HANDLING" - } - ], - "title": "privateca_v1_generated_certificate_authority_service_update_certificate_async.py" - }, - { - "canonical": true, - "clientMethod": { - "client": { - "fullName": "google.cloud.security.privateca_v1.CertificateAuthorityServiceClient", - "shortName": "CertificateAuthorityServiceClient" - }, - "fullName": "google.cloud.security.privateca_v1.CertificateAuthorityServiceClient.update_certificate", - "method": { - "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService.UpdateCertificate", - "service": { - "fullName": "google.cloud.security.privateca.v1.CertificateAuthorityService", - "shortName": "CertificateAuthorityService" - }, - "shortName": "UpdateCertificate" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.security.privateca_v1.types.UpdateCertificateRequest" - }, - { - "name": "certificate", - "type": "google.cloud.security.privateca_v1.types.Certificate" - }, - { - "name": "update_mask", - "type": "google.protobuf.field_mask_pb2.FieldMask" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.cloud.security.privateca_v1.types.Certificate", - "shortName": "update_certificate" - }, - "description": "Sample for UpdateCertificate", - "file": "privateca_v1_generated_certificate_authority_service_update_certificate_sync.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "privateca_v1_generated_CertificateAuthorityService_UpdateCertificate_sync", - "segments": [ - { - "end": 54, - "start": 27, - "type": "FULL" - }, - { - "end": 54, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 48, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 51, - "start": 49, - "type": "REQUEST_EXECUTION" - }, - { - "end": 55, - "start": 52, - "type": "RESPONSE_HANDLING" - } - ], - "title": "privateca_v1_generated_certificate_authority_service_update_certificate_sync.py" - } - ] -} diff --git a/owl-bot-staging/v1/scripts/fixup_privateca_v1_keywords.py b/owl-bot-staging/v1/scripts/fixup_privateca_v1_keywords.py deleted file mode 100644 index 54d518c..0000000 --- a/owl-bot-staging/v1/scripts/fixup_privateca_v1_keywords.py +++ /dev/null @@ -1,204 +0,0 @@ -#! /usr/bin/env python3 -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -import argparse -import os -import libcst as cst -import pathlib -import sys -from typing import (Any, Callable, Dict, List, Sequence, Tuple) - - -def partition( - predicate: Callable[[Any], bool], - iterator: Sequence[Any] -) -> Tuple[List[Any], List[Any]]: - """A stable, out-of-place partition.""" - results = ([], []) - - for i in iterator: - results[int(predicate(i))].append(i) - - # Returns trueList, falseList - return results[1], results[0] - - -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', 'skip_grace_period', ), - '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: - try: - key = original.func.attr.value - kword_params = self.METHOD_TO_PARAMS[key] - except (AttributeError, KeyError): - # Either not a method from the API or too convoluted to be sure. - return updated - - # If the existing code is valid, keyword args come after positional args. - # Therefore, all positional args must map to the first parameters. - args, kwargs = partition(lambda a: not bool(a.keyword), updated.args) - if any(k.keyword.value == "request" for k in kwargs): - # We've already fixed this file, don't fix it again. - return updated - - kwargs, ctrl_kwargs = partition( - lambda a: a.keyword.value not in self.CTRL_PARAMS, - kwargs - ) - - args, ctrl_args = args[:len(kword_params)], args[len(kword_params):] - ctrl_kwargs.extend(cst.Arg(value=a.value, keyword=cst.Name(value=ctrl)) - for a, ctrl in zip(ctrl_args, self.CTRL_PARAMS)) - - request_arg = cst.Arg( - value=cst.Dict([ - cst.DictElement( - cst.SimpleString("'{}'".format(name)), -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 - # those could have been passed positionally or by keyword. - for name, arg in zip(kword_params, args + kwargs)]), - keyword=cst.Name("request") - ) - - return updated.with_changes( - args=[request_arg] + ctrl_kwargs - ) - - -def fix_files( - in_dir: pathlib.Path, - out_dir: pathlib.Path, - *, - transformer=privatecaCallTransformer(), -): - """Duplicate the input dir to the output dir, fixing file method calls. - - Preconditions: - * in_dir is a real directory - * out_dir is a real, empty directory - """ - pyfile_gen = ( - pathlib.Path(os.path.join(root, f)) - for root, _, files in os.walk(in_dir) - for f in files if os.path.splitext(f)[1] == ".py" - ) - - for fpath in pyfile_gen: - with open(fpath, 'r') as f: - src = f.read() - - # Parse the code and insert method call fixes. - tree = cst.parse_module(src) - updated = tree.visit(transformer) - - # Create the path and directory structure for the new file. - updated_path = out_dir.joinpath(fpath.relative_to(in_dir)) - updated_path.parent.mkdir(parents=True, exist_ok=True) - - # Generate the updated source file at the corresponding path. - with open(updated_path, 'w') as f: - f.write(updated.code) - - -if __name__ == '__main__': - parser = argparse.ArgumentParser( - description="""Fix up source that uses the privateca client library. - -The existing sources are NOT overwritten but are copied to output_dir with changes made. - -Note: This tool operates at a best-effort level at converting positional - parameters in client method calls to keyword based parameters. - Cases where it WILL FAIL include - A) * or ** expansion in a method call. - B) Calls via function or method alias (includes free function calls) - C) Indirect or dispatched calls (e.g. the method is looked up dynamically) - - These all constitute false negatives. The tool will also detect false - positives when an API method shares a name with another method. -""") - parser.add_argument( - '-d', - '--input-directory', - required=True, - dest='input_dir', - help='the input directory to walk for python files to fix up', - ) - parser.add_argument( - '-o', - '--output-directory', - required=True, - dest='output_dir', - help='the directory to output files fixed via un-flattening', - ) - args = parser.parse_args() - input_dir = pathlib.Path(args.input_dir) - output_dir = pathlib.Path(args.output_dir) - if not input_dir.is_dir(): - print( - f"input directory '{input_dir}' does not exist or is not a directory", - file=sys.stderr, - ) - sys.exit(-1) - - if not output_dir.is_dir(): - print( - f"output directory '{output_dir}' does not exist or is not a directory", - file=sys.stderr, - ) - sys.exit(-1) - - if os.listdir(output_dir): - print( - f"output directory '{output_dir}' is not empty", - file=sys.stderr, - ) - sys.exit(-1) - - fix_files(input_dir, output_dir) diff --git a/owl-bot-staging/v1/setup.py b/owl-bot-staging/v1/setup.py deleted file mode 100644 index 0c1a9f7..0000000 --- a/owl-bot-staging/v1/setup.py +++ /dev/null @@ -1,92 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -import io -import os - -import setuptools # type: ignore - -package_root = os.path.abspath(os.path.dirname(__file__)) - -name = 'google-cloud-private-ca' - - -description = "Google Cloud Private Ca API client library" - -version = {} -with open(os.path.join(package_root, 'google/cloud/security/privateca/gapic_version.py')) as fp: - exec(fp.read(), version) -version = version["__version__"] - -if version[0] == "0": - release_status = "Development Status :: 4 - Beta" -else: - release_status = "Development Status :: 5 - Production/Stable" - -dependencies = [ - "google-api-core[grpc] >= 1.34.0, <3.0.0dev,!=2.0.*,!=2.1.*,!=2.2.*,!=2.3.*,!=2.4.*,!=2.5.*,!=2.6.*,!=2.7.*,!=2.8.*,!=2.9.*,!=2.10.*", - "proto-plus >= 1.22.0, <2.0.0dev", - "proto-plus >= 1.22.2, <2.0.0dev; python_version>='3.11'", - "protobuf>=3.19.5,<5.0.0dev,!=3.20.0,!=3.20.1,!=4.21.0,!=4.21.1,!=4.21.2,!=4.21.3,!=4.21.4,!=4.21.5", -] -url = "https://github.com/googleapis/python-private-ca" - -package_root = os.path.abspath(os.path.dirname(__file__)) - -readme_filename = os.path.join(package_root, "README.rst") -with io.open(readme_filename, encoding="utf-8") as readme_file: - readme = readme_file.read() - -packages = [ - package - for package in setuptools.PEP420PackageFinder.find() - if package.startswith("google") -] - -namespaces = ["google"] -if "google.cloud" in packages: - namespaces.append("google.cloud") - -setuptools.setup( - name=name, - version=version, - description=description, - long_description=readme, - author="Google LLC", - author_email="googleapis-packages@google.com", - license="Apache 2.0", - url=url, - classifiers=[ - release_status, - "Intended Audience :: Developers", - "License :: OSI Approved :: Apache Software License", - "Programming Language :: Python", - "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.7", - "Programming Language :: Python :: 3.8", - "Programming Language :: Python :: 3.9", - "Programming Language :: Python :: 3.10", - "Programming Language :: Python :: 3.11", - "Operating System :: OS Independent", - "Topic :: Internet", - ], - platforms="Posix; MacOS X; Windows", - packages=packages, - python_requires=">=3.7", - namespace_packages=namespaces, - install_requires=dependencies, - include_package_data=True, - zip_safe=False, -) diff --git a/owl-bot-staging/v1/testing/constraints-3.10.txt b/owl-bot-staging/v1/testing/constraints-3.10.txt deleted file mode 100644 index ed7f9ae..0000000 --- a/owl-bot-staging/v1/testing/constraints-3.10.txt +++ /dev/null @@ -1,6 +0,0 @@ -# -*- coding: utf-8 -*- -# This constraints file is required for unit tests. -# List all library dependencies and extras in this file. -google-api-core -proto-plus -protobuf diff --git a/owl-bot-staging/v1/testing/constraints-3.11.txt b/owl-bot-staging/v1/testing/constraints-3.11.txt deleted file mode 100644 index ed7f9ae..0000000 --- a/owl-bot-staging/v1/testing/constraints-3.11.txt +++ /dev/null @@ -1,6 +0,0 @@ -# -*- coding: utf-8 -*- -# This constraints file is required for unit tests. -# List all library dependencies and extras in this file. -google-api-core -proto-plus -protobuf diff --git a/owl-bot-staging/v1/testing/constraints-3.12.txt b/owl-bot-staging/v1/testing/constraints-3.12.txt deleted file mode 100644 index ed7f9ae..0000000 --- a/owl-bot-staging/v1/testing/constraints-3.12.txt +++ /dev/null @@ -1,6 +0,0 @@ -# -*- coding: utf-8 -*- -# This constraints file is required for unit tests. -# List all library dependencies and extras in this file. -google-api-core -proto-plus -protobuf diff --git a/owl-bot-staging/v1/testing/constraints-3.7.txt b/owl-bot-staging/v1/testing/constraints-3.7.txt deleted file mode 100644 index 6c44adf..0000000 --- a/owl-bot-staging/v1/testing/constraints-3.7.txt +++ /dev/null @@ -1,9 +0,0 @@ -# This constraints file is used to check that lower bounds -# are correct in setup.py -# List all library dependencies and extras in this file. -# Pin the version to the lower bound. -# e.g., if setup.py has "google-cloud-foo >= 1.14.0, < 2.0.0dev", -# Then this file should have google-cloud-foo==1.14.0 -google-api-core==1.34.0 -proto-plus==1.22.0 -protobuf==3.19.5 diff --git a/owl-bot-staging/v1/testing/constraints-3.8.txt b/owl-bot-staging/v1/testing/constraints-3.8.txt deleted file mode 100644 index ed7f9ae..0000000 --- a/owl-bot-staging/v1/testing/constraints-3.8.txt +++ /dev/null @@ -1,6 +0,0 @@ -# -*- coding: utf-8 -*- -# This constraints file is required for unit tests. -# List all library dependencies and extras in this file. -google-api-core -proto-plus -protobuf diff --git a/owl-bot-staging/v1/testing/constraints-3.9.txt b/owl-bot-staging/v1/testing/constraints-3.9.txt deleted file mode 100644 index ed7f9ae..0000000 --- a/owl-bot-staging/v1/testing/constraints-3.9.txt +++ /dev/null @@ -1,6 +0,0 @@ -# -*- coding: utf-8 -*- -# This constraints file is required for unit tests. -# List all library dependencies and extras in this file. -google-api-core -proto-plus -protobuf diff --git a/owl-bot-staging/v1/tests/__init__.py b/owl-bot-staging/v1/tests/__init__.py deleted file mode 100644 index 231bc12..0000000 --- a/owl-bot-staging/v1/tests/__init__.py +++ /dev/null @@ -1,16 +0,0 @@ - -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# diff --git a/owl-bot-staging/v1/tests/unit/__init__.py b/owl-bot-staging/v1/tests/unit/__init__.py deleted file mode 100644 index 231bc12..0000000 --- a/owl-bot-staging/v1/tests/unit/__init__.py +++ /dev/null @@ -1,16 +0,0 @@ - -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# diff --git a/owl-bot-staging/v1/tests/unit/gapic/__init__.py b/owl-bot-staging/v1/tests/unit/gapic/__init__.py deleted file mode 100644 index 231bc12..0000000 --- a/owl-bot-staging/v1/tests/unit/gapic/__init__.py +++ /dev/null @@ -1,16 +0,0 @@ - -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# diff --git a/owl-bot-staging/v1/tests/unit/gapic/privateca_v1/__init__.py b/owl-bot-staging/v1/tests/unit/gapic/privateca_v1/__init__.py deleted file mode 100644 index 231bc12..0000000 --- a/owl-bot-staging/v1/tests/unit/gapic/privateca_v1/__init__.py +++ /dev/null @@ -1,16 +0,0 @@ - -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# diff --git a/owl-bot-staging/v1/tests/unit/gapic/privateca_v1/test_certificate_authority_service.py b/owl-bot-staging/v1/tests/unit/gapic/privateca_v1/test_certificate_authority_service.py deleted file mode 100644 index 9ba4949..0000000 --- a/owl-bot-staging/v1/tests/unit/gapic/privateca_v1/test_certificate_authority_service.py +++ /dev/null @@ -1,9247 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -import os -# try/except added for compatibility with python < 3.8 -try: - from unittest import mock - from unittest.mock import AsyncMock # pragma: NO COVER -except ImportError: # pragma: NO COVER - import mock - -import grpc -from grpc.experimental import aio -import math -import pytest -from proto.marshal.rules.dates import DurationRule, TimestampRule -from proto.marshal.rules import wrappers - -from google.api_core import client_options -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 -from google.api_core import operation_async # type: ignore -from google.api_core import operations_v1 -from google.api_core import path_template -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 -from google.cloud.security.privateca_v1.services.certificate_authority_service import CertificateAuthorityServiceClient -from google.cloud.security.privateca_v1.services.certificate_authority_service import pagers -from google.cloud.security.privateca_v1.services.certificate_authority_service import transports -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 # 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 google.type import expr_pb2 # type: ignore -import google.auth - - -def client_cert_source_callback(): - return b"cert bytes", b"key bytes" - - -# If default endpoint is localhost, then default mtls endpoint will be the same. -# This method modifies the default endpoint so the client can produce a different -# mtls endpoint for endpoint testing purposes. -def modify_default_endpoint(client): - return "foo.googleapis.com" if ("localhost" in client.DEFAULT_ENDPOINT) else client.DEFAULT_ENDPOINT - - -def test__get_default_mtls_endpoint(): - api_endpoint = "example.googleapis.com" - api_mtls_endpoint = "example.mtls.googleapis.com" - sandbox_endpoint = "example.sandbox.googleapis.com" - sandbox_mtls_endpoint = "example.mtls.sandbox.googleapis.com" - non_googleapi = "api.example.com" - - assert CertificateAuthorityServiceClient._get_default_mtls_endpoint(None) is None - assert CertificateAuthorityServiceClient._get_default_mtls_endpoint(api_endpoint) == api_mtls_endpoint - assert CertificateAuthorityServiceClient._get_default_mtls_endpoint(api_mtls_endpoint) == api_mtls_endpoint - assert CertificateAuthorityServiceClient._get_default_mtls_endpoint(sandbox_endpoint) == sandbox_mtls_endpoint - assert CertificateAuthorityServiceClient._get_default_mtls_endpoint(sandbox_mtls_endpoint) == sandbox_mtls_endpoint - assert CertificateAuthorityServiceClient._get_default_mtls_endpoint(non_googleapi) == non_googleapi - - -@pytest.mark.parametrize("client_class,transport_name", [ - (CertificateAuthorityServiceClient, "grpc"), - (CertificateAuthorityServiceAsyncClient, "grpc_asyncio"), -]) -def test_certificate_authority_service_client_from_service_account_info(client_class, transport_name): - creds = ga_credentials.AnonymousCredentials() - with mock.patch.object(service_account.Credentials, 'from_service_account_info') as factory: - factory.return_value = creds - info = {"valid": True} - client = client_class.from_service_account_info(info, transport=transport_name) - assert client.transport._credentials == creds - assert isinstance(client, client_class) - - assert client.transport._host == ( - 'privateca.googleapis.com:443' - ) - - -@pytest.mark.parametrize("transport_class,transport_name", [ - (transports.CertificateAuthorityServiceGrpcTransport, "grpc"), - (transports.CertificateAuthorityServiceGrpcAsyncIOTransport, "grpc_asyncio"), -]) -def test_certificate_authority_service_client_service_account_always_use_jwt(transport_class, transport_name): - with mock.patch.object(service_account.Credentials, 'with_always_use_jwt_access', create=True) as use_jwt: - creds = service_account.Credentials(None, None, None) - transport = transport_class(credentials=creds, always_use_jwt_access=True) - use_jwt.assert_called_once_with(True) - - with mock.patch.object(service_account.Credentials, 'with_always_use_jwt_access', create=True) as use_jwt: - creds = service_account.Credentials(None, None, None) - transport = transport_class(credentials=creds, always_use_jwt_access=False) - use_jwt.assert_not_called() - - -@pytest.mark.parametrize("client_class,transport_name", [ - (CertificateAuthorityServiceClient, "grpc"), - (CertificateAuthorityServiceAsyncClient, "grpc_asyncio"), -]) -def test_certificate_authority_service_client_from_service_account_file(client_class, transport_name): - creds = ga_credentials.AnonymousCredentials() - with mock.patch.object(service_account.Credentials, 'from_service_account_file') as factory: - factory.return_value = creds - client = client_class.from_service_account_file("dummy/file/path.json", transport=transport_name) - assert client.transport._credentials == creds - assert isinstance(client, client_class) - - client = client_class.from_service_account_json("dummy/file/path.json", transport=transport_name) - assert client.transport._credentials == creds - assert isinstance(client, client_class) - - assert client.transport._host == ( - 'privateca.googleapis.com:443' - ) - - -def test_certificate_authority_service_client_get_transport_class(): - transport = CertificateAuthorityServiceClient.get_transport_class() - available_transports = [ - transports.CertificateAuthorityServiceGrpcTransport, - ] - assert transport in available_transports - - transport = CertificateAuthorityServiceClient.get_transport_class("grpc") - assert transport == transports.CertificateAuthorityServiceGrpcTransport - - -@pytest.mark.parametrize("client_class,transport_class,transport_name", [ - (CertificateAuthorityServiceClient, transports.CertificateAuthorityServiceGrpcTransport, "grpc"), - (CertificateAuthorityServiceAsyncClient, transports.CertificateAuthorityServiceGrpcAsyncIOTransport, "grpc_asyncio"), -]) -@mock.patch.object(CertificateAuthorityServiceClient, "DEFAULT_ENDPOINT", modify_default_endpoint(CertificateAuthorityServiceClient)) -@mock.patch.object(CertificateAuthorityServiceAsyncClient, "DEFAULT_ENDPOINT", modify_default_endpoint(CertificateAuthorityServiceAsyncClient)) -def test_certificate_authority_service_client_client_options(client_class, transport_class, transport_name): - # Check that if channel is provided we won't create a new one. - with mock.patch.object(CertificateAuthorityServiceClient, 'get_transport_class') as gtc: - transport = transport_class( - credentials=ga_credentials.AnonymousCredentials() - ) - client = client_class(transport=transport) - gtc.assert_not_called() - - # Check that if channel is provided via str we will create a new one. - with mock.patch.object(CertificateAuthorityServiceClient, 'get_transport_class') as gtc: - client = client_class(transport=transport_name) - gtc.assert_called() - - # Check the case api_endpoint is provided. - options = client_options.ClientOptions(api_endpoint="squid.clam.whelk") - with mock.patch.object(transport_class, '__init__') as patched: - patched.return_value = None - client = client_class(transport=transport_name, client_options=options) - patched.assert_called_once_with( - credentials=None, - credentials_file=None, - host="squid.clam.whelk", - scopes=None, - client_cert_source_for_mtls=None, - quota_project_id=None, - client_info=transports.base.DEFAULT_CLIENT_INFO, - always_use_jwt_access=True, - api_audience=None, - ) - - # Check the case api_endpoint is not provided and GOOGLE_API_USE_MTLS_ENDPOINT is - # "never". - with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "never"}): - with mock.patch.object(transport_class, '__init__') as patched: - patched.return_value = None - client = client_class(transport=transport_name) - patched.assert_called_once_with( - credentials=None, - credentials_file=None, - host=client.DEFAULT_ENDPOINT, - scopes=None, - client_cert_source_for_mtls=None, - quota_project_id=None, - client_info=transports.base.DEFAULT_CLIENT_INFO, - always_use_jwt_access=True, - api_audience=None, - ) - - # Check the case api_endpoint is not provided and GOOGLE_API_USE_MTLS_ENDPOINT is - # "always". - with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "always"}): - with mock.patch.object(transport_class, '__init__') as patched: - patched.return_value = None - client = client_class(transport=transport_name) - patched.assert_called_once_with( - credentials=None, - credentials_file=None, - host=client.DEFAULT_MTLS_ENDPOINT, - scopes=None, - client_cert_source_for_mtls=None, - quota_project_id=None, - client_info=transports.base.DEFAULT_CLIENT_INFO, - always_use_jwt_access=True, - api_audience=None, - ) - - # Check the case api_endpoint is not provided and GOOGLE_API_USE_MTLS_ENDPOINT has - # unsupported value. - with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "Unsupported"}): - with pytest.raises(MutualTLSChannelError): - client = client_class(transport=transport_name) - - # Check the case GOOGLE_API_USE_CLIENT_CERTIFICATE has unsupported value. - with mock.patch.dict(os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": "Unsupported"}): - with pytest.raises(ValueError): - client = client_class(transport=transport_name) - - # Check the case quota_project_id is provided - options = client_options.ClientOptions(quota_project_id="octopus") - with mock.patch.object(transport_class, '__init__') as patched: - patched.return_value = None - client = client_class(client_options=options, transport=transport_name) - patched.assert_called_once_with( - credentials=None, - credentials_file=None, - host=client.DEFAULT_ENDPOINT, - scopes=None, - client_cert_source_for_mtls=None, - quota_project_id="octopus", - client_info=transports.base.DEFAULT_CLIENT_INFO, - always_use_jwt_access=True, - api_audience=None, - ) - # Check the case api_endpoint is provided - options = client_options.ClientOptions(api_audience="https://language.googleapis.com") - with mock.patch.object(transport_class, '__init__') as patched: - patched.return_value = None - client = client_class(client_options=options, transport=transport_name) - patched.assert_called_once_with( - credentials=None, - credentials_file=None, - host=client.DEFAULT_ENDPOINT, - scopes=None, - client_cert_source_for_mtls=None, - quota_project_id=None, - client_info=transports.base.DEFAULT_CLIENT_INFO, - always_use_jwt_access=True, - api_audience="https://language.googleapis.com" - ) - -@pytest.mark.parametrize("client_class,transport_class,transport_name,use_client_cert_env", [ - (CertificateAuthorityServiceClient, transports.CertificateAuthorityServiceGrpcTransport, "grpc", "true"), - (CertificateAuthorityServiceAsyncClient, transports.CertificateAuthorityServiceGrpcAsyncIOTransport, "grpc_asyncio", "true"), - (CertificateAuthorityServiceClient, transports.CertificateAuthorityServiceGrpcTransport, "grpc", "false"), - (CertificateAuthorityServiceAsyncClient, transports.CertificateAuthorityServiceGrpcAsyncIOTransport, "grpc_asyncio", "false"), -]) -@mock.patch.object(CertificateAuthorityServiceClient, "DEFAULT_ENDPOINT", modify_default_endpoint(CertificateAuthorityServiceClient)) -@mock.patch.object(CertificateAuthorityServiceAsyncClient, "DEFAULT_ENDPOINT", modify_default_endpoint(CertificateAuthorityServiceAsyncClient)) -@mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "auto"}) -def test_certificate_authority_service_client_mtls_env_auto(client_class, transport_class, transport_name, use_client_cert_env): - # This tests the endpoint autoswitch behavior. Endpoint is autoswitched to the default - # mtls endpoint, if GOOGLE_API_USE_CLIENT_CERTIFICATE is "true" and client cert exists. - - # Check the case client_cert_source is provided. Whether client cert is used depends on - # GOOGLE_API_USE_CLIENT_CERTIFICATE value. - with mock.patch.dict(os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": use_client_cert_env}): - options = client_options.ClientOptions(client_cert_source=client_cert_source_callback) - with mock.patch.object(transport_class, '__init__') as patched: - patched.return_value = None - client = client_class(client_options=options, transport=transport_name) - - if use_client_cert_env == "false": - expected_client_cert_source = None - expected_host = client.DEFAULT_ENDPOINT - else: - expected_client_cert_source = client_cert_source_callback - expected_host = client.DEFAULT_MTLS_ENDPOINT - - patched.assert_called_once_with( - credentials=None, - credentials_file=None, - host=expected_host, - scopes=None, - client_cert_source_for_mtls=expected_client_cert_source, - quota_project_id=None, - client_info=transports.base.DEFAULT_CLIENT_INFO, - always_use_jwt_access=True, - api_audience=None, - ) - - # Check the case ADC client cert is provided. Whether client cert is used depends on - # GOOGLE_API_USE_CLIENT_CERTIFICATE value. - with mock.patch.dict(os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": use_client_cert_env}): - with mock.patch.object(transport_class, '__init__') as patched: - with mock.patch('google.auth.transport.mtls.has_default_client_cert_source', return_value=True): - with mock.patch('google.auth.transport.mtls.default_client_cert_source', return_value=client_cert_source_callback): - if use_client_cert_env == "false": - expected_host = client.DEFAULT_ENDPOINT - expected_client_cert_source = None - else: - expected_host = client.DEFAULT_MTLS_ENDPOINT - expected_client_cert_source = client_cert_source_callback - - patched.return_value = None - client = client_class(transport=transport_name) - patched.assert_called_once_with( - credentials=None, - credentials_file=None, - host=expected_host, - scopes=None, - client_cert_source_for_mtls=expected_client_cert_source, - quota_project_id=None, - client_info=transports.base.DEFAULT_CLIENT_INFO, - always_use_jwt_access=True, - api_audience=None, - ) - - # Check the case client_cert_source and ADC client cert are not provided. - with mock.patch.dict(os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": use_client_cert_env}): - with mock.patch.object(transport_class, '__init__') as patched: - with mock.patch("google.auth.transport.mtls.has_default_client_cert_source", return_value=False): - patched.return_value = None - client = client_class(transport=transport_name) - patched.assert_called_once_with( - credentials=None, - credentials_file=None, - host=client.DEFAULT_ENDPOINT, - scopes=None, - client_cert_source_for_mtls=None, - quota_project_id=None, - client_info=transports.base.DEFAULT_CLIENT_INFO, - always_use_jwt_access=True, - api_audience=None, - ) - - -@pytest.mark.parametrize("client_class", [ - CertificateAuthorityServiceClient, CertificateAuthorityServiceAsyncClient -]) -@mock.patch.object(CertificateAuthorityServiceClient, "DEFAULT_ENDPOINT", modify_default_endpoint(CertificateAuthorityServiceClient)) -@mock.patch.object(CertificateAuthorityServiceAsyncClient, "DEFAULT_ENDPOINT", modify_default_endpoint(CertificateAuthorityServiceAsyncClient)) -def test_certificate_authority_service_client_get_mtls_endpoint_and_cert_source(client_class): - mock_client_cert_source = mock.Mock() - - # Test the case GOOGLE_API_USE_CLIENT_CERTIFICATE is "true". - with mock.patch.dict(os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": "true"}): - mock_api_endpoint = "foo" - options = client_options.ClientOptions(client_cert_source=mock_client_cert_source, api_endpoint=mock_api_endpoint) - api_endpoint, cert_source = client_class.get_mtls_endpoint_and_cert_source(options) - assert api_endpoint == mock_api_endpoint - assert cert_source == mock_client_cert_source - - # Test the case GOOGLE_API_USE_CLIENT_CERTIFICATE is "false". - with mock.patch.dict(os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": "false"}): - mock_client_cert_source = mock.Mock() - mock_api_endpoint = "foo" - options = client_options.ClientOptions(client_cert_source=mock_client_cert_source, api_endpoint=mock_api_endpoint) - api_endpoint, cert_source = client_class.get_mtls_endpoint_and_cert_source(options) - assert api_endpoint == mock_api_endpoint - assert cert_source is None - - # Test the case GOOGLE_API_USE_MTLS_ENDPOINT is "never". - with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "never"}): - api_endpoint, cert_source = client_class.get_mtls_endpoint_and_cert_source() - assert api_endpoint == client_class.DEFAULT_ENDPOINT - assert cert_source is None - - # Test the case GOOGLE_API_USE_MTLS_ENDPOINT is "always". - with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "always"}): - api_endpoint, cert_source = client_class.get_mtls_endpoint_and_cert_source() - assert api_endpoint == client_class.DEFAULT_MTLS_ENDPOINT - assert cert_source is None - - # Test the case GOOGLE_API_USE_MTLS_ENDPOINT is "auto" and default cert doesn't exist. - with mock.patch.dict(os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": "true"}): - with mock.patch('google.auth.transport.mtls.has_default_client_cert_source', return_value=False): - api_endpoint, cert_source = client_class.get_mtls_endpoint_and_cert_source() - assert api_endpoint == client_class.DEFAULT_ENDPOINT - assert cert_source is None - - # Test the case GOOGLE_API_USE_MTLS_ENDPOINT is "auto" and default cert exists. - with mock.patch.dict(os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": "true"}): - with mock.patch('google.auth.transport.mtls.has_default_client_cert_source', return_value=True): - with mock.patch('google.auth.transport.mtls.default_client_cert_source', return_value=mock_client_cert_source): - api_endpoint, cert_source = client_class.get_mtls_endpoint_and_cert_source() - assert api_endpoint == client_class.DEFAULT_MTLS_ENDPOINT - assert cert_source == mock_client_cert_source - - -@pytest.mark.parametrize("client_class,transport_class,transport_name", [ - (CertificateAuthorityServiceClient, transports.CertificateAuthorityServiceGrpcTransport, "grpc"), - (CertificateAuthorityServiceAsyncClient, transports.CertificateAuthorityServiceGrpcAsyncIOTransport, "grpc_asyncio"), -]) -def test_certificate_authority_service_client_client_options_scopes(client_class, transport_class, transport_name): - # Check the case scopes are provided. - options = client_options.ClientOptions( - scopes=["1", "2"], - ) - with mock.patch.object(transport_class, '__init__') as patched: - patched.return_value = None - client = client_class(client_options=options, transport=transport_name) - patched.assert_called_once_with( - credentials=None, - credentials_file=None, - host=client.DEFAULT_ENDPOINT, - scopes=["1", "2"], - client_cert_source_for_mtls=None, - quota_project_id=None, - client_info=transports.base.DEFAULT_CLIENT_INFO, - always_use_jwt_access=True, - api_audience=None, - ) - -@pytest.mark.parametrize("client_class,transport_class,transport_name,grpc_helpers", [ - (CertificateAuthorityServiceClient, transports.CertificateAuthorityServiceGrpcTransport, "grpc", grpc_helpers), - (CertificateAuthorityServiceAsyncClient, transports.CertificateAuthorityServiceGrpcAsyncIOTransport, "grpc_asyncio", grpc_helpers_async), -]) -def test_certificate_authority_service_client_client_options_credentials_file(client_class, transport_class, transport_name, grpc_helpers): - # Check the case credentials file is provided. - options = client_options.ClientOptions( - credentials_file="credentials.json" - ) - - with mock.patch.object(transport_class, '__init__') as patched: - patched.return_value = None - client = client_class(client_options=options, transport=transport_name) - patched.assert_called_once_with( - credentials=None, - credentials_file="credentials.json", - host=client.DEFAULT_ENDPOINT, - scopes=None, - client_cert_source_for_mtls=None, - quota_project_id=None, - client_info=transports.base.DEFAULT_CLIENT_INFO, - always_use_jwt_access=True, - api_audience=None, - ) - -def test_certificate_authority_service_client_client_options_from_dict(): - with mock.patch('google.cloud.security.privateca_v1.services.certificate_authority_service.transports.CertificateAuthorityServiceGrpcTransport.__init__') as grpc_transport: - grpc_transport.return_value = None - client = CertificateAuthorityServiceClient( - client_options={'api_endpoint': 'squid.clam.whelk'} - ) - grpc_transport.assert_called_once_with( - credentials=None, - credentials_file=None, - host="squid.clam.whelk", - scopes=None, - client_cert_source_for_mtls=None, - quota_project_id=None, - client_info=transports.base.DEFAULT_CLIENT_INFO, - always_use_jwt_access=True, - api_audience=None, - ) - - -@pytest.mark.parametrize("client_class,transport_class,transport_name,grpc_helpers", [ - (CertificateAuthorityServiceClient, transports.CertificateAuthorityServiceGrpcTransport, "grpc", grpc_helpers), - (CertificateAuthorityServiceAsyncClient, transports.CertificateAuthorityServiceGrpcAsyncIOTransport, "grpc_asyncio", grpc_helpers_async), -]) -def test_certificate_authority_service_client_create_channel_credentials_file(client_class, transport_class, transport_name, grpc_helpers): - # Check the case credentials file is provided. - options = client_options.ClientOptions( - credentials_file="credentials.json" - ) - - with mock.patch.object(transport_class, '__init__') as patched: - patched.return_value = None - client = client_class(client_options=options, transport=transport_name) - patched.assert_called_once_with( - credentials=None, - credentials_file="credentials.json", - host=client.DEFAULT_ENDPOINT, - scopes=None, - client_cert_source_for_mtls=None, - quota_project_id=None, - client_info=transports.base.DEFAULT_CLIENT_INFO, - always_use_jwt_access=True, - api_audience=None, - ) - - # test that the credentials from file are saved and used as the credentials. - with mock.patch.object( - google.auth, "load_credentials_from_file", autospec=True - ) as load_creds, mock.patch.object( - google.auth, "default", autospec=True - ) as adc, mock.patch.object( - grpc_helpers, "create_channel" - ) as create_channel: - creds = ga_credentials.AnonymousCredentials() - file_creds = ga_credentials.AnonymousCredentials() - load_creds.return_value = (file_creds, None) - adc.return_value = (creds, None) - client = client_class(client_options=options, transport=transport_name) - create_channel.assert_called_with( - "privateca.googleapis.com:443", - credentials=file_creds, - credentials_file=None, - quota_project_id=None, - default_scopes=( - 'https://www.googleapis.com/auth/cloud-platform', -), - scopes=None, - default_host="privateca.googleapis.com", - ssl_credentials=None, - options=[ - ("grpc.max_send_message_length", -1), - ("grpc.max_receive_message_length", -1), - ], - ) - - -@pytest.mark.parametrize("request_type", [ - service.CreateCertificateRequest, - dict, -]) -def test_create_certificate(request_type, transport: str = 'grpc'): - client = CertificateAuthorityServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.create_certificate), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = resources.Certificate( - name='name_value', - issuer_certificate_authority='issuer_certificate_authority_value', - certificate_template='certificate_template_value', - subject_mode=resources.SubjectRequestMode.DEFAULT, - pem_certificate='pem_certificate_value', - 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'] - - -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=ga_credentials.AnonymousCredentials(), - transport='grpc', - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.create_certificate), - '__call__') as call: - client.create_certificate() - call.assert_called() - _, args, _ = call.mock_calls[0] - assert args[0] == service.CreateCertificateRequest() - -@pytest.mark.asyncio -async def test_create_certificate_async(transport: str = 'grpc_asyncio', request_type=service.CreateCertificateRequest): - client = CertificateAuthorityServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.create_certificate), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(resources.Certificate( - name='name_value', - issuer_certificate_authority='issuer_certificate_authority_value', - certificate_template='certificate_template_value', - subject_mode=resources.SubjectRequestMode.DEFAULT, - pem_certificate='pem_certificate_value', - 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'] - - -@pytest.mark.asyncio -async def test_create_certificate_async_from_dict(): - await test_create_certificate_async(request_type=dict) - - -def test_create_certificate_field_headers(): - client = CertificateAuthorityServiceClient( - 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. - with mock.patch.object( - 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. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ( - 'x-goog-request-params', - 'parent=parent_value', - ) in kw['metadata'] - - -@pytest.mark.asyncio -async def test_create_certificate_field_headers_async(): - client = CertificateAuthorityServiceAsyncClient( - 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. - with mock.patch.object( - type(client.transport.create_certificate), - '__call__') as call: - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(resources.Certificate()) - 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] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ( - 'x-goog-request-params', - 'parent=parent_value', - ) in kw['metadata'] - - -def test_create_certificate_flattened(): - client = CertificateAuthorityServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.create_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.create_certificate( - parent='parent_value', - certificate=resources.Certificate(name='name_value'), - certificate_id='certificate_id_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] - arg = args[0].parent - mock_val = 'parent_value' - assert arg == mock_val - arg = args[0].certificate - mock_val = resources.Certificate(name='name_value') - assert arg == mock_val - arg = args[0].certificate_id - mock_val = 'certificate_id_value' - assert arg == mock_val - - -def test_create_certificate_flattened_error(): - client = CertificateAuthorityServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Attempting to call a method with both a request object and flattened - # fields is an error. - with pytest.raises(ValueError): - client.create_certificate( - service.CreateCertificateRequest(), - parent='parent_value', - certificate=resources.Certificate(name='name_value'), - certificate_id='certificate_id_value', - ) - -@pytest.mark.asyncio -async def test_create_certificate_flattened_async(): - client = CertificateAuthorityServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.create_certificate), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = resources.Certificate() - - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(resources.Certificate()) - # Call the method with a truthy value for each flattened field, - # using the keyword arguments to the method. - response = await client.create_certificate( - parent='parent_value', - certificate=resources.Certificate(name='name_value'), - certificate_id='certificate_id_value', - ) - - # Establish that the underlying call was made with the expected - # request object values. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - arg = args[0].parent - mock_val = 'parent_value' - assert arg == mock_val - arg = args[0].certificate - mock_val = resources.Certificate(name='name_value') - assert arg == mock_val - arg = args[0].certificate_id - mock_val = 'certificate_id_value' - assert arg == mock_val - -@pytest.mark.asyncio -async def test_create_certificate_flattened_error_async(): - client = CertificateAuthorityServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Attempting to call a method with both a request object and flattened - # fields is an error. - with pytest.raises(ValueError): - await client.create_certificate( - service.CreateCertificateRequest(), - parent='parent_value', - certificate=resources.Certificate(name='name_value'), - certificate_id='certificate_id_value', - ) - - -@pytest.mark.parametrize("request_type", [ - service.GetCertificateRequest, - dict, -]) -def test_get_certificate(request_type, transport: str = 'grpc'): - client = CertificateAuthorityServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # 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( - name='name_value', - issuer_certificate_authority='issuer_certificate_authority_value', - certificate_template='certificate_template_value', - subject_mode=resources.SubjectRequestMode.DEFAULT, - pem_certificate='pem_certificate_value', - 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'] - - -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=ga_credentials.AnonymousCredentials(), - transport='grpc', - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.get_certificate), - '__call__') as call: - client.get_certificate() - call.assert_called() - _, args, _ = call.mock_calls[0] - assert args[0] == service.GetCertificateRequest() - -@pytest.mark.asyncio -async def test_get_certificate_async(transport: str = 'grpc_asyncio', request_type=service.GetCertificateRequest): - client = CertificateAuthorityServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # 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 =grpc_helpers_async.FakeUnaryUnaryCall(resources.Certificate( - name='name_value', - issuer_certificate_authority='issuer_certificate_authority_value', - certificate_template='certificate_template_value', - subject_mode=resources.SubjectRequestMode.DEFAULT, - pem_certificate='pem_certificate_value', - 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'] - - -@pytest.mark.asyncio -async def test_get_certificate_async_from_dict(): - await test_get_certificate_async(request_type=dict) - - -def test_get_certificate_field_headers(): - client = CertificateAuthorityServiceClient( - 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. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ( - 'x-goog-request-params', - 'name=name_value', - ) in kw['metadata'] - - -@pytest.mark.asyncio -async def test_get_certificate_field_headers_async(): - client = CertificateAuthorityServiceAsyncClient( - 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 = grpc_helpers_async.FakeUnaryUnaryCall(resources.Certificate()) - 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] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ( - 'x-goog-request-params', - 'name=name_value', - ) in kw['metadata'] - - -def test_get_certificate_flattened(): - client = CertificateAuthorityServiceClient( - 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', - ) - - # Establish that the underlying call was made with the expected - # request object values. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - arg = args[0].name - mock_val = 'name_value' - assert arg == mock_val - - -def test_get_certificate_flattened_error(): - client = CertificateAuthorityServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Attempting to call a method with both a request object and flattened - # fields is an error. - with pytest.raises(ValueError): - client.get_certificate( - service.GetCertificateRequest(), - name='name_value', - ) - -@pytest.mark.asyncio -async def test_get_certificate_flattened_async(): - client = CertificateAuthorityServiceAsyncClient( - 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.return_value = grpc_helpers_async.FakeUnaryUnaryCall(resources.Certificate()) - # Call the method with a truthy value for each flattened field, - # using the keyword arguments to the method. - response = await client.get_certificate( - name='name_value', - ) - - # Establish that the underlying call was made with the expected - # request object values. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - arg = args[0].name - mock_val = 'name_value' - assert arg == mock_val - -@pytest.mark.asyncio -async def test_get_certificate_flattened_error_async(): - client = CertificateAuthorityServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Attempting to call a method with both a request object and flattened - # fields is an error. - with pytest.raises(ValueError): - await client.get_certificate( - service.GetCertificateRequest(), - name='name_value', - ) - - -@pytest.mark.parametrize("request_type", [ - service.ListCertificatesRequest, - dict, -]) -def test_list_certificates(request_type, transport: str = 'grpc'): - client = CertificateAuthorityServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_certificates), - '__call__') as call: - # Designate an appropriate return value for the call. - 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'] - - -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=ga_credentials.AnonymousCredentials(), - transport='grpc', - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_certificates), - '__call__') as call: - client.list_certificates() - call.assert_called() - _, args, _ = call.mock_calls[0] - assert args[0] == service.ListCertificatesRequest() - -@pytest.mark.asyncio -async def test_list_certificates_async(transport: str = 'grpc_asyncio', request_type=service.ListCertificatesRequest): - client = CertificateAuthorityServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_certificates), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(service.ListCertificatesResponse( - next_page_token='next_page_token_value', - 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'] - - -@pytest.mark.asyncio -async def test_list_certificates_async_from_dict(): - await test_list_certificates_async(request_type=dict) - - -def test_list_certificates_field_headers(): - client = CertificateAuthorityServiceClient( - 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. - with mock.patch.object( - 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. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ( - 'x-goog-request-params', - 'parent=parent_value', - ) in kw['metadata'] - - -@pytest.mark.asyncio -async def test_list_certificates_field_headers_async(): - client = CertificateAuthorityServiceAsyncClient( - 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. - with mock.patch.object( - type(client.transport.list_certificates), - '__call__') as call: - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(service.ListCertificatesResponse()) - 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] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ( - 'x-goog-request-params', - 'parent=parent_value', - ) in kw['metadata'] - - -def test_list_certificates_flattened(): - client = CertificateAuthorityServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_certificates), - '__call__') 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', - ) - - # Establish that the underlying call was made with the expected - # request object values. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - arg = args[0].parent - mock_val = 'parent_value' - assert arg == mock_val - - -def test_list_certificates_flattened_error(): - client = CertificateAuthorityServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Attempting to call a method with both a request object and flattened - # fields is an error. - with pytest.raises(ValueError): - client.list_certificates( - service.ListCertificatesRequest(), - parent='parent_value', - ) - -@pytest.mark.asyncio -async def test_list_certificates_flattened_async(): - client = CertificateAuthorityServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_certificates), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = service.ListCertificatesResponse() - - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(service.ListCertificatesResponse()) - # Call the method with a truthy value for each flattened field, - # using the keyword arguments to the method. - response = await client.list_certificates( - parent='parent_value', - ) - - # Establish that the underlying call was made with the expected - # request object values. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - arg = args[0].parent - mock_val = 'parent_value' - assert arg == mock_val - -@pytest.mark.asyncio -async def test_list_certificates_flattened_error_async(): - client = CertificateAuthorityServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Attempting to call a method with both a request object and flattened - # fields is an error. - with pytest.raises(ValueError): - await client.list_certificates( - service.ListCertificatesRequest(), - parent='parent_value', - ) - - -def test_list_certificates_pager(transport_name: str = "grpc"): - client = CertificateAuthorityServiceClient( - credentials=ga_credentials.AnonymousCredentials, - transport=transport_name, - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_certificates), - '__call__') as call: - # Set the response to a series of pages. - call.side_effect = ( - service.ListCertificatesResponse( - certificates=[ - resources.Certificate(), - resources.Certificate(), - resources.Certificate(), - ], - next_page_token='abc', - ), - service.ListCertificatesResponse( - certificates=[], - next_page_token='def', - ), - service.ListCertificatesResponse( - certificates=[ - resources.Certificate(), - ], - next_page_token='ghi', - ), - service.ListCertificatesResponse( - certificates=[ - resources.Certificate(), - resources.Certificate(), - ], - ), - RuntimeError, - ) - - metadata = () - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata(( - ('parent', ''), - )), - ) - pager = client.list_certificates(request={}) - - assert pager._metadata == metadata - - results = list(pager) - assert len(results) == 6 - assert all(isinstance(i, resources.Certificate) - for i in results) -def test_list_certificates_pages(transport_name: str = "grpc"): - client = CertificateAuthorityServiceClient( - credentials=ga_credentials.AnonymousCredentials, - transport=transport_name, - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_certificates), - '__call__') as call: - # Set the response to a series of pages. - call.side_effect = ( - service.ListCertificatesResponse( - certificates=[ - resources.Certificate(), - resources.Certificate(), - resources.Certificate(), - ], - next_page_token='abc', - ), - service.ListCertificatesResponse( - certificates=[], - next_page_token='def', - ), - service.ListCertificatesResponse( - certificates=[ - resources.Certificate(), - ], - next_page_token='ghi', - ), - service.ListCertificatesResponse( - certificates=[ - resources.Certificate(), - resources.Certificate(), - ], - ), - RuntimeError, - ) - pages = list(client.list_certificates(request={}).pages) - for page_, token in zip(pages, ['abc','def','ghi', '']): - assert page_.raw_page.next_page_token == token - -@pytest.mark.asyncio -async def test_list_certificates_async_pager(): - client = CertificateAuthorityServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials, - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_certificates), - '__call__', new_callable=mock.AsyncMock) as call: - # Set the response to a series of pages. - call.side_effect = ( - service.ListCertificatesResponse( - certificates=[ - resources.Certificate(), - resources.Certificate(), - resources.Certificate(), - ], - next_page_token='abc', - ), - service.ListCertificatesResponse( - certificates=[], - next_page_token='def', - ), - service.ListCertificatesResponse( - certificates=[ - resources.Certificate(), - ], - next_page_token='ghi', - ), - service.ListCertificatesResponse( - certificates=[ - resources.Certificate(), - resources.Certificate(), - ], - ), - RuntimeError, - ) - async_pager = await client.list_certificates(request={},) - assert async_pager.next_page_token == 'abc' - responses = [] - async for response in async_pager: # pragma: no branch - responses.append(response) - - assert len(responses) == 6 - assert all(isinstance(i, resources.Certificate) - for i in responses) - - -@pytest.mark.asyncio -async def test_list_certificates_async_pages(): - client = CertificateAuthorityServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials, - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_certificates), - '__call__', new_callable=mock.AsyncMock) as call: - # Set the response to a series of pages. - call.side_effect = ( - service.ListCertificatesResponse( - certificates=[ - resources.Certificate(), - resources.Certificate(), - resources.Certificate(), - ], - next_page_token='abc', - ), - service.ListCertificatesResponse( - certificates=[], - next_page_token='def', - ), - service.ListCertificatesResponse( - certificates=[ - resources.Certificate(), - ], - next_page_token='ghi', - ), - service.ListCertificatesResponse( - certificates=[ - resources.Certificate(), - resources.Certificate(), - ], - ), - RuntimeError, - ) - pages = [] - async for page_ in (await client.list_certificates(request={})).pages: # pragma: no branch - pages.append(page_) - for page_, token in zip(pages, ['abc','def','ghi', '']): - assert page_.raw_page.next_page_token == token - -@pytest.mark.parametrize("request_type", [ - service.RevokeCertificateRequest, - dict, -]) -def test_revoke_certificate(request_type, transport: str = 'grpc'): - client = CertificateAuthorityServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.revoke_certificate), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = resources.Certificate( - name='name_value', - issuer_certificate_authority='issuer_certificate_authority_value', - certificate_template='certificate_template_value', - subject_mode=resources.SubjectRequestMode.DEFAULT, - pem_certificate='pem_certificate_value', - 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'] - - -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=ga_credentials.AnonymousCredentials(), - transport='grpc', - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.revoke_certificate), - '__call__') as call: - client.revoke_certificate() - call.assert_called() - _, args, _ = call.mock_calls[0] - assert args[0] == service.RevokeCertificateRequest() - -@pytest.mark.asyncio -async def test_revoke_certificate_async(transport: str = 'grpc_asyncio', request_type=service.RevokeCertificateRequest): - client = CertificateAuthorityServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.revoke_certificate), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(resources.Certificate( - name='name_value', - issuer_certificate_authority='issuer_certificate_authority_value', - certificate_template='certificate_template_value', - subject_mode=resources.SubjectRequestMode.DEFAULT, - pem_certificate='pem_certificate_value', - 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'] - - -@pytest.mark.asyncio -async def test_revoke_certificate_async_from_dict(): - await test_revoke_certificate_async(request_type=dict) - - -def test_revoke_certificate_field_headers(): - client = CertificateAuthorityServiceClient( - 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. - with mock.patch.object( - 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. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ( - 'x-goog-request-params', - 'name=name_value', - ) in kw['metadata'] - - -@pytest.mark.asyncio -async def test_revoke_certificate_field_headers_async(): - client = CertificateAuthorityServiceAsyncClient( - 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. - with mock.patch.object( - type(client.transport.revoke_certificate), - '__call__') as call: - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(resources.Certificate()) - 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] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ( - 'x-goog-request-params', - 'name=name_value', - ) in kw['metadata'] - - -def test_revoke_certificate_flattened(): - client = CertificateAuthorityServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.revoke_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.revoke_certificate( - name='name_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] - arg = args[0].name - mock_val = 'name_value' - assert arg == mock_val - - -def test_revoke_certificate_flattened_error(): - client = CertificateAuthorityServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Attempting to call a method with both a request object and flattened - # fields is an error. - with pytest.raises(ValueError): - client.revoke_certificate( - service.RevokeCertificateRequest(), - name='name_value', - ) - -@pytest.mark.asyncio -async def test_revoke_certificate_flattened_async(): - client = CertificateAuthorityServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.revoke_certificate), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = resources.Certificate() - - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(resources.Certificate()) - # Call the method with a truthy value for each flattened field, - # using the keyword arguments to the method. - response = await client.revoke_certificate( - name='name_value', - ) - - # Establish that the underlying call was made with the expected - # request object values. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - arg = args[0].name - mock_val = 'name_value' - assert arg == mock_val - -@pytest.mark.asyncio -async def test_revoke_certificate_flattened_error_async(): - client = CertificateAuthorityServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Attempting to call a method with both a request object and flattened - # fields is an error. - with pytest.raises(ValueError): - await client.revoke_certificate( - service.RevokeCertificateRequest(), - name='name_value', - ) - - -@pytest.mark.parametrize("request_type", [ - service.UpdateCertificateRequest, - dict, -]) -def test_update_certificate(request_type, transport: str = 'grpc'): - client = CertificateAuthorityServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.update_certificate), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = resources.Certificate( - name='name_value', - issuer_certificate_authority='issuer_certificate_authority_value', - certificate_template='certificate_template_value', - subject_mode=resources.SubjectRequestMode.DEFAULT, - pem_certificate='pem_certificate_value', - 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'] - - -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=ga_credentials.AnonymousCredentials(), - transport='grpc', - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.update_certificate), - '__call__') as call: - client.update_certificate() - call.assert_called() - _, args, _ = call.mock_calls[0] - assert args[0] == service.UpdateCertificateRequest() - -@pytest.mark.asyncio -async def test_update_certificate_async(transport: str = 'grpc_asyncio', request_type=service.UpdateCertificateRequest): - client = CertificateAuthorityServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.update_certificate), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(resources.Certificate( - name='name_value', - issuer_certificate_authority='issuer_certificate_authority_value', - certificate_template='certificate_template_value', - subject_mode=resources.SubjectRequestMode.DEFAULT, - pem_certificate='pem_certificate_value', - 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'] - - -@pytest.mark.asyncio -async def test_update_certificate_async_from_dict(): - await test_update_certificate_async(request_type=dict) - - -def test_update_certificate_field_headers(): - client = CertificateAuthorityServiceClient( - 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 = 'name_value' - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - 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. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ( - 'x-goog-request-params', - 'certificate.name=name_value', - ) in kw['metadata'] - - -@pytest.mark.asyncio -async def test_update_certificate_field_headers_async(): - client = CertificateAuthorityServiceAsyncClient( - 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 = 'name_value' - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.update_certificate), - '__call__') as call: - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(resources.Certificate()) - 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] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ( - 'x-goog-request-params', - 'certificate.name=name_value', - ) in kw['metadata'] - - -def test_update_certificate_flattened(): - client = CertificateAuthorityServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.update_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.update_certificate( - certificate=resources.Certificate(name='name_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] - arg = args[0].certificate - mock_val = resources.Certificate(name='name_value') - assert arg == mock_val - arg = args[0].update_mask - mock_val = field_mask_pb2.FieldMask(paths=['paths_value']) - assert arg == mock_val - - -def test_update_certificate_flattened_error(): - client = CertificateAuthorityServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Attempting to call a method with both a request object and flattened - # fields is an error. - with pytest.raises(ValueError): - client.update_certificate( - service.UpdateCertificateRequest(), - certificate=resources.Certificate(name='name_value'), - update_mask=field_mask_pb2.FieldMask(paths=['paths_value']), - ) - -@pytest.mark.asyncio -async def test_update_certificate_flattened_async(): - client = CertificateAuthorityServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.update_certificate), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = resources.Certificate() - - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(resources.Certificate()) - # Call the method with a truthy value for each flattened field, - # using the keyword arguments to the method. - response = await client.update_certificate( - certificate=resources.Certificate(name='name_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] - arg = args[0].certificate - mock_val = resources.Certificate(name='name_value') - assert arg == mock_val - arg = args[0].update_mask - mock_val = field_mask_pb2.FieldMask(paths=['paths_value']) - assert arg == mock_val - -@pytest.mark.asyncio -async def test_update_certificate_flattened_error_async(): - client = CertificateAuthorityServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Attempting to call a method with both a request object and flattened - # fields is an error. - with pytest.raises(ValueError): - await client.update_certificate( - service.UpdateCertificateRequest(), - certificate=resources.Certificate(name='name_value'), - update_mask=field_mask_pb2.FieldMask(paths=['paths_value']), - ) - - -@pytest.mark.parametrize("request_type", [ - service.ActivateCertificateAuthorityRequest, - dict, -]) -def test_activate_certificate_authority(request_type, transport: str = 'grpc'): - client = CertificateAuthorityServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.activate_certificate_authority), - '__call__') 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. - assert isinstance(response, future.Future) - - -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=ga_credentials.AnonymousCredentials(), - transport='grpc', - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.activate_certificate_authority), - '__call__') as call: - client.activate_certificate_authority() - call.assert_called() - _, args, _ = call.mock_calls[0] - assert args[0] == service.ActivateCertificateAuthorityRequest() - -@pytest.mark.asyncio -async def test_activate_certificate_authority_async(transport: str = 'grpc_asyncio', request_type=service.ActivateCertificateAuthorityRequest): - client = CertificateAuthorityServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.activate_certificate_authority), - '__call__') as call: - # Designate an appropriate return value for the call. - 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. - assert isinstance(response, future.Future) - - -@pytest.mark.asyncio -async def test_activate_certificate_authority_async_from_dict(): - await test_activate_certificate_authority_async(request_type=dict) - - -def test_activate_certificate_authority_field_headers(): - client = CertificateAuthorityServiceClient( - 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. - with mock.patch.object( - 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. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ( - 'x-goog-request-params', - 'name=name_value', - ) in kw['metadata'] - - -@pytest.mark.asyncio -async def test_activate_certificate_authority_field_headers_async(): - client = CertificateAuthorityServiceAsyncClient( - 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. - with mock.patch.object( - type(client.transport.activate_certificate_authority), - '__call__') as call: - 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. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ( - 'x-goog-request-params', - 'name=name_value', - ) in kw['metadata'] - - -def test_activate_certificate_authority_flattened(): - client = CertificateAuthorityServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.activate_certificate_authority), - '__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.activate_certificate_authority( - name='name_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] - arg = args[0].name - mock_val = 'name_value' - assert arg == mock_val - - -def test_activate_certificate_authority_flattened_error(): - client = CertificateAuthorityServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Attempting to call a method with both a request object and flattened - # fields is an error. - with pytest.raises(ValueError): - client.activate_certificate_authority( - service.ActivateCertificateAuthorityRequest(), - name='name_value', - ) - -@pytest.mark.asyncio -async def test_activate_certificate_authority_flattened_async(): - client = CertificateAuthorityServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.activate_certificate_authority), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = operations_pb2.Operation(name='operations/op') - - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - operations_pb2.Operation(name='operations/spam') - ) - # Call the method with a truthy value for each flattened field, - # using the keyword arguments to the method. - response = await client.activate_certificate_authority( - name='name_value', - ) - - # Establish that the underlying call was made with the expected - # request object values. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - arg = args[0].name - mock_val = 'name_value' - assert arg == mock_val - -@pytest.mark.asyncio -async def test_activate_certificate_authority_flattened_error_async(): - client = CertificateAuthorityServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Attempting to call a method with both a request object and flattened - # fields is an error. - with pytest.raises(ValueError): - await client.activate_certificate_authority( - service.ActivateCertificateAuthorityRequest(), - name='name_value', - ) - - -@pytest.mark.parametrize("request_type", [ - service.CreateCertificateAuthorityRequest, - dict, -]) -def test_create_certificate_authority(request_type, transport: str = 'grpc'): - client = CertificateAuthorityServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.create_certificate_authority), - '__call__') 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. - assert isinstance(response, future.Future) - - -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=ga_credentials.AnonymousCredentials(), - transport='grpc', - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.create_certificate_authority), - '__call__') as call: - client.create_certificate_authority() - call.assert_called() - _, args, _ = call.mock_calls[0] - assert args[0] == service.CreateCertificateAuthorityRequest() - -@pytest.mark.asyncio -async def test_create_certificate_authority_async(transport: str = 'grpc_asyncio', request_type=service.CreateCertificateAuthorityRequest): - client = CertificateAuthorityServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.create_certificate_authority), - '__call__') as call: - # Designate an appropriate return value for the call. - 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. - assert isinstance(response, future.Future) - - -@pytest.mark.asyncio -async def test_create_certificate_authority_async_from_dict(): - await test_create_certificate_authority_async(request_type=dict) - - -def test_create_certificate_authority_field_headers(): - client = CertificateAuthorityServiceClient( - 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. - with mock.patch.object( - 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. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ( - 'x-goog-request-params', - 'parent=parent_value', - ) in kw['metadata'] - - -@pytest.mark.asyncio -async def test_create_certificate_authority_field_headers_async(): - client = CertificateAuthorityServiceAsyncClient( - 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. - with mock.patch.object( - type(client.transport.create_certificate_authority), - '__call__') as call: - 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. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ( - 'x-goog-request-params', - 'parent=parent_value', - ) in kw['metadata'] - - -def test_create_certificate_authority_flattened(): - client = CertificateAuthorityServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.create_certificate_authority), - '__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_certificate_authority( - parent='parent_value', - certificate_authority=resources.CertificateAuthority(name='name_value'), - certificate_authority_id='certificate_authority_id_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] - arg = args[0].parent - mock_val = 'parent_value' - assert arg == mock_val - arg = args[0].certificate_authority - mock_val = resources.CertificateAuthority(name='name_value') - assert arg == mock_val - arg = args[0].certificate_authority_id - mock_val = 'certificate_authority_id_value' - assert arg == mock_val - - -def test_create_certificate_authority_flattened_error(): - client = CertificateAuthorityServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Attempting to call a method with both a request object and flattened - # fields is an error. - with pytest.raises(ValueError): - client.create_certificate_authority( - service.CreateCertificateAuthorityRequest(), - parent='parent_value', - certificate_authority=resources.CertificateAuthority(name='name_value'), - certificate_authority_id='certificate_authority_id_value', - ) - -@pytest.mark.asyncio -async def test_create_certificate_authority_flattened_async(): - client = CertificateAuthorityServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.create_certificate_authority), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = operations_pb2.Operation(name='operations/op') - - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - operations_pb2.Operation(name='operations/spam') - ) - # Call the method with a truthy value for each flattened field, - # using the keyword arguments to the method. - response = await client.create_certificate_authority( - parent='parent_value', - certificate_authority=resources.CertificateAuthority(name='name_value'), - certificate_authority_id='certificate_authority_id_value', - ) - - # Establish that the underlying call was made with the expected - # request object values. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - arg = args[0].parent - mock_val = 'parent_value' - assert arg == mock_val - arg = args[0].certificate_authority - mock_val = resources.CertificateAuthority(name='name_value') - assert arg == mock_val - arg = args[0].certificate_authority_id - mock_val = 'certificate_authority_id_value' - assert arg == mock_val - -@pytest.mark.asyncio -async def test_create_certificate_authority_flattened_error_async(): - client = CertificateAuthorityServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Attempting to call a method with both a request object and flattened - # fields is an error. - with pytest.raises(ValueError): - await client.create_certificate_authority( - service.CreateCertificateAuthorityRequest(), - parent='parent_value', - certificate_authority=resources.CertificateAuthority(name='name_value'), - certificate_authority_id='certificate_authority_id_value', - ) - - -@pytest.mark.parametrize("request_type", [ - service.DisableCertificateAuthorityRequest, - dict, -]) -def test_disable_certificate_authority(request_type, transport: str = 'grpc'): - client = CertificateAuthorityServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.disable_certificate_authority), - '__call__') 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. - assert isinstance(response, future.Future) - - -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=ga_credentials.AnonymousCredentials(), - transport='grpc', - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.disable_certificate_authority), - '__call__') as call: - client.disable_certificate_authority() - call.assert_called() - _, args, _ = call.mock_calls[0] - assert args[0] == service.DisableCertificateAuthorityRequest() - -@pytest.mark.asyncio -async def test_disable_certificate_authority_async(transport: str = 'grpc_asyncio', request_type=service.DisableCertificateAuthorityRequest): - client = CertificateAuthorityServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.disable_certificate_authority), - '__call__') as call: - # Designate an appropriate return value for the call. - 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. - assert isinstance(response, future.Future) - - -@pytest.mark.asyncio -async def test_disable_certificate_authority_async_from_dict(): - await test_disable_certificate_authority_async(request_type=dict) - - -def test_disable_certificate_authority_field_headers(): - client = CertificateAuthorityServiceClient( - 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. - with mock.patch.object( - 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. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ( - 'x-goog-request-params', - 'name=name_value', - ) in kw['metadata'] - - -@pytest.mark.asyncio -async def test_disable_certificate_authority_field_headers_async(): - client = CertificateAuthorityServiceAsyncClient( - 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. - with mock.patch.object( - type(client.transport.disable_certificate_authority), - '__call__') as call: - 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. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ( - 'x-goog-request-params', - 'name=name_value', - ) in kw['metadata'] - - -def test_disable_certificate_authority_flattened(): - client = CertificateAuthorityServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.disable_certificate_authority), - '__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.disable_certificate_authority( - name='name_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] - arg = args[0].name - mock_val = 'name_value' - assert arg == mock_val - - -def test_disable_certificate_authority_flattened_error(): - client = CertificateAuthorityServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Attempting to call a method with both a request object and flattened - # fields is an error. - with pytest.raises(ValueError): - client.disable_certificate_authority( - service.DisableCertificateAuthorityRequest(), - name='name_value', - ) - -@pytest.mark.asyncio -async def test_disable_certificate_authority_flattened_async(): - client = CertificateAuthorityServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.disable_certificate_authority), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = operations_pb2.Operation(name='operations/op') - - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - operations_pb2.Operation(name='operations/spam') - ) - # Call the method with a truthy value for each flattened field, - # using the keyword arguments to the method. - response = await client.disable_certificate_authority( - name='name_value', - ) - - # Establish that the underlying call was made with the expected - # request object values. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - arg = args[0].name - mock_val = 'name_value' - assert arg == mock_val - -@pytest.mark.asyncio -async def test_disable_certificate_authority_flattened_error_async(): - client = CertificateAuthorityServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Attempting to call a method with both a request object and flattened - # fields is an error. - with pytest.raises(ValueError): - await client.disable_certificate_authority( - service.DisableCertificateAuthorityRequest(), - name='name_value', - ) - - -@pytest.mark.parametrize("request_type", [ - service.EnableCertificateAuthorityRequest, - dict, -]) -def test_enable_certificate_authority(request_type, transport: str = 'grpc'): - client = CertificateAuthorityServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.enable_certificate_authority), - '__call__') 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. - assert isinstance(response, future.Future) - - -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=ga_credentials.AnonymousCredentials(), - transport='grpc', - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.enable_certificate_authority), - '__call__') as call: - client.enable_certificate_authority() - call.assert_called() - _, args, _ = call.mock_calls[0] - assert args[0] == service.EnableCertificateAuthorityRequest() - -@pytest.mark.asyncio -async def test_enable_certificate_authority_async(transport: str = 'grpc_asyncio', request_type=service.EnableCertificateAuthorityRequest): - client = CertificateAuthorityServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.enable_certificate_authority), - '__call__') as call: - # Designate an appropriate return value for the call. - 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. - assert isinstance(response, future.Future) - - -@pytest.mark.asyncio -async def test_enable_certificate_authority_async_from_dict(): - await test_enable_certificate_authority_async(request_type=dict) - - -def test_enable_certificate_authority_field_headers(): - client = CertificateAuthorityServiceClient( - 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. - with mock.patch.object( - 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. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ( - 'x-goog-request-params', - 'name=name_value', - ) in kw['metadata'] - - -@pytest.mark.asyncio -async def test_enable_certificate_authority_field_headers_async(): - client = CertificateAuthorityServiceAsyncClient( - 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. - with mock.patch.object( - type(client.transport.enable_certificate_authority), - '__call__') as call: - 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. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ( - 'x-goog-request-params', - 'name=name_value', - ) in kw['metadata'] - - -def test_enable_certificate_authority_flattened(): - client = CertificateAuthorityServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.enable_certificate_authority), - '__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.enable_certificate_authority( - name='name_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] - arg = args[0].name - mock_val = 'name_value' - assert arg == mock_val - - -def test_enable_certificate_authority_flattened_error(): - client = CertificateAuthorityServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Attempting to call a method with both a request object and flattened - # fields is an error. - with pytest.raises(ValueError): - client.enable_certificate_authority( - service.EnableCertificateAuthorityRequest(), - name='name_value', - ) - -@pytest.mark.asyncio -async def test_enable_certificate_authority_flattened_async(): - client = CertificateAuthorityServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.enable_certificate_authority), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = operations_pb2.Operation(name='operations/op') - - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - operations_pb2.Operation(name='operations/spam') - ) - # Call the method with a truthy value for each flattened field, - # using the keyword arguments to the method. - response = await client.enable_certificate_authority( - name='name_value', - ) - - # Establish that the underlying call was made with the expected - # request object values. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - arg = args[0].name - mock_val = 'name_value' - assert arg == mock_val - -@pytest.mark.asyncio -async def test_enable_certificate_authority_flattened_error_async(): - client = CertificateAuthorityServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Attempting to call a method with both a request object and flattened - # fields is an error. - with pytest.raises(ValueError): - await client.enable_certificate_authority( - service.EnableCertificateAuthorityRequest(), - name='name_value', - ) - - -@pytest.mark.parametrize("request_type", [ - service.FetchCertificateAuthorityCsrRequest, - dict, -]) -def test_fetch_certificate_authority_csr(request_type, transport: str = 'grpc'): - client = CertificateAuthorityServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.fetch_certificate_authority_csr), - '__call__') as call: - # Designate an appropriate return value for the call. - 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' - - -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=ga_credentials.AnonymousCredentials(), - transport='grpc', - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.fetch_certificate_authority_csr), - '__call__') as call: - client.fetch_certificate_authority_csr() - call.assert_called() - _, args, _ = call.mock_calls[0] - assert args[0] == service.FetchCertificateAuthorityCsrRequest() - -@pytest.mark.asyncio -async def test_fetch_certificate_authority_csr_async(transport: str = 'grpc_asyncio', request_type=service.FetchCertificateAuthorityCsrRequest): - client = CertificateAuthorityServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.fetch_certificate_authority_csr), - '__call__') as call: - # Designate an appropriate return value for the call. - 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' - - -@pytest.mark.asyncio -async def test_fetch_certificate_authority_csr_async_from_dict(): - await test_fetch_certificate_authority_csr_async(request_type=dict) - - -def test_fetch_certificate_authority_csr_field_headers(): - client = CertificateAuthorityServiceClient( - 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. - with mock.patch.object( - 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. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ( - 'x-goog-request-params', - 'name=name_value', - ) in kw['metadata'] - - -@pytest.mark.asyncio -async def test_fetch_certificate_authority_csr_field_headers_async(): - client = CertificateAuthorityServiceAsyncClient( - 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. - with mock.patch.object( - type(client.transport.fetch_certificate_authority_csr), - '__call__') as call: - 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. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ( - 'x-goog-request-params', - 'name=name_value', - ) in kw['metadata'] - - -def test_fetch_certificate_authority_csr_flattened(): - client = CertificateAuthorityServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.fetch_certificate_authority_csr), - '__call__') 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', - ) - - # Establish that the underlying call was made with the expected - # request object values. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - arg = args[0].name - mock_val = 'name_value' - assert arg == mock_val - - -def test_fetch_certificate_authority_csr_flattened_error(): - client = CertificateAuthorityServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Attempting to call a method with both a request object and flattened - # fields is an error. - with pytest.raises(ValueError): - client.fetch_certificate_authority_csr( - service.FetchCertificateAuthorityCsrRequest(), - name='name_value', - ) - -@pytest.mark.asyncio -async def test_fetch_certificate_authority_csr_flattened_async(): - client = CertificateAuthorityServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.fetch_certificate_authority_csr), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = service.FetchCertificateAuthorityCsrResponse() - - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(service.FetchCertificateAuthorityCsrResponse()) - # Call the method with a truthy value for each flattened field, - # using the keyword arguments to the method. - response = await client.fetch_certificate_authority_csr( - name='name_value', - ) - - # Establish that the underlying call was made with the expected - # request object values. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - arg = args[0].name - mock_val = 'name_value' - assert arg == mock_val - -@pytest.mark.asyncio -async def test_fetch_certificate_authority_csr_flattened_error_async(): - client = CertificateAuthorityServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Attempting to call a method with both a request object and flattened - # fields is an error. - with pytest.raises(ValueError): - await client.fetch_certificate_authority_csr( - service.FetchCertificateAuthorityCsrRequest(), - name='name_value', - ) - - -@pytest.mark.parametrize("request_type", [ - service.GetCertificateAuthorityRequest, - dict, -]) -def test_get_certificate_authority(request_type, transport: str = 'grpc'): - client = CertificateAuthorityServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.get_certificate_authority), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = resources.CertificateAuthority( - name='name_value', - type_=resources.CertificateAuthority.Type.SELF_SIGNED, - tier=resources.CaPool.Tier.ENTERPRISE, - state=resources.CertificateAuthority.State.ENABLED, - 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' - - -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=ga_credentials.AnonymousCredentials(), - transport='grpc', - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.get_certificate_authority), - '__call__') as call: - client.get_certificate_authority() - call.assert_called() - _, args, _ = call.mock_calls[0] - assert args[0] == service.GetCertificateAuthorityRequest() - -@pytest.mark.asyncio -async def test_get_certificate_authority_async(transport: str = 'grpc_asyncio', request_type=service.GetCertificateAuthorityRequest): - client = CertificateAuthorityServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.get_certificate_authority), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(resources.CertificateAuthority( - name='name_value', - type_=resources.CertificateAuthority.Type.SELF_SIGNED, - tier=resources.CaPool.Tier.ENTERPRISE, - state=resources.CertificateAuthority.State.ENABLED, - pem_ca_certificates=['pem_ca_certificates_value'], - 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' - - -@pytest.mark.asyncio -async def test_get_certificate_authority_async_from_dict(): - await test_get_certificate_authority_async(request_type=dict) - - -def test_get_certificate_authority_field_headers(): - client = CertificateAuthorityServiceClient( - 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. - with mock.patch.object( - 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. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ( - 'x-goog-request-params', - 'name=name_value', - ) in kw['metadata'] - - -@pytest.mark.asyncio -async def test_get_certificate_authority_field_headers_async(): - client = CertificateAuthorityServiceAsyncClient( - 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. - with mock.patch.object( - type(client.transport.get_certificate_authority), - '__call__') as call: - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(resources.CertificateAuthority()) - 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] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ( - 'x-goog-request-params', - 'name=name_value', - ) in kw['metadata'] - - -def test_get_certificate_authority_flattened(): - client = CertificateAuthorityServiceClient( - 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_authority), - '__call__') 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', - ) - - # Establish that the underlying call was made with the expected - # request object values. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - arg = args[0].name - mock_val = 'name_value' - assert arg == mock_val - - -def test_get_certificate_authority_flattened_error(): - client = CertificateAuthorityServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Attempting to call a method with both a request object and flattened - # fields is an error. - with pytest.raises(ValueError): - client.get_certificate_authority( - service.GetCertificateAuthorityRequest(), - name='name_value', - ) - -@pytest.mark.asyncio -async def test_get_certificate_authority_flattened_async(): - client = CertificateAuthorityServiceAsyncClient( - 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_authority), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = resources.CertificateAuthority() - - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(resources.CertificateAuthority()) - # Call the method with a truthy value for each flattened field, - # using the keyword arguments to the method. - response = await client.get_certificate_authority( - name='name_value', - ) - - # Establish that the underlying call was made with the expected - # request object values. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - arg = args[0].name - mock_val = 'name_value' - assert arg == mock_val - -@pytest.mark.asyncio -async def test_get_certificate_authority_flattened_error_async(): - client = CertificateAuthorityServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Attempting to call a method with both a request object and flattened - # fields is an error. - with pytest.raises(ValueError): - await client.get_certificate_authority( - service.GetCertificateAuthorityRequest(), - name='name_value', - ) - - -@pytest.mark.parametrize("request_type", [ - service.ListCertificateAuthoritiesRequest, - dict, -]) -def test_list_certificate_authorities(request_type, transport: str = 'grpc'): - client = CertificateAuthorityServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_certificate_authorities), - '__call__') as call: - # Designate an appropriate return value for the call. - 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'] - - -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=ga_credentials.AnonymousCredentials(), - transport='grpc', - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_certificate_authorities), - '__call__') as call: - client.list_certificate_authorities() - call.assert_called() - _, args, _ = call.mock_calls[0] - assert args[0] == service.ListCertificateAuthoritiesRequest() - -@pytest.mark.asyncio -async def test_list_certificate_authorities_async(transport: str = 'grpc_asyncio', request_type=service.ListCertificateAuthoritiesRequest): - client = CertificateAuthorityServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_certificate_authorities), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(service.ListCertificateAuthoritiesResponse( - next_page_token='next_page_token_value', - 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'] - - -@pytest.mark.asyncio -async def test_list_certificate_authorities_async_from_dict(): - await test_list_certificate_authorities_async(request_type=dict) - - -def test_list_certificate_authorities_field_headers(): - client = CertificateAuthorityServiceClient( - 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. - with mock.patch.object( - 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. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ( - 'x-goog-request-params', - 'parent=parent_value', - ) in kw['metadata'] - - -@pytest.mark.asyncio -async def test_list_certificate_authorities_field_headers_async(): - client = CertificateAuthorityServiceAsyncClient( - 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. - with mock.patch.object( - type(client.transport.list_certificate_authorities), - '__call__') as call: - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(service.ListCertificateAuthoritiesResponse()) - 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] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ( - 'x-goog-request-params', - 'parent=parent_value', - ) in kw['metadata'] - - -def test_list_certificate_authorities_flattened(): - client = CertificateAuthorityServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_certificate_authorities), - '__call__') 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', - ) - - # Establish that the underlying call was made with the expected - # request object values. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - arg = args[0].parent - mock_val = 'parent_value' - assert arg == mock_val - - -def test_list_certificate_authorities_flattened_error(): - client = CertificateAuthorityServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Attempting to call a method with both a request object and flattened - # fields is an error. - with pytest.raises(ValueError): - client.list_certificate_authorities( - service.ListCertificateAuthoritiesRequest(), - parent='parent_value', - ) - -@pytest.mark.asyncio -async def test_list_certificate_authorities_flattened_async(): - client = CertificateAuthorityServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_certificate_authorities), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = service.ListCertificateAuthoritiesResponse() - - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(service.ListCertificateAuthoritiesResponse()) - # Call the method with a truthy value for each flattened field, - # using the keyword arguments to the method. - response = await client.list_certificate_authorities( - parent='parent_value', - ) - - # Establish that the underlying call was made with the expected - # request object values. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - arg = args[0].parent - mock_val = 'parent_value' - assert arg == mock_val - -@pytest.mark.asyncio -async def test_list_certificate_authorities_flattened_error_async(): - client = CertificateAuthorityServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Attempting to call a method with both a request object and flattened - # fields is an error. - with pytest.raises(ValueError): - await client.list_certificate_authorities( - service.ListCertificateAuthoritiesRequest(), - parent='parent_value', - ) - - -def test_list_certificate_authorities_pager(transport_name: str = "grpc"): - client = CertificateAuthorityServiceClient( - credentials=ga_credentials.AnonymousCredentials, - transport=transport_name, - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_certificate_authorities), - '__call__') as call: - # Set the response to a series of pages. - call.side_effect = ( - service.ListCertificateAuthoritiesResponse( - certificate_authorities=[ - resources.CertificateAuthority(), - resources.CertificateAuthority(), - resources.CertificateAuthority(), - ], - next_page_token='abc', - ), - service.ListCertificateAuthoritiesResponse( - certificate_authorities=[], - next_page_token='def', - ), - service.ListCertificateAuthoritiesResponse( - certificate_authorities=[ - resources.CertificateAuthority(), - ], - next_page_token='ghi', - ), - service.ListCertificateAuthoritiesResponse( - certificate_authorities=[ - resources.CertificateAuthority(), - resources.CertificateAuthority(), - ], - ), - RuntimeError, - ) - - metadata = () - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata(( - ('parent', ''), - )), - ) - pager = client.list_certificate_authorities(request={}) - - assert pager._metadata == metadata - - results = list(pager) - assert len(results) == 6 - assert all(isinstance(i, resources.CertificateAuthority) - for i in results) -def test_list_certificate_authorities_pages(transport_name: str = "grpc"): - client = CertificateAuthorityServiceClient( - credentials=ga_credentials.AnonymousCredentials, - transport=transport_name, - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_certificate_authorities), - '__call__') as call: - # Set the response to a series of pages. - call.side_effect = ( - service.ListCertificateAuthoritiesResponse( - certificate_authorities=[ - resources.CertificateAuthority(), - resources.CertificateAuthority(), - resources.CertificateAuthority(), - ], - next_page_token='abc', - ), - service.ListCertificateAuthoritiesResponse( - certificate_authorities=[], - next_page_token='def', - ), - service.ListCertificateAuthoritiesResponse( - certificate_authorities=[ - resources.CertificateAuthority(), - ], - next_page_token='ghi', - ), - service.ListCertificateAuthoritiesResponse( - certificate_authorities=[ - resources.CertificateAuthority(), - resources.CertificateAuthority(), - ], - ), - RuntimeError, - ) - pages = list(client.list_certificate_authorities(request={}).pages) - for page_, token in zip(pages, ['abc','def','ghi', '']): - assert page_.raw_page.next_page_token == token - -@pytest.mark.asyncio -async def test_list_certificate_authorities_async_pager(): - client = CertificateAuthorityServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials, - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_certificate_authorities), - '__call__', new_callable=mock.AsyncMock) as call: - # Set the response to a series of pages. - call.side_effect = ( - service.ListCertificateAuthoritiesResponse( - certificate_authorities=[ - resources.CertificateAuthority(), - resources.CertificateAuthority(), - resources.CertificateAuthority(), - ], - next_page_token='abc', - ), - service.ListCertificateAuthoritiesResponse( - certificate_authorities=[], - next_page_token='def', - ), - service.ListCertificateAuthoritiesResponse( - certificate_authorities=[ - resources.CertificateAuthority(), - ], - next_page_token='ghi', - ), - service.ListCertificateAuthoritiesResponse( - certificate_authorities=[ - resources.CertificateAuthority(), - resources.CertificateAuthority(), - ], - ), - RuntimeError, - ) - async_pager = await client.list_certificate_authorities(request={},) - assert async_pager.next_page_token == 'abc' - responses = [] - async for response in async_pager: # pragma: no branch - responses.append(response) - - assert len(responses) == 6 - assert all(isinstance(i, resources.CertificateAuthority) - for i in responses) - - -@pytest.mark.asyncio -async def test_list_certificate_authorities_async_pages(): - client = CertificateAuthorityServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials, - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_certificate_authorities), - '__call__', new_callable=mock.AsyncMock) as call: - # Set the response to a series of pages. - call.side_effect = ( - service.ListCertificateAuthoritiesResponse( - certificate_authorities=[ - resources.CertificateAuthority(), - resources.CertificateAuthority(), - resources.CertificateAuthority(), - ], - next_page_token='abc', - ), - service.ListCertificateAuthoritiesResponse( - certificate_authorities=[], - next_page_token='def', - ), - service.ListCertificateAuthoritiesResponse( - certificate_authorities=[ - resources.CertificateAuthority(), - ], - next_page_token='ghi', - ), - service.ListCertificateAuthoritiesResponse( - certificate_authorities=[ - resources.CertificateAuthority(), - resources.CertificateAuthority(), - ], - ), - RuntimeError, - ) - pages = [] - async for page_ in (await client.list_certificate_authorities(request={})).pages: # pragma: no branch - pages.append(page_) - for page_, token in zip(pages, ['abc','def','ghi', '']): - assert page_.raw_page.next_page_token == token - -@pytest.mark.parametrize("request_type", [ - service.UndeleteCertificateAuthorityRequest, - dict, -]) -def test_undelete_certificate_authority(request_type, transport: str = 'grpc'): - client = CertificateAuthorityServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.undelete_certificate_authority), - '__call__') 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. - assert isinstance(response, future.Future) - - -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=ga_credentials.AnonymousCredentials(), - transport='grpc', - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.undelete_certificate_authority), - '__call__') as call: - client.undelete_certificate_authority() - call.assert_called() - _, args, _ = call.mock_calls[0] - assert args[0] == service.UndeleteCertificateAuthorityRequest() - -@pytest.mark.asyncio -async def test_undelete_certificate_authority_async(transport: str = 'grpc_asyncio', request_type=service.UndeleteCertificateAuthorityRequest): - client = CertificateAuthorityServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.undelete_certificate_authority), - '__call__') as call: - # Designate an appropriate return value for the call. - 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. - assert isinstance(response, future.Future) - - -@pytest.mark.asyncio -async def test_undelete_certificate_authority_async_from_dict(): - await test_undelete_certificate_authority_async(request_type=dict) - - -def test_undelete_certificate_authority_field_headers(): - client = CertificateAuthorityServiceClient( - 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. - with mock.patch.object( - 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. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ( - 'x-goog-request-params', - 'name=name_value', - ) in kw['metadata'] - - -@pytest.mark.asyncio -async def test_undelete_certificate_authority_field_headers_async(): - client = CertificateAuthorityServiceAsyncClient( - 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. - with mock.patch.object( - type(client.transport.undelete_certificate_authority), - '__call__') as call: - 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. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ( - 'x-goog-request-params', - 'name=name_value', - ) in kw['metadata'] - - -def test_undelete_certificate_authority_flattened(): - client = CertificateAuthorityServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.undelete_certificate_authority), - '__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.undelete_certificate_authority( - name='name_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] - arg = args[0].name - mock_val = 'name_value' - assert arg == mock_val - - -def test_undelete_certificate_authority_flattened_error(): - client = CertificateAuthorityServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Attempting to call a method with both a request object and flattened - # fields is an error. - with pytest.raises(ValueError): - client.undelete_certificate_authority( - service.UndeleteCertificateAuthorityRequest(), - name='name_value', - ) - -@pytest.mark.asyncio -async def test_undelete_certificate_authority_flattened_async(): - client = CertificateAuthorityServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.undelete_certificate_authority), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = operations_pb2.Operation(name='operations/op') - - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - operations_pb2.Operation(name='operations/spam') - ) - # Call the method with a truthy value for each flattened field, - # using the keyword arguments to the method. - response = await client.undelete_certificate_authority( - name='name_value', - ) - - # Establish that the underlying call was made with the expected - # request object values. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - arg = args[0].name - mock_val = 'name_value' - assert arg == mock_val - -@pytest.mark.asyncio -async def test_undelete_certificate_authority_flattened_error_async(): - client = CertificateAuthorityServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Attempting to call a method with both a request object and flattened - # fields is an error. - with pytest.raises(ValueError): - await client.undelete_certificate_authority( - service.UndeleteCertificateAuthorityRequest(), - name='name_value', - ) - - -@pytest.mark.parametrize("request_type", [ - service.DeleteCertificateAuthorityRequest, - dict, -]) -def test_delete_certificate_authority(request_type, transport: str = 'grpc'): - client = CertificateAuthorityServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.delete_certificate_authority), - '__call__') 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. - assert isinstance(response, future.Future) - - -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=ga_credentials.AnonymousCredentials(), - transport='grpc', - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.delete_certificate_authority), - '__call__') as call: - client.delete_certificate_authority() - call.assert_called() - _, args, _ = call.mock_calls[0] - assert args[0] == service.DeleteCertificateAuthorityRequest() - -@pytest.mark.asyncio -async def test_delete_certificate_authority_async(transport: str = 'grpc_asyncio', request_type=service.DeleteCertificateAuthorityRequest): - client = CertificateAuthorityServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.delete_certificate_authority), - '__call__') as call: - # Designate an appropriate return value for the call. - 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. - assert isinstance(response, future.Future) - - -@pytest.mark.asyncio -async def test_delete_certificate_authority_async_from_dict(): - await test_delete_certificate_authority_async(request_type=dict) - - -def test_delete_certificate_authority_field_headers(): - client = CertificateAuthorityServiceClient( - 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. - with mock.patch.object( - 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. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ( - 'x-goog-request-params', - 'name=name_value', - ) in kw['metadata'] - - -@pytest.mark.asyncio -async def test_delete_certificate_authority_field_headers_async(): - client = CertificateAuthorityServiceAsyncClient( - 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. - with mock.patch.object( - type(client.transport.delete_certificate_authority), - '__call__') as call: - 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. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ( - 'x-goog-request-params', - 'name=name_value', - ) in kw['metadata'] - - -def test_delete_certificate_authority_flattened(): - client = CertificateAuthorityServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.delete_certificate_authority), - '__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_certificate_authority( - name='name_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] - arg = args[0].name - mock_val = 'name_value' - assert arg == mock_val - - -def test_delete_certificate_authority_flattened_error(): - client = CertificateAuthorityServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Attempting to call a method with both a request object and flattened - # fields is an error. - with pytest.raises(ValueError): - client.delete_certificate_authority( - service.DeleteCertificateAuthorityRequest(), - name='name_value', - ) - -@pytest.mark.asyncio -async def test_delete_certificate_authority_flattened_async(): - client = CertificateAuthorityServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.delete_certificate_authority), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = operations_pb2.Operation(name='operations/op') - - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - operations_pb2.Operation(name='operations/spam') - ) - # Call the method with a truthy value for each flattened field, - # using the keyword arguments to the method. - response = await client.delete_certificate_authority( - name='name_value', - ) - - # Establish that the underlying call was made with the expected - # request object values. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - arg = args[0].name - mock_val = 'name_value' - assert arg == mock_val - -@pytest.mark.asyncio -async def test_delete_certificate_authority_flattened_error_async(): - client = CertificateAuthorityServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Attempting to call a method with both a request object and flattened - # fields is an error. - with pytest.raises(ValueError): - await client.delete_certificate_authority( - service.DeleteCertificateAuthorityRequest(), - name='name_value', - ) - - -@pytest.mark.parametrize("request_type", [ - service.UpdateCertificateAuthorityRequest, - dict, -]) -def test_update_certificate_authority(request_type, transport: str = 'grpc'): - client = CertificateAuthorityServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.update_certificate_authority), - '__call__') 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. - assert isinstance(response, future.Future) - - -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=ga_credentials.AnonymousCredentials(), - transport='grpc', - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.update_certificate_authority), - '__call__') as call: - client.update_certificate_authority() - call.assert_called() - _, args, _ = call.mock_calls[0] - assert args[0] == service.UpdateCertificateAuthorityRequest() - -@pytest.mark.asyncio -async def test_update_certificate_authority_async(transport: str = 'grpc_asyncio', request_type=service.UpdateCertificateAuthorityRequest): - client = CertificateAuthorityServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.update_certificate_authority), - '__call__') as call: - # Designate an appropriate return value for the call. - 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. - assert isinstance(response, future.Future) - - -@pytest.mark.asyncio -async def test_update_certificate_authority_async_from_dict(): - await test_update_certificate_authority_async(request_type=dict) - - -def test_update_certificate_authority_field_headers(): - client = CertificateAuthorityServiceClient( - 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 = 'name_value' - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - 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. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ( - 'x-goog-request-params', - 'certificate_authority.name=name_value', - ) in kw['metadata'] - - -@pytest.mark.asyncio -async def test_update_certificate_authority_field_headers_async(): - client = CertificateAuthorityServiceAsyncClient( - 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 = 'name_value' - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.update_certificate_authority), - '__call__') as call: - 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. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ( - 'x-goog-request-params', - 'certificate_authority.name=name_value', - ) in kw['metadata'] - - -def test_update_certificate_authority_flattened(): - client = CertificateAuthorityServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.update_certificate_authority), - '__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_certificate_authority( - certificate_authority=resources.CertificateAuthority(name='name_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] - arg = args[0].certificate_authority - mock_val = resources.CertificateAuthority(name='name_value') - assert arg == mock_val - arg = args[0].update_mask - mock_val = field_mask_pb2.FieldMask(paths=['paths_value']) - assert arg == mock_val - - -def test_update_certificate_authority_flattened_error(): - client = CertificateAuthorityServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Attempting to call a method with both a request object and flattened - # fields is an error. - with pytest.raises(ValueError): - client.update_certificate_authority( - service.UpdateCertificateAuthorityRequest(), - certificate_authority=resources.CertificateAuthority(name='name_value'), - update_mask=field_mask_pb2.FieldMask(paths=['paths_value']), - ) - -@pytest.mark.asyncio -async def test_update_certificate_authority_flattened_async(): - client = CertificateAuthorityServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.update_certificate_authority), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = operations_pb2.Operation(name='operations/op') - - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - operations_pb2.Operation(name='operations/spam') - ) - # Call the method with a truthy value for each flattened field, - # using the keyword arguments to the method. - response = await client.update_certificate_authority( - certificate_authority=resources.CertificateAuthority(name='name_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] - arg = args[0].certificate_authority - mock_val = resources.CertificateAuthority(name='name_value') - assert arg == mock_val - arg = args[0].update_mask - mock_val = field_mask_pb2.FieldMask(paths=['paths_value']) - assert arg == mock_val - -@pytest.mark.asyncio -async def test_update_certificate_authority_flattened_error_async(): - client = CertificateAuthorityServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Attempting to call a method with both a request object and flattened - # fields is an error. - with pytest.raises(ValueError): - await client.update_certificate_authority( - service.UpdateCertificateAuthorityRequest(), - certificate_authority=resources.CertificateAuthority(name='name_value'), - update_mask=field_mask_pb2.FieldMask(paths=['paths_value']), - ) - - -@pytest.mark.parametrize("request_type", [ - service.CreateCaPoolRequest, - dict, -]) -def test_create_ca_pool(request_type, transport: str = 'grpc'): - client = CertificateAuthorityServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # 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/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. - assert isinstance(response, future.Future) - - -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=ga_credentials.AnonymousCredentials(), - transport='grpc', - ) - - # 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: - client.create_ca_pool() - call.assert_called() - _, args, _ = call.mock_calls[0] - assert args[0] == service.CreateCaPoolRequest() - -@pytest.mark.asyncio -async def test_create_ca_pool_async(transport: str = 'grpc_asyncio', request_type=service.CreateCaPoolRequest): - client = CertificateAuthorityServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # 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 = 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. - assert isinstance(response, future.Future) - - -@pytest.mark.asyncio -async def test_create_ca_pool_async_from_dict(): - await test_create_ca_pool_async(request_type=dict) - - -def test_create_ca_pool_field_headers(): - client = CertificateAuthorityServiceClient( - 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. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ( - 'x-goog-request-params', - 'parent=parent_value', - ) in kw['metadata'] - - -@pytest.mark.asyncio -async def test_create_ca_pool_field_headers_async(): - client = CertificateAuthorityServiceAsyncClient( - 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 = 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. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ( - 'x-goog-request-params', - 'parent=parent_value', - ) in kw['metadata'] - - -def test_create_ca_pool_flattened(): - client = CertificateAuthorityServiceClient( - 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( - parent='parent_value', - ca_pool=resources.CaPool(name='name_value'), - ca_pool_id='ca_pool_id_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] - arg = args[0].parent - mock_val = 'parent_value' - assert arg == mock_val - arg = args[0].ca_pool - mock_val = resources.CaPool(name='name_value') - assert arg == mock_val - arg = args[0].ca_pool_id - mock_val = 'ca_pool_id_value' - assert arg == mock_val - - -def test_create_ca_pool_flattened_error(): - client = CertificateAuthorityServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Attempting to call a method with both a request object and flattened - # fields is an error. - with pytest.raises(ValueError): - client.create_ca_pool( - service.CreateCaPoolRequest(), - parent='parent_value', - ca_pool=resources.CaPool(name='name_value'), - ca_pool_id='ca_pool_id_value', - ) - -@pytest.mark.asyncio -async def test_create_ca_pool_flattened_async(): - client = CertificateAuthorityServiceAsyncClient( - 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.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - operations_pb2.Operation(name='operations/spam') - ) - # Call the method with a truthy value for each flattened field, - # using the keyword arguments to the method. - response = await client.create_ca_pool( - parent='parent_value', - ca_pool=resources.CaPool(name='name_value'), - ca_pool_id='ca_pool_id_value', - ) - - # Establish that the underlying call was made with the expected - # request object values. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - arg = args[0].parent - mock_val = 'parent_value' - assert arg == mock_val - arg = args[0].ca_pool - mock_val = resources.CaPool(name='name_value') - assert arg == mock_val - arg = args[0].ca_pool_id - mock_val = 'ca_pool_id_value' - assert arg == mock_val - -@pytest.mark.asyncio -async def test_create_ca_pool_flattened_error_async(): - client = CertificateAuthorityServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Attempting to call a method with both a request object and flattened - # fields is an error. - with pytest.raises(ValueError): - await client.create_ca_pool( - service.CreateCaPoolRequest(), - parent='parent_value', - ca_pool=resources.CaPool(name='name_value'), - ca_pool_id='ca_pool_id_value', - ) - - -@pytest.mark.parametrize("request_type", [ - service.UpdateCaPoolRequest, - dict, -]) -def test_update_ca_pool(request_type, transport: str = 'grpc'): - client = CertificateAuthorityServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # 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/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. - assert isinstance(response, future.Future) - - -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=ga_credentials.AnonymousCredentials(), - transport='grpc', - ) - - # 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: - client.update_ca_pool() - call.assert_called() - _, args, _ = call.mock_calls[0] - assert args[0] == service.UpdateCaPoolRequest() - -@pytest.mark.asyncio -async def test_update_ca_pool_async(transport: str = 'grpc_asyncio', request_type=service.UpdateCaPoolRequest): - client = CertificateAuthorityServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # 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 = 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. - assert isinstance(response, future.Future) - - -@pytest.mark.asyncio -async def test_update_ca_pool_async_from_dict(): - await test_update_ca_pool_async(request_type=dict) - - -def test_update_ca_pool_field_headers(): - client = CertificateAuthorityServiceClient( - 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 = '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. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ( - 'x-goog-request-params', - 'ca_pool.name=name_value', - ) in kw['metadata'] - - -@pytest.mark.asyncio -async def test_update_ca_pool_field_headers_async(): - client = CertificateAuthorityServiceAsyncClient( - 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 = '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 = 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. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ( - 'x-goog-request-params', - 'ca_pool.name=name_value', - ) in kw['metadata'] - - -def test_update_ca_pool_flattened(): - client = CertificateAuthorityServiceClient( - 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_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] - arg = args[0].ca_pool - mock_val = resources.CaPool(name='name_value') - assert arg == mock_val - arg = args[0].update_mask - mock_val = field_mask_pb2.FieldMask(paths=['paths_value']) - assert arg == mock_val - - -def test_update_ca_pool_flattened_error(): - client = CertificateAuthorityServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Attempting to call a method with both a request object and flattened - # fields is an error. - with pytest.raises(ValueError): - client.update_ca_pool( - service.UpdateCaPoolRequest(), - ca_pool=resources.CaPool(name='name_value'), - update_mask=field_mask_pb2.FieldMask(paths=['paths_value']), - ) - -@pytest.mark.asyncio -async def test_update_ca_pool_flattened_async(): - client = CertificateAuthorityServiceAsyncClient( - 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.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - operations_pb2.Operation(name='operations/spam') - ) - # Call the method with a truthy value for each flattened field, - # using the keyword arguments to the method. - response = await client.update_ca_pool( - ca_pool=resources.CaPool(name='name_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] - arg = args[0].ca_pool - mock_val = resources.CaPool(name='name_value') - assert arg == mock_val - arg = args[0].update_mask - mock_val = field_mask_pb2.FieldMask(paths=['paths_value']) - assert arg == mock_val - -@pytest.mark.asyncio -async def test_update_ca_pool_flattened_error_async(): - client = CertificateAuthorityServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Attempting to call a method with both a request object and flattened - # fields is an error. - with pytest.raises(ValueError): - await client.update_ca_pool( - service.UpdateCaPoolRequest(), - ca_pool=resources.CaPool(name='name_value'), - update_mask=field_mask_pb2.FieldMask(paths=['paths_value']), - ) - - -@pytest.mark.parametrize("request_type", [ - service.GetCaPoolRequest, - dict, -]) -def test_get_ca_pool(request_type, transport: str = 'grpc'): - client = CertificateAuthorityServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # 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( - 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 - - -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=ga_credentials.AnonymousCredentials(), - transport='grpc', - ) - - # 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: - client.get_ca_pool() - call.assert_called() - _, args, _ = call.mock_calls[0] - assert args[0] == service.GetCaPoolRequest() - -@pytest.mark.asyncio -async def test_get_ca_pool_async(transport: str = 'grpc_asyncio', request_type=service.GetCaPoolRequest): - client = CertificateAuthorityServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # 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 =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 - - -@pytest.mark.asyncio -async def test_get_ca_pool_async_from_dict(): - await test_get_ca_pool_async(request_type=dict) - - -def test_get_ca_pool_field_headers(): - client = CertificateAuthorityServiceClient( - 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. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ( - 'x-goog-request-params', - 'name=name_value', - ) in kw['metadata'] - - -@pytest.mark.asyncio -async def test_get_ca_pool_field_headers_async(): - client = CertificateAuthorityServiceAsyncClient( - 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. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ( - 'x-goog-request-params', - 'name=name_value', - ) in kw['metadata'] - - -def test_get_ca_pool_flattened(): - client = CertificateAuthorityServiceClient( - 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', - ) - - # Establish that the underlying call was made with the expected - # request object values. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - arg = args[0].name - mock_val = 'name_value' - assert arg == mock_val - - -def test_get_ca_pool_flattened_error(): - client = CertificateAuthorityServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Attempting to call a method with both a request object and flattened - # fields is an error. - with pytest.raises(ValueError): - client.get_ca_pool( - service.GetCaPoolRequest(), - name='name_value', - ) - -@pytest.mark.asyncio -async def test_get_ca_pool_flattened_async(): - client = CertificateAuthorityServiceAsyncClient( - 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.return_value = grpc_helpers_async.FakeUnaryUnaryCall(resources.CaPool()) - # Call the method with a truthy value for each flattened field, - # using the keyword arguments to the method. - response = await client.get_ca_pool( - name='name_value', - ) - - # Establish that the underlying call was made with the expected - # request object values. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - arg = args[0].name - mock_val = 'name_value' - assert arg == mock_val - -@pytest.mark.asyncio -async def test_get_ca_pool_flattened_error_async(): - client = CertificateAuthorityServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Attempting to call a method with both a request object and flattened - # fields is an error. - with pytest.raises(ValueError): - await client.get_ca_pool( - service.GetCaPoolRequest(), - name='name_value', - ) - - -@pytest.mark.parametrize("request_type", [ - service.ListCaPoolsRequest, - dict, -]) -def test_list_ca_pools(request_type, transport: str = 'grpc'): - client = CertificateAuthorityServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # 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( - 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'] - - -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=ga_credentials.AnonymousCredentials(), - transport='grpc', - ) - - # 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: - client.list_ca_pools() - call.assert_called() - _, args, _ = call.mock_calls[0] - assert args[0] == service.ListCaPoolsRequest() - -@pytest.mark.asyncio -async def test_list_ca_pools_async(transport: str = 'grpc_asyncio', request_type=service.ListCaPoolsRequest): - client = CertificateAuthorityServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # 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 =grpc_helpers_async.FakeUnaryUnaryCall(service.ListCaPoolsResponse( - next_page_token='next_page_token_value', - 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'] - - -@pytest.mark.asyncio -async def test_list_ca_pools_async_from_dict(): - await test_list_ca_pools_async(request_type=dict) - - -def test_list_ca_pools_field_headers(): - client = CertificateAuthorityServiceClient( - 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. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ( - 'x-goog-request-params', - 'parent=parent_value', - ) in kw['metadata'] - - -@pytest.mark.asyncio -async def test_list_ca_pools_field_headers_async(): - client = CertificateAuthorityServiceAsyncClient( - 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 = grpc_helpers_async.FakeUnaryUnaryCall(service.ListCaPoolsResponse()) - 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] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ( - 'x-goog-request-params', - 'parent=parent_value', - ) in kw['metadata'] - - -def test_list_ca_pools_flattened(): - client = CertificateAuthorityServiceClient( - 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', - ) - - # Establish that the underlying call was made with the expected - # request object values. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - arg = args[0].parent - mock_val = 'parent_value' - assert arg == mock_val - - -def test_list_ca_pools_flattened_error(): - client = CertificateAuthorityServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Attempting to call a method with both a request object and flattened - # fields is an error. - with pytest.raises(ValueError): - client.list_ca_pools( - service.ListCaPoolsRequest(), - parent='parent_value', - ) - -@pytest.mark.asyncio -async def test_list_ca_pools_flattened_async(): - client = CertificateAuthorityServiceAsyncClient( - 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.return_value = grpc_helpers_async.FakeUnaryUnaryCall(service.ListCaPoolsResponse()) - # Call the method with a truthy value for each flattened field, - # using the keyword arguments to the method. - response = await client.list_ca_pools( - parent='parent_value', - ) - - # Establish that the underlying call was made with the expected - # request object values. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - arg = args[0].parent - mock_val = 'parent_value' - assert arg == mock_val - -@pytest.mark.asyncio -async def test_list_ca_pools_flattened_error_async(): - client = CertificateAuthorityServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Attempting to call a method with both a request object and flattened - # fields is an error. - with pytest.raises(ValueError): - await client.list_ca_pools( - service.ListCaPoolsRequest(), - parent='parent_value', - ) - - -def test_list_ca_pools_pager(transport_name: str = "grpc"): - client = CertificateAuthorityServiceClient( - credentials=ga_credentials.AnonymousCredentials, - transport=transport_name, - ) - - # 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: - # Set the response to a series of pages. - call.side_effect = ( - service.ListCaPoolsResponse( - ca_pools=[ - resources.CaPool(), - resources.CaPool(), - resources.CaPool(), - ], - next_page_token='abc', - ), - service.ListCaPoolsResponse( - ca_pools=[], - next_page_token='def', - ), - service.ListCaPoolsResponse( - ca_pools=[ - resources.CaPool(), - ], - next_page_token='ghi', - ), - service.ListCaPoolsResponse( - ca_pools=[ - resources.CaPool(), - resources.CaPool(), - ], - ), - RuntimeError, - ) - - metadata = () - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata(( - ('parent', ''), - )), - ) - pager = client.list_ca_pools(request={}) - - assert pager._metadata == metadata - - results = list(pager) - assert len(results) == 6 - assert all(isinstance(i, resources.CaPool) - for i in results) -def test_list_ca_pools_pages(transport_name: str = "grpc"): - client = CertificateAuthorityServiceClient( - credentials=ga_credentials.AnonymousCredentials, - transport=transport_name, - ) - - # 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: - # Set the response to a series of pages. - call.side_effect = ( - service.ListCaPoolsResponse( - ca_pools=[ - resources.CaPool(), - resources.CaPool(), - resources.CaPool(), - ], - next_page_token='abc', - ), - service.ListCaPoolsResponse( - ca_pools=[], - next_page_token='def', - ), - service.ListCaPoolsResponse( - ca_pools=[ - resources.CaPool(), - ], - next_page_token='ghi', - ), - service.ListCaPoolsResponse( - ca_pools=[ - resources.CaPool(), - resources.CaPool(), - ], - ), - RuntimeError, - ) - pages = list(client.list_ca_pools(request={}).pages) - for page_, token in zip(pages, ['abc','def','ghi', '']): - assert page_.raw_page.next_page_token == token - -@pytest.mark.asyncio -async def test_list_ca_pools_async_pager(): - client = CertificateAuthorityServiceAsyncClient( - 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__', new_callable=mock.AsyncMock) as call: - # Set the response to a series of pages. - call.side_effect = ( - service.ListCaPoolsResponse( - ca_pools=[ - resources.CaPool(), - resources.CaPool(), - resources.CaPool(), - ], - next_page_token='abc', - ), - service.ListCaPoolsResponse( - ca_pools=[], - next_page_token='def', - ), - service.ListCaPoolsResponse( - ca_pools=[ - resources.CaPool(), - ], - next_page_token='ghi', - ), - service.ListCaPoolsResponse( - ca_pools=[ - resources.CaPool(), - resources.CaPool(), - ], - ), - RuntimeError, - ) - async_pager = await client.list_ca_pools(request={},) - assert async_pager.next_page_token == 'abc' - responses = [] - async for response in async_pager: # pragma: no branch - responses.append(response) - - assert len(responses) == 6 - assert all(isinstance(i, resources.CaPool) - for i in responses) - - -@pytest.mark.asyncio -async def test_list_ca_pools_async_pages(): - client = CertificateAuthorityServiceAsyncClient( - 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__', new_callable=mock.AsyncMock) as call: - # Set the response to a series of pages. - call.side_effect = ( - service.ListCaPoolsResponse( - ca_pools=[ - resources.CaPool(), - resources.CaPool(), - resources.CaPool(), - ], - next_page_token='abc', - ), - service.ListCaPoolsResponse( - ca_pools=[], - next_page_token='def', - ), - service.ListCaPoolsResponse( - ca_pools=[ - resources.CaPool(), - ], - next_page_token='ghi', - ), - service.ListCaPoolsResponse( - ca_pools=[ - resources.CaPool(), - resources.CaPool(), - ], - ), - RuntimeError, - ) - pages = [] - async for page_ in (await client.list_ca_pools(request={})).pages: # pragma: no branch - pages.append(page_) - for page_, token in zip(pages, ['abc','def','ghi', '']): - assert page_.raw_page.next_page_token == token - -@pytest.mark.parametrize("request_type", [ - service.DeleteCaPoolRequest, - dict, -]) -def test_delete_ca_pool(request_type, transport: str = 'grpc'): - client = CertificateAuthorityServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # 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/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. - assert isinstance(response, future.Future) - - -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=ga_credentials.AnonymousCredentials(), - transport='grpc', - ) - - # 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: - client.delete_ca_pool() - call.assert_called() - _, args, _ = call.mock_calls[0] - assert args[0] == service.DeleteCaPoolRequest() - -@pytest.mark.asyncio -async def test_delete_ca_pool_async(transport: str = 'grpc_asyncio', request_type=service.DeleteCaPoolRequest): - client = CertificateAuthorityServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # 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 = 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. - assert isinstance(response, future.Future) - - -@pytest.mark.asyncio -async def test_delete_ca_pool_async_from_dict(): - await test_delete_ca_pool_async(request_type=dict) - - -def test_delete_ca_pool_field_headers(): - client = CertificateAuthorityServiceClient( - 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. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ( - 'x-goog-request-params', - 'name=name_value', - ) in kw['metadata'] - - -@pytest.mark.asyncio -async def test_delete_ca_pool_field_headers_async(): - client = CertificateAuthorityServiceAsyncClient( - 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 = 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. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ( - 'x-goog-request-params', - 'name=name_value', - ) in kw['metadata'] - - -def test_delete_ca_pool_flattened(): - client = CertificateAuthorityServiceClient( - 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', - ) - - # Establish that the underlying call was made with the expected - # request object values. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - arg = args[0].name - mock_val = 'name_value' - assert arg == mock_val - - -def test_delete_ca_pool_flattened_error(): - client = CertificateAuthorityServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Attempting to call a method with both a request object and flattened - # fields is an error. - with pytest.raises(ValueError): - client.delete_ca_pool( - service.DeleteCaPoolRequest(), - name='name_value', - ) - -@pytest.mark.asyncio -async def test_delete_ca_pool_flattened_async(): - client = CertificateAuthorityServiceAsyncClient( - 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.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - operations_pb2.Operation(name='operations/spam') - ) - # Call the method with a truthy value for each flattened field, - # using the keyword arguments to the method. - response = await client.delete_ca_pool( - name='name_value', - ) - - # Establish that the underlying call was made with the expected - # request object values. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - arg = args[0].name - mock_val = 'name_value' - assert arg == mock_val - -@pytest.mark.asyncio -async def test_delete_ca_pool_flattened_error_async(): - client = CertificateAuthorityServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Attempting to call a method with both a request object and flattened - # fields is an error. - with pytest.raises(ValueError): - await client.delete_ca_pool( - service.DeleteCaPoolRequest(), - name='name_value', - ) - - -@pytest.mark.parametrize("request_type", [ - service.FetchCaCertsRequest, - dict, -]) -def test_fetch_ca_certs(request_type, transport: str = 'grpc'): - client = CertificateAuthorityServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # 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( - ) - 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) - - -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=ga_credentials.AnonymousCredentials(), - transport='grpc', - ) - - # 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: - client.fetch_ca_certs() - call.assert_called() - _, args, _ = call.mock_calls[0] - assert args[0] == service.FetchCaCertsRequest() - -@pytest.mark.asyncio -async def test_fetch_ca_certs_async(transport: str = 'grpc_asyncio', request_type=service.FetchCaCertsRequest): - client = CertificateAuthorityServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # 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 =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. - assert isinstance(response, service.FetchCaCertsResponse) - - -@pytest.mark.asyncio -async def test_fetch_ca_certs_async_from_dict(): - await test_fetch_ca_certs_async(request_type=dict) - - -def test_fetch_ca_certs_field_headers(): - client = CertificateAuthorityServiceClient( - 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. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ( - 'x-goog-request-params', - 'ca_pool=ca_pool_value', - ) in kw['metadata'] - - -@pytest.mark.asyncio -async def test_fetch_ca_certs_field_headers_async(): - client = CertificateAuthorityServiceAsyncClient( - 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 = grpc_helpers_async.FakeUnaryUnaryCall(service.FetchCaCertsResponse()) - 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] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ( - 'x-goog-request-params', - 'ca_pool=ca_pool_value', - ) in kw['metadata'] - - -def test_fetch_ca_certs_flattened(): - client = CertificateAuthorityServiceClient( - 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', - ) - - # Establish that the underlying call was made with the expected - # request object values. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - arg = args[0].ca_pool - mock_val = 'ca_pool_value' - assert arg == mock_val - - -def test_fetch_ca_certs_flattened_error(): - client = CertificateAuthorityServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Attempting to call a method with both a request object and flattened - # fields is an error. - with pytest.raises(ValueError): - client.fetch_ca_certs( - service.FetchCaCertsRequest(), - ca_pool='ca_pool_value', - ) - -@pytest.mark.asyncio -async def test_fetch_ca_certs_flattened_async(): - client = CertificateAuthorityServiceAsyncClient( - 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.return_value = grpc_helpers_async.FakeUnaryUnaryCall(service.FetchCaCertsResponse()) - # Call the method with a truthy value for each flattened field, - # using the keyword arguments to the method. - response = await client.fetch_ca_certs( - ca_pool='ca_pool_value', - ) - - # Establish that the underlying call was made with the expected - # request object values. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - arg = args[0].ca_pool - mock_val = 'ca_pool_value' - assert arg == mock_val - -@pytest.mark.asyncio -async def test_fetch_ca_certs_flattened_error_async(): - client = CertificateAuthorityServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Attempting to call a method with both a request object and flattened - # fields is an error. - with pytest.raises(ValueError): - await client.fetch_ca_certs( - service.FetchCaCertsRequest(), - ca_pool='ca_pool_value', - ) - - -@pytest.mark.parametrize("request_type", [ - service.GetCertificateRevocationListRequest, - dict, -]) -def test_get_certificate_revocation_list(request_type, transport: str = 'grpc'): - client = CertificateAuthorityServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.get_certificate_revocation_list), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = resources.CertificateRevocationList( - name='name_value', - sequence_number=1601, - pem_crl='pem_crl_value', - access_url='access_url_value', - 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' - - -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=ga_credentials.AnonymousCredentials(), - transport='grpc', - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.get_certificate_revocation_list), - '__call__') as call: - client.get_certificate_revocation_list() - call.assert_called() - _, args, _ = call.mock_calls[0] - assert args[0] == service.GetCertificateRevocationListRequest() - -@pytest.mark.asyncio -async def test_get_certificate_revocation_list_async(transport: str = 'grpc_asyncio', request_type=service.GetCertificateRevocationListRequest): - client = CertificateAuthorityServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.get_certificate_revocation_list), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(resources.CertificateRevocationList( - name='name_value', - sequence_number=1601, - pem_crl='pem_crl_value', - access_url='access_url_value', - state=resources.CertificateRevocationList.State.ACTIVE, - 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' - - -@pytest.mark.asyncio -async def test_get_certificate_revocation_list_async_from_dict(): - await test_get_certificate_revocation_list_async(request_type=dict) - - -def test_get_certificate_revocation_list_field_headers(): - client = CertificateAuthorityServiceClient( - 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. - with mock.patch.object( - 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. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ( - 'x-goog-request-params', - 'name=name_value', - ) in kw['metadata'] - - -@pytest.mark.asyncio -async def test_get_certificate_revocation_list_field_headers_async(): - client = CertificateAuthorityServiceAsyncClient( - 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. - with mock.patch.object( - type(client.transport.get_certificate_revocation_list), - '__call__') as call: - 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. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ( - 'x-goog-request-params', - 'name=name_value', - ) in kw['metadata'] - - -def test_get_certificate_revocation_list_flattened(): - client = CertificateAuthorityServiceClient( - 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_revocation_list), - '__call__') 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', - ) - - # Establish that the underlying call was made with the expected - # request object values. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - arg = args[0].name - mock_val = 'name_value' - assert arg == mock_val - - -def test_get_certificate_revocation_list_flattened_error(): - client = CertificateAuthorityServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Attempting to call a method with both a request object and flattened - # fields is an error. - with pytest.raises(ValueError): - client.get_certificate_revocation_list( - service.GetCertificateRevocationListRequest(), - name='name_value', - ) - -@pytest.mark.asyncio -async def test_get_certificate_revocation_list_flattened_async(): - client = CertificateAuthorityServiceAsyncClient( - 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_revocation_list), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = resources.CertificateRevocationList() - - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(resources.CertificateRevocationList()) - # Call the method with a truthy value for each flattened field, - # using the keyword arguments to the method. - response = await client.get_certificate_revocation_list( - name='name_value', - ) - - # Establish that the underlying call was made with the expected - # request object values. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - arg = args[0].name - mock_val = 'name_value' - assert arg == mock_val - -@pytest.mark.asyncio -async def test_get_certificate_revocation_list_flattened_error_async(): - client = CertificateAuthorityServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Attempting to call a method with both a request object and flattened - # fields is an error. - with pytest.raises(ValueError): - await client.get_certificate_revocation_list( - service.GetCertificateRevocationListRequest(), - name='name_value', - ) - - -@pytest.mark.parametrize("request_type", [ - service.ListCertificateRevocationListsRequest, - dict, -]) -def test_list_certificate_revocation_lists(request_type, transport: str = 'grpc'): - client = CertificateAuthorityServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_certificate_revocation_lists), - '__call__') as call: - # Designate an appropriate return value for the call. - 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'] - - -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=ga_credentials.AnonymousCredentials(), - transport='grpc', - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_certificate_revocation_lists), - '__call__') as call: - client.list_certificate_revocation_lists() - call.assert_called() - _, args, _ = call.mock_calls[0] - assert args[0] == service.ListCertificateRevocationListsRequest() - -@pytest.mark.asyncio -async def test_list_certificate_revocation_lists_async(transport: str = 'grpc_asyncio', request_type=service.ListCertificateRevocationListsRequest): - client = CertificateAuthorityServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_certificate_revocation_lists), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(service.ListCertificateRevocationListsResponse( - next_page_token='next_page_token_value', - 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'] - - -@pytest.mark.asyncio -async def test_list_certificate_revocation_lists_async_from_dict(): - await test_list_certificate_revocation_lists_async(request_type=dict) - - -def test_list_certificate_revocation_lists_field_headers(): - client = CertificateAuthorityServiceClient( - 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. - with mock.patch.object( - 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. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ( - 'x-goog-request-params', - 'parent=parent_value', - ) in kw['metadata'] - - -@pytest.mark.asyncio -async def test_list_certificate_revocation_lists_field_headers_async(): - client = CertificateAuthorityServiceAsyncClient( - 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. - with mock.patch.object( - type(client.transport.list_certificate_revocation_lists), - '__call__') as call: - 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. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ( - 'x-goog-request-params', - 'parent=parent_value', - ) in kw['metadata'] - - -def test_list_certificate_revocation_lists_flattened(): - client = CertificateAuthorityServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_certificate_revocation_lists), - '__call__') 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', - ) - - # Establish that the underlying call was made with the expected - # request object values. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - arg = args[0].parent - mock_val = 'parent_value' - assert arg == mock_val - - -def test_list_certificate_revocation_lists_flattened_error(): - client = CertificateAuthorityServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Attempting to call a method with both a request object and flattened - # fields is an error. - with pytest.raises(ValueError): - client.list_certificate_revocation_lists( - service.ListCertificateRevocationListsRequest(), - parent='parent_value', - ) - -@pytest.mark.asyncio -async def test_list_certificate_revocation_lists_flattened_async(): - client = CertificateAuthorityServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_certificate_revocation_lists), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = service.ListCertificateRevocationListsResponse() - - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(service.ListCertificateRevocationListsResponse()) - # Call the method with a truthy value for each flattened field, - # using the keyword arguments to the method. - response = await client.list_certificate_revocation_lists( - parent='parent_value', - ) - - # Establish that the underlying call was made with the expected - # request object values. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - arg = args[0].parent - mock_val = 'parent_value' - assert arg == mock_val - -@pytest.mark.asyncio -async def test_list_certificate_revocation_lists_flattened_error_async(): - client = CertificateAuthorityServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Attempting to call a method with both a request object and flattened - # fields is an error. - with pytest.raises(ValueError): - await client.list_certificate_revocation_lists( - service.ListCertificateRevocationListsRequest(), - parent='parent_value', - ) - - -def test_list_certificate_revocation_lists_pager(transport_name: str = "grpc"): - client = CertificateAuthorityServiceClient( - credentials=ga_credentials.AnonymousCredentials, - transport=transport_name, - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_certificate_revocation_lists), - '__call__') as call: - # Set the response to a series of pages. - call.side_effect = ( - service.ListCertificateRevocationListsResponse( - certificate_revocation_lists=[ - resources.CertificateRevocationList(), - resources.CertificateRevocationList(), - resources.CertificateRevocationList(), - ], - next_page_token='abc', - ), - service.ListCertificateRevocationListsResponse( - certificate_revocation_lists=[], - next_page_token='def', - ), - service.ListCertificateRevocationListsResponse( - certificate_revocation_lists=[ - resources.CertificateRevocationList(), - ], - next_page_token='ghi', - ), - service.ListCertificateRevocationListsResponse( - certificate_revocation_lists=[ - resources.CertificateRevocationList(), - resources.CertificateRevocationList(), - ], - ), - RuntimeError, - ) - - metadata = () - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata(( - ('parent', ''), - )), - ) - pager = client.list_certificate_revocation_lists(request={}) - - assert pager._metadata == metadata - - results = list(pager) - assert len(results) == 6 - assert all(isinstance(i, resources.CertificateRevocationList) - for i in results) -def test_list_certificate_revocation_lists_pages(transport_name: str = "grpc"): - client = CertificateAuthorityServiceClient( - credentials=ga_credentials.AnonymousCredentials, - transport=transport_name, - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_certificate_revocation_lists), - '__call__') as call: - # Set the response to a series of pages. - call.side_effect = ( - service.ListCertificateRevocationListsResponse( - certificate_revocation_lists=[ - resources.CertificateRevocationList(), - resources.CertificateRevocationList(), - resources.CertificateRevocationList(), - ], - next_page_token='abc', - ), - service.ListCertificateRevocationListsResponse( - certificate_revocation_lists=[], - next_page_token='def', - ), - service.ListCertificateRevocationListsResponse( - certificate_revocation_lists=[ - resources.CertificateRevocationList(), - ], - next_page_token='ghi', - ), - service.ListCertificateRevocationListsResponse( - certificate_revocation_lists=[ - resources.CertificateRevocationList(), - resources.CertificateRevocationList(), - ], - ), - RuntimeError, - ) - pages = list(client.list_certificate_revocation_lists(request={}).pages) - for page_, token in zip(pages, ['abc','def','ghi', '']): - assert page_.raw_page.next_page_token == token - -@pytest.mark.asyncio -async def test_list_certificate_revocation_lists_async_pager(): - client = CertificateAuthorityServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials, - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_certificate_revocation_lists), - '__call__', new_callable=mock.AsyncMock) as call: - # Set the response to a series of pages. - call.side_effect = ( - service.ListCertificateRevocationListsResponse( - certificate_revocation_lists=[ - resources.CertificateRevocationList(), - resources.CertificateRevocationList(), - resources.CertificateRevocationList(), - ], - next_page_token='abc', - ), - service.ListCertificateRevocationListsResponse( - certificate_revocation_lists=[], - next_page_token='def', - ), - service.ListCertificateRevocationListsResponse( - certificate_revocation_lists=[ - resources.CertificateRevocationList(), - ], - next_page_token='ghi', - ), - service.ListCertificateRevocationListsResponse( - certificate_revocation_lists=[ - resources.CertificateRevocationList(), - resources.CertificateRevocationList(), - ], - ), - RuntimeError, - ) - async_pager = await client.list_certificate_revocation_lists(request={},) - assert async_pager.next_page_token == 'abc' - responses = [] - async for response in async_pager: # pragma: no branch - responses.append(response) - - assert len(responses) == 6 - assert all(isinstance(i, resources.CertificateRevocationList) - for i in responses) - - -@pytest.mark.asyncio -async def test_list_certificate_revocation_lists_async_pages(): - client = CertificateAuthorityServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials, - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_certificate_revocation_lists), - '__call__', new_callable=mock.AsyncMock) as call: - # Set the response to a series of pages. - call.side_effect = ( - service.ListCertificateRevocationListsResponse( - certificate_revocation_lists=[ - resources.CertificateRevocationList(), - resources.CertificateRevocationList(), - resources.CertificateRevocationList(), - ], - next_page_token='abc', - ), - service.ListCertificateRevocationListsResponse( - certificate_revocation_lists=[], - next_page_token='def', - ), - service.ListCertificateRevocationListsResponse( - certificate_revocation_lists=[ - resources.CertificateRevocationList(), - ], - next_page_token='ghi', - ), - service.ListCertificateRevocationListsResponse( - certificate_revocation_lists=[ - resources.CertificateRevocationList(), - resources.CertificateRevocationList(), - ], - ), - RuntimeError, - ) - pages = [] - async for page_ in (await client.list_certificate_revocation_lists(request={})).pages: # pragma: no branch - pages.append(page_) - for page_, token in zip(pages, ['abc','def','ghi', '']): - assert page_.raw_page.next_page_token == token - -@pytest.mark.parametrize("request_type", [ - service.UpdateCertificateRevocationListRequest, - dict, -]) -def test_update_certificate_revocation_list(request_type, transport: str = 'grpc'): - client = CertificateAuthorityServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.update_certificate_revocation_list), - '__call__') 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. - assert isinstance(response, future.Future) - - -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=ga_credentials.AnonymousCredentials(), - transport='grpc', - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.update_certificate_revocation_list), - '__call__') as call: - client.update_certificate_revocation_list() - call.assert_called() - _, args, _ = call.mock_calls[0] - assert args[0] == service.UpdateCertificateRevocationListRequest() - -@pytest.mark.asyncio -async def test_update_certificate_revocation_list_async(transport: str = 'grpc_asyncio', request_type=service.UpdateCertificateRevocationListRequest): - client = CertificateAuthorityServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.update_certificate_revocation_list), - '__call__') as call: - # Designate an appropriate return value for the call. - 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. - assert isinstance(response, future.Future) - - -@pytest.mark.asyncio -async def test_update_certificate_revocation_list_async_from_dict(): - await test_update_certificate_revocation_list_async(request_type=dict) - - -def test_update_certificate_revocation_list_field_headers(): - client = CertificateAuthorityServiceClient( - 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 = 'name_value' - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - 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. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ( - 'x-goog-request-params', - 'certificate_revocation_list.name=name_value', - ) in kw['metadata'] - - -@pytest.mark.asyncio -async def test_update_certificate_revocation_list_field_headers_async(): - client = CertificateAuthorityServiceAsyncClient( - 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 = 'name_value' - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.update_certificate_revocation_list), - '__call__') as call: - 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. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ( - 'x-goog-request-params', - 'certificate_revocation_list.name=name_value', - ) in kw['metadata'] - - -def test_update_certificate_revocation_list_flattened(): - client = CertificateAuthorityServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.update_certificate_revocation_list), - '__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_certificate_revocation_list( - certificate_revocation_list=resources.CertificateRevocationList(name='name_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] - arg = args[0].certificate_revocation_list - mock_val = resources.CertificateRevocationList(name='name_value') - assert arg == mock_val - arg = args[0].update_mask - mock_val = field_mask_pb2.FieldMask(paths=['paths_value']) - assert arg == mock_val - - -def test_update_certificate_revocation_list_flattened_error(): - client = CertificateAuthorityServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Attempting to call a method with both a request object and flattened - # fields is an error. - with pytest.raises(ValueError): - client.update_certificate_revocation_list( - service.UpdateCertificateRevocationListRequest(), - certificate_revocation_list=resources.CertificateRevocationList(name='name_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=ga_credentials.AnonymousCredentials(), - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.update_certificate_revocation_list), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = operations_pb2.Operation(name='operations/op') - - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - operations_pb2.Operation(name='operations/spam') - ) - # Call the method with a truthy value for each flattened field, - # using the keyword arguments to the method. - response = await client.update_certificate_revocation_list( - certificate_revocation_list=resources.CertificateRevocationList(name='name_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] - arg = args[0].certificate_revocation_list - mock_val = resources.CertificateRevocationList(name='name_value') - assert arg == mock_val - arg = args[0].update_mask - mock_val = field_mask_pb2.FieldMask(paths=['paths_value']) - assert arg == mock_val - -@pytest.mark.asyncio -async def test_update_certificate_revocation_list_flattened_error_async(): - client = CertificateAuthorityServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Attempting to call a method with both a request object and flattened - # fields is an error. - with pytest.raises(ValueError): - await client.update_certificate_revocation_list( - service.UpdateCertificateRevocationListRequest(), - certificate_revocation_list=resources.CertificateRevocationList(name='name_value'), - update_mask=field_mask_pb2.FieldMask(paths=['paths_value']), - ) - - -@pytest.mark.parametrize("request_type", [ - service.CreateCertificateTemplateRequest, - dict, -]) -def test_create_certificate_template(request_type, transport: str = 'grpc'): - client = CertificateAuthorityServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.create_certificate_template), - '__call__') 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. - assert isinstance(response, future.Future) - - -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=ga_credentials.AnonymousCredentials(), - transport='grpc', - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.create_certificate_template), - '__call__') as call: - client.create_certificate_template() - call.assert_called() - _, args, _ = call.mock_calls[0] - assert args[0] == service.CreateCertificateTemplateRequest() - -@pytest.mark.asyncio -async def test_create_certificate_template_async(transport: str = 'grpc_asyncio', request_type=service.CreateCertificateTemplateRequest): - client = CertificateAuthorityServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.create_certificate_template), - '__call__') as call: - # Designate an appropriate return value for the call. - 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. - assert isinstance(response, future.Future) - - -@pytest.mark.asyncio -async def test_create_certificate_template_async_from_dict(): - await test_create_certificate_template_async(request_type=dict) - - -def test_create_certificate_template_field_headers(): - client = CertificateAuthorityServiceClient( - 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. - with mock.patch.object( - 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. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ( - 'x-goog-request-params', - 'parent=parent_value', - ) in kw['metadata'] - - -@pytest.mark.asyncio -async def test_create_certificate_template_field_headers_async(): - client = CertificateAuthorityServiceAsyncClient( - 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. - with mock.patch.object( - type(client.transport.create_certificate_template), - '__call__') as call: - 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. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ( - 'x-goog-request-params', - 'parent=parent_value', - ) in kw['metadata'] - - -def test_create_certificate_template_flattened(): - client = CertificateAuthorityServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.create_certificate_template), - '__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_certificate_template( - parent='parent_value', - certificate_template=resources.CertificateTemplate(name='name_value'), - certificate_template_id='certificate_template_id_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] - arg = args[0].parent - mock_val = 'parent_value' - assert arg == mock_val - arg = args[0].certificate_template - mock_val = resources.CertificateTemplate(name='name_value') - assert arg == mock_val - arg = args[0].certificate_template_id - mock_val = 'certificate_template_id_value' - assert arg == mock_val - - -def test_create_certificate_template_flattened_error(): - client = CertificateAuthorityServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Attempting to call a method with both a request object and flattened - # fields is an error. - with pytest.raises(ValueError): - client.create_certificate_template( - service.CreateCertificateTemplateRequest(), - parent='parent_value', - certificate_template=resources.CertificateTemplate(name='name_value'), - certificate_template_id='certificate_template_id_value', - ) - -@pytest.mark.asyncio -async def test_create_certificate_template_flattened_async(): - client = CertificateAuthorityServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.create_certificate_template), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = operations_pb2.Operation(name='operations/op') - - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - operations_pb2.Operation(name='operations/spam') - ) - # Call the method with a truthy value for each flattened field, - # using the keyword arguments to the method. - response = await client.create_certificate_template( - parent='parent_value', - certificate_template=resources.CertificateTemplate(name='name_value'), - certificate_template_id='certificate_template_id_value', - ) - - # Establish that the underlying call was made with the expected - # request object values. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - arg = args[0].parent - mock_val = 'parent_value' - assert arg == mock_val - arg = args[0].certificate_template - mock_val = resources.CertificateTemplate(name='name_value') - assert arg == mock_val - arg = args[0].certificate_template_id - mock_val = 'certificate_template_id_value' - assert arg == mock_val - -@pytest.mark.asyncio -async def test_create_certificate_template_flattened_error_async(): - client = CertificateAuthorityServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Attempting to call a method with both a request object and flattened - # fields is an error. - with pytest.raises(ValueError): - await client.create_certificate_template( - service.CreateCertificateTemplateRequest(), - parent='parent_value', - certificate_template=resources.CertificateTemplate(name='name_value'), - certificate_template_id='certificate_template_id_value', - ) - - -@pytest.mark.parametrize("request_type", [ - service.DeleteCertificateTemplateRequest, - dict, -]) -def test_delete_certificate_template(request_type, transport: str = 'grpc'): - client = CertificateAuthorityServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.delete_certificate_template), - '__call__') 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. - assert isinstance(response, future.Future) - - -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=ga_credentials.AnonymousCredentials(), - transport='grpc', - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.delete_certificate_template), - '__call__') as call: - client.delete_certificate_template() - call.assert_called() - _, args, _ = call.mock_calls[0] - assert args[0] == service.DeleteCertificateTemplateRequest() - -@pytest.mark.asyncio -async def test_delete_certificate_template_async(transport: str = 'grpc_asyncio', request_type=service.DeleteCertificateTemplateRequest): - client = CertificateAuthorityServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.delete_certificate_template), - '__call__') as call: - # Designate an appropriate return value for the call. - 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. - assert isinstance(response, future.Future) - - -@pytest.mark.asyncio -async def test_delete_certificate_template_async_from_dict(): - await test_delete_certificate_template_async(request_type=dict) - - -def test_delete_certificate_template_field_headers(): - client = CertificateAuthorityServiceClient( - 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. - with mock.patch.object( - 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. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ( - 'x-goog-request-params', - 'name=name_value', - ) in kw['metadata'] - - -@pytest.mark.asyncio -async def test_delete_certificate_template_field_headers_async(): - client = CertificateAuthorityServiceAsyncClient( - 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. - with mock.patch.object( - type(client.transport.delete_certificate_template), - '__call__') as call: - 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. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ( - 'x-goog-request-params', - 'name=name_value', - ) in kw['metadata'] - - -def test_delete_certificate_template_flattened(): - client = CertificateAuthorityServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.delete_certificate_template), - '__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_certificate_template( - name='name_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] - arg = args[0].name - mock_val = 'name_value' - assert arg == mock_val - - -def test_delete_certificate_template_flattened_error(): - client = CertificateAuthorityServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Attempting to call a method with both a request object and flattened - # fields is an error. - with pytest.raises(ValueError): - client.delete_certificate_template( - service.DeleteCertificateTemplateRequest(), - name='name_value', - ) - -@pytest.mark.asyncio -async def test_delete_certificate_template_flattened_async(): - client = CertificateAuthorityServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.delete_certificate_template), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = operations_pb2.Operation(name='operations/op') - - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - operations_pb2.Operation(name='operations/spam') - ) - # Call the method with a truthy value for each flattened field, - # using the keyword arguments to the method. - response = await client.delete_certificate_template( - name='name_value', - ) - - # Establish that the underlying call was made with the expected - # request object values. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - arg = args[0].name - mock_val = 'name_value' - assert arg == mock_val - -@pytest.mark.asyncio -async def test_delete_certificate_template_flattened_error_async(): - client = CertificateAuthorityServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Attempting to call a method with both a request object and flattened - # fields is an error. - with pytest.raises(ValueError): - await client.delete_certificate_template( - service.DeleteCertificateTemplateRequest(), - name='name_value', - ) - - -@pytest.mark.parametrize("request_type", [ - service.GetCertificateTemplateRequest, - dict, -]) -def test_get_certificate_template(request_type, transport: str = 'grpc'): - client = CertificateAuthorityServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.get_certificate_template), - '__call__') as call: - # Designate an appropriate return value for the call. - 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' - - -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=ga_credentials.AnonymousCredentials(), - transport='grpc', - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.get_certificate_template), - '__call__') as call: - client.get_certificate_template() - call.assert_called() - _, args, _ = call.mock_calls[0] - assert args[0] == service.GetCertificateTemplateRequest() - -@pytest.mark.asyncio -async def test_get_certificate_template_async(transport: str = 'grpc_asyncio', request_type=service.GetCertificateTemplateRequest): - client = CertificateAuthorityServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.get_certificate_template), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(resources.CertificateTemplate( - 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' - - -@pytest.mark.asyncio -async def test_get_certificate_template_async_from_dict(): - await test_get_certificate_template_async(request_type=dict) - - -def test_get_certificate_template_field_headers(): - client = CertificateAuthorityServiceClient( - 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. - with mock.patch.object( - 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. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ( - 'x-goog-request-params', - 'name=name_value', - ) in kw['metadata'] - - -@pytest.mark.asyncio -async def test_get_certificate_template_field_headers_async(): - client = CertificateAuthorityServiceAsyncClient( - 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. - with mock.patch.object( - type(client.transport.get_certificate_template), - '__call__') as call: - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(resources.CertificateTemplate()) - 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] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ( - 'x-goog-request-params', - 'name=name_value', - ) in kw['metadata'] - - -def test_get_certificate_template_flattened(): - client = CertificateAuthorityServiceClient( - 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_template), - '__call__') 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', - ) - - # Establish that the underlying call was made with the expected - # request object values. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - arg = args[0].name - mock_val = 'name_value' - assert arg == mock_val - - -def test_get_certificate_template_flattened_error(): - client = CertificateAuthorityServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Attempting to call a method with both a request object and flattened - # fields is an error. - with pytest.raises(ValueError): - client.get_certificate_template( - service.GetCertificateTemplateRequest(), - name='name_value', - ) - -@pytest.mark.asyncio -async def test_get_certificate_template_flattened_async(): - client = CertificateAuthorityServiceAsyncClient( - 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_template), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = resources.CertificateTemplate() - - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(resources.CertificateTemplate()) - # Call the method with a truthy value for each flattened field, - # using the keyword arguments to the method. - response = await client.get_certificate_template( - name='name_value', - ) - - # Establish that the underlying call was made with the expected - # request object values. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - arg = args[0].name - mock_val = 'name_value' - assert arg == mock_val - -@pytest.mark.asyncio -async def test_get_certificate_template_flattened_error_async(): - client = CertificateAuthorityServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Attempting to call a method with both a request object and flattened - # fields is an error. - with pytest.raises(ValueError): - await client.get_certificate_template( - service.GetCertificateTemplateRequest(), - name='name_value', - ) - - -@pytest.mark.parametrize("request_type", [ - service.ListCertificateTemplatesRequest, - dict, -]) -def test_list_certificate_templates(request_type, transport: str = 'grpc'): - client = CertificateAuthorityServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_certificate_templates), - '__call__') as call: - # Designate an appropriate return value for the call. - 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'] - - -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=ga_credentials.AnonymousCredentials(), - transport='grpc', - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_certificate_templates), - '__call__') as call: - client.list_certificate_templates() - call.assert_called() - _, args, _ = call.mock_calls[0] - assert args[0] == service.ListCertificateTemplatesRequest() - -@pytest.mark.asyncio -async def test_list_certificate_templates_async(transport: str = 'grpc_asyncio', request_type=service.ListCertificateTemplatesRequest): - client = CertificateAuthorityServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_certificate_templates), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(service.ListCertificateTemplatesResponse( - next_page_token='next_page_token_value', - 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'] - - -@pytest.mark.asyncio -async def test_list_certificate_templates_async_from_dict(): - await test_list_certificate_templates_async(request_type=dict) - - -def test_list_certificate_templates_field_headers(): - client = CertificateAuthorityServiceClient( - 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. - with mock.patch.object( - 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. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ( - 'x-goog-request-params', - 'parent=parent_value', - ) in kw['metadata'] - - -@pytest.mark.asyncio -async def test_list_certificate_templates_field_headers_async(): - client = CertificateAuthorityServiceAsyncClient( - 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. - with mock.patch.object( - type(client.transport.list_certificate_templates), - '__call__') as call: - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(service.ListCertificateTemplatesResponse()) - 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] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ( - 'x-goog-request-params', - 'parent=parent_value', - ) in kw['metadata'] - - -def test_list_certificate_templates_flattened(): - client = CertificateAuthorityServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_certificate_templates), - '__call__') 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', - ) - - # Establish that the underlying call was made with the expected - # request object values. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - arg = args[0].parent - mock_val = 'parent_value' - assert arg == mock_val - - -def test_list_certificate_templates_flattened_error(): - client = CertificateAuthorityServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Attempting to call a method with both a request object and flattened - # fields is an error. - with pytest.raises(ValueError): - client.list_certificate_templates( - service.ListCertificateTemplatesRequest(), - parent='parent_value', - ) - -@pytest.mark.asyncio -async def test_list_certificate_templates_flattened_async(): - client = CertificateAuthorityServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_certificate_templates), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = service.ListCertificateTemplatesResponse() - - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(service.ListCertificateTemplatesResponse()) - # Call the method with a truthy value for each flattened field, - # using the keyword arguments to the method. - response = await client.list_certificate_templates( - parent='parent_value', - ) - - # Establish that the underlying call was made with the expected - # request object values. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - arg = args[0].parent - mock_val = 'parent_value' - assert arg == mock_val - -@pytest.mark.asyncio -async def test_list_certificate_templates_flattened_error_async(): - client = CertificateAuthorityServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Attempting to call a method with both a request object and flattened - # fields is an error. - with pytest.raises(ValueError): - await client.list_certificate_templates( - service.ListCertificateTemplatesRequest(), - parent='parent_value', - ) - - -def test_list_certificate_templates_pager(transport_name: str = "grpc"): - client = CertificateAuthorityServiceClient( - credentials=ga_credentials.AnonymousCredentials, - transport=transport_name, - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_certificate_templates), - '__call__') as call: - # Set the response to a series of pages. - call.side_effect = ( - service.ListCertificateTemplatesResponse( - certificate_templates=[ - resources.CertificateTemplate(), - resources.CertificateTemplate(), - resources.CertificateTemplate(), - ], - next_page_token='abc', - ), - service.ListCertificateTemplatesResponse( - certificate_templates=[], - next_page_token='def', - ), - service.ListCertificateTemplatesResponse( - certificate_templates=[ - resources.CertificateTemplate(), - ], - next_page_token='ghi', - ), - service.ListCertificateTemplatesResponse( - certificate_templates=[ - resources.CertificateTemplate(), - resources.CertificateTemplate(), - ], - ), - RuntimeError, - ) - - metadata = () - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata(( - ('parent', ''), - )), - ) - pager = client.list_certificate_templates(request={}) - - assert pager._metadata == metadata - - results = list(pager) - assert len(results) == 6 - assert all(isinstance(i, resources.CertificateTemplate) - for i in results) -def test_list_certificate_templates_pages(transport_name: str = "grpc"): - client = CertificateAuthorityServiceClient( - credentials=ga_credentials.AnonymousCredentials, - transport=transport_name, - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_certificate_templates), - '__call__') as call: - # Set the response to a series of pages. - call.side_effect = ( - service.ListCertificateTemplatesResponse( - certificate_templates=[ - resources.CertificateTemplate(), - resources.CertificateTemplate(), - resources.CertificateTemplate(), - ], - next_page_token='abc', - ), - service.ListCertificateTemplatesResponse( - certificate_templates=[], - next_page_token='def', - ), - service.ListCertificateTemplatesResponse( - certificate_templates=[ - resources.CertificateTemplate(), - ], - next_page_token='ghi', - ), - service.ListCertificateTemplatesResponse( - certificate_templates=[ - resources.CertificateTemplate(), - resources.CertificateTemplate(), - ], - ), - RuntimeError, - ) - pages = list(client.list_certificate_templates(request={}).pages) - for page_, token in zip(pages, ['abc','def','ghi', '']): - assert page_.raw_page.next_page_token == token - -@pytest.mark.asyncio -async def test_list_certificate_templates_async_pager(): - client = CertificateAuthorityServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials, - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_certificate_templates), - '__call__', new_callable=mock.AsyncMock) as call: - # Set the response to a series of pages. - call.side_effect = ( - service.ListCertificateTemplatesResponse( - certificate_templates=[ - resources.CertificateTemplate(), - resources.CertificateTemplate(), - resources.CertificateTemplate(), - ], - next_page_token='abc', - ), - service.ListCertificateTemplatesResponse( - certificate_templates=[], - next_page_token='def', - ), - service.ListCertificateTemplatesResponse( - certificate_templates=[ - resources.CertificateTemplate(), - ], - next_page_token='ghi', - ), - service.ListCertificateTemplatesResponse( - certificate_templates=[ - resources.CertificateTemplate(), - resources.CertificateTemplate(), - ], - ), - RuntimeError, - ) - async_pager = await client.list_certificate_templates(request={},) - assert async_pager.next_page_token == 'abc' - responses = [] - async for response in async_pager: # pragma: no branch - responses.append(response) - - assert len(responses) == 6 - assert all(isinstance(i, resources.CertificateTemplate) - for i in responses) - - -@pytest.mark.asyncio -async def test_list_certificate_templates_async_pages(): - client = CertificateAuthorityServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials, - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_certificate_templates), - '__call__', new_callable=mock.AsyncMock) as call: - # Set the response to a series of pages. - call.side_effect = ( - service.ListCertificateTemplatesResponse( - certificate_templates=[ - resources.CertificateTemplate(), - resources.CertificateTemplate(), - resources.CertificateTemplate(), - ], - next_page_token='abc', - ), - service.ListCertificateTemplatesResponse( - certificate_templates=[], - next_page_token='def', - ), - service.ListCertificateTemplatesResponse( - certificate_templates=[ - resources.CertificateTemplate(), - ], - next_page_token='ghi', - ), - service.ListCertificateTemplatesResponse( - certificate_templates=[ - resources.CertificateTemplate(), - resources.CertificateTemplate(), - ], - ), - RuntimeError, - ) - pages = [] - async for page_ in (await client.list_certificate_templates(request={})).pages: # pragma: no branch - pages.append(page_) - for page_, token in zip(pages, ['abc','def','ghi', '']): - assert page_.raw_page.next_page_token == token - -@pytest.mark.parametrize("request_type", [ - service.UpdateCertificateTemplateRequest, - dict, -]) -def test_update_certificate_template(request_type, transport: str = 'grpc'): - client = CertificateAuthorityServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.update_certificate_template), - '__call__') 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. - assert isinstance(response, future.Future) - - -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=ga_credentials.AnonymousCredentials(), - transport='grpc', - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.update_certificate_template), - '__call__') as call: - client.update_certificate_template() - call.assert_called() - _, args, _ = call.mock_calls[0] - assert args[0] == service.UpdateCertificateTemplateRequest() - -@pytest.mark.asyncio -async def test_update_certificate_template_async(transport: str = 'grpc_asyncio', request_type=service.UpdateCertificateTemplateRequest): - client = CertificateAuthorityServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.update_certificate_template), - '__call__') as call: - # Designate an appropriate return value for the call. - 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. - assert isinstance(response, future.Future) - - -@pytest.mark.asyncio -async def test_update_certificate_template_async_from_dict(): - await test_update_certificate_template_async(request_type=dict) - - -def test_update_certificate_template_field_headers(): - client = CertificateAuthorityServiceClient( - 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 = 'name_value' - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - 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. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ( - 'x-goog-request-params', - 'certificate_template.name=name_value', - ) in kw['metadata'] - - -@pytest.mark.asyncio -async def test_update_certificate_template_field_headers_async(): - client = CertificateAuthorityServiceAsyncClient( - 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 = 'name_value' - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.update_certificate_template), - '__call__') as call: - 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. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ( - 'x-goog-request-params', - 'certificate_template.name=name_value', - ) in kw['metadata'] - - -def test_update_certificate_template_flattened(): - client = CertificateAuthorityServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.update_certificate_template), - '__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_certificate_template( - certificate_template=resources.CertificateTemplate(name='name_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] - arg = args[0].certificate_template - mock_val = resources.CertificateTemplate(name='name_value') - assert arg == mock_val - arg = args[0].update_mask - mock_val = field_mask_pb2.FieldMask(paths=['paths_value']) - assert arg == mock_val - - -def test_update_certificate_template_flattened_error(): - client = CertificateAuthorityServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Attempting to call a method with both a request object and flattened - # fields is an error. - with pytest.raises(ValueError): - client.update_certificate_template( - service.UpdateCertificateTemplateRequest(), - certificate_template=resources.CertificateTemplate(name='name_value'), - update_mask=field_mask_pb2.FieldMask(paths=['paths_value']), - ) - -@pytest.mark.asyncio -async def test_update_certificate_template_flattened_async(): - client = CertificateAuthorityServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.update_certificate_template), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = operations_pb2.Operation(name='operations/op') - - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - operations_pb2.Operation(name='operations/spam') - ) - # Call the method with a truthy value for each flattened field, - # using the keyword arguments to the method. - response = await client.update_certificate_template( - certificate_template=resources.CertificateTemplate(name='name_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] - arg = args[0].certificate_template - mock_val = resources.CertificateTemplate(name='name_value') - assert arg == mock_val - arg = args[0].update_mask - mock_val = field_mask_pb2.FieldMask(paths=['paths_value']) - assert arg == mock_val - -@pytest.mark.asyncio -async def test_update_certificate_template_flattened_error_async(): - client = CertificateAuthorityServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Attempting to call a method with both a request object and flattened - # fields is an error. - with pytest.raises(ValueError): - await client.update_certificate_template( - service.UpdateCertificateTemplateRequest(), - certificate_template=resources.CertificateTemplate(name='name_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=ga_credentials.AnonymousCredentials(), - ) - with pytest.raises(ValueError): - client = CertificateAuthorityServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # It is an error to provide a credentials file and a transport instance. - transport = transports.CertificateAuthorityServiceGrpcTransport( - credentials=ga_credentials.AnonymousCredentials(), - ) - with pytest.raises(ValueError): - client = CertificateAuthorityServiceClient( - client_options={"credentials_file": "credentials.json"}, - transport=transport, - ) - - # It is an error to provide an api_key and a transport instance. - transport = transports.CertificateAuthorityServiceGrpcTransport( - credentials=ga_credentials.AnonymousCredentials(), - ) - options = client_options.ClientOptions() - options.api_key = "api_key" - with pytest.raises(ValueError): - client = CertificateAuthorityServiceClient( - client_options=options, - transport=transport, - ) - - # It is an error to provide an api_key and a credential. - options = mock.Mock() - options.api_key = "api_key" - with pytest.raises(ValueError): - client = CertificateAuthorityServiceClient( - client_options=options, - credentials=ga_credentials.AnonymousCredentials() - ) - - # It is an error to provide scopes and a transport instance. - transport = transports.CertificateAuthorityServiceGrpcTransport( - credentials=ga_credentials.AnonymousCredentials(), - ) - with pytest.raises(ValueError): - client = CertificateAuthorityServiceClient( - client_options={"scopes": ["1", "2"]}, - transport=transport, - ) - - -def test_transport_instance(): - # A client may be instantiated with a custom transport instance. - transport = transports.CertificateAuthorityServiceGrpcTransport( - credentials=ga_credentials.AnonymousCredentials(), - ) - client = CertificateAuthorityServiceClient(transport=transport) - assert client.transport is transport - -def test_transport_get_channel(): - # A client may be instantiated with a custom transport instance. - transport = transports.CertificateAuthorityServiceGrpcTransport( - credentials=ga_credentials.AnonymousCredentials(), - ) - channel = transport.grpc_channel - assert channel - - transport = transports.CertificateAuthorityServiceGrpcAsyncIOTransport( - credentials=ga_credentials.AnonymousCredentials(), - ) - channel = transport.grpc_channel - assert channel - -@pytest.mark.parametrize("transport_class", [ - transports.CertificateAuthorityServiceGrpcTransport, - transports.CertificateAuthorityServiceGrpcAsyncIOTransport, -]) -def test_transport_adc(transport_class): - # Test default credentials are used if not provided. - with mock.patch.object(google.auth, 'default') as adc: - adc.return_value = (ga_credentials.AnonymousCredentials(), None) - transport_class() - adc.assert_called_once() - -@pytest.mark.parametrize("transport_name", [ - "grpc", -]) -def test_transport_kind(transport_name): - transport = CertificateAuthorityServiceClient.get_transport_class(transport_name)( - credentials=ga_credentials.AnonymousCredentials(), - ) - assert transport.kind == transport_name - -def test_transport_grpc_default(): - # A client should use the gRPC transport by default. - client = CertificateAuthorityServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - assert isinstance( - client.transport, - transports.CertificateAuthorityServiceGrpcTransport, - ) - -def test_certificate_authority_service_base_transport_error(): - # Passing both a credentials object and credentials_file should raise an error - with pytest.raises(core_exceptions.DuplicateCredentialArgs): - transport = transports.CertificateAuthorityServiceTransport( - credentials=ga_credentials.AnonymousCredentials(), - credentials_file="credentials.json" - ) - - -def test_certificate_authority_service_base_transport(): - # Instantiate the base transport. - with mock.patch('google.cloud.security.privateca_v1.services.certificate_authority_service.transports.CertificateAuthorityServiceTransport.__init__') as Transport: - Transport.return_value = None - transport = transports.CertificateAuthorityServiceTransport( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Every method on the transport should just blindly - # raise NotImplementedError. - methods = ( - 'create_certificate', - 'get_certificate', - 'list_certificates', - 'revoke_certificate', - 'update_certificate', - 'activate_certificate_authority', - 'create_certificate_authority', - 'disable_certificate_authority', - 'enable_certificate_authority', - 'fetch_certificate_authority_csr', - 'get_certificate_authority', - 'list_certificate_authorities', - 'undelete_certificate_authority', - 'delete_certificate_authority', - 'update_certificate_authority', - 'create_ca_pool', - 'update_ca_pool', - 'get_ca_pool', - 'list_ca_pools', - 'delete_ca_pool', - 'fetch_ca_certs', - 'get_certificate_revocation_list', - 'list_certificate_revocation_lists', - 'update_certificate_revocation_list', - 'create_certificate_template', - 'delete_certificate_template', - 'get_certificate_template', - 'list_certificate_templates', - 'update_certificate_template', - ) - for method in methods: - with pytest.raises(NotImplementedError): - getattr(transport, method)(request=object()) - - with pytest.raises(NotImplementedError): - transport.close() - - # Additionally, the LRO client (a property) should - # also raise NotImplementedError - with pytest.raises(NotImplementedError): - transport.operations_client - - # Catch all for all remaining methods and properties - remainder = [ - 'kind', - ] - for r in remainder: - with pytest.raises(NotImplementedError): - getattr(transport, r)() - - -def test_certificate_authority_service_base_transport_with_credentials_file(): - # 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 = (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", - ) - - -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(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 = (ga_credentials.AnonymousCredentials(), None) - transport = transports.CertificateAuthorityServiceTransport() - adc.assert_called_once() - - -def test_certificate_authority_service_auth_adc(): - # 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=None, - default_scopes=( - 'https://www.googleapis.com/auth/cloud-platform', -), - quota_project_id=None, - ) - - -@pytest.mark.parametrize( - "transport_class", - [ - transports.CertificateAuthorityServiceGrpcTransport, - transports.CertificateAuthorityServiceGrpcAsyncIOTransport, - ], -) -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(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, - ], -) -def test_certificate_authority_service_transport_auth_gdch_credentials(transport_class): - host = 'https://language.com' - api_audience_tests = [None, 'https://language2.com'] - api_audience_expect = [host, 'https://language2.com'] - for t, e in zip(api_audience_tests, api_audience_expect): - with mock.patch.object(google.auth, 'default', autospec=True) as adc: - gdch_mock = mock.MagicMock() - type(gdch_mock).with_gdch_audience = mock.PropertyMock(return_value=gdch_mock) - adc.return_value = (gdch_mock, None) - transport_class(host=host, api_audience=t) - gdch_mock.with_gdch_audience.assert_called_once_with( - e - ) - - -@pytest.mark.parametrize( - "transport_class,grpc_helpers", - [ - (transports.CertificateAuthorityServiceGrpcTransport, grpc_helpers), - (transports.CertificateAuthorityServiceGrpcAsyncIOTransport, grpc_helpers_async) - ], -) -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", [transports.CertificateAuthorityServiceGrpcTransport, transports.CertificateAuthorityServiceGrpcAsyncIOTransport]) -def test_certificate_authority_service_grpc_transport_client_cert_source_for_mtls( - transport_class -): - cred = ga_credentials.AnonymousCredentials() - - # Check ssl_channel_credentials is used if provided. - with mock.patch.object(transport_class, "create_channel") as mock_create_channel: - mock_ssl_channel_creds = mock.Mock() - transport_class( - host="squid.clam.whelk", - credentials=cred, - ssl_channel_credentials=mock_ssl_channel_creds - ) - mock_create_channel.assert_called_once_with( - "squid.clam.whelk:443", - credentials=cred, - credentials_file=None, - scopes=None, - ssl_credentials=mock_ssl_channel_creds, - quota_project_id=None, - options=[ - ("grpc.max_send_message_length", -1), - ("grpc.max_receive_message_length", -1), - ], - ) - - # Check if ssl_channel_credentials is not provided, then client_cert_source_for_mtls - # is used. - with mock.patch.object(transport_class, "create_channel", return_value=mock.Mock()): - with mock.patch("grpc.ssl_channel_credentials") as mock_ssl_cred: - transport_class( - credentials=cred, - client_cert_source_for_mtls=client_cert_source_callback - ) - expected_cert, expected_key = client_cert_source_callback() - mock_ssl_cred.assert_called_once_with( - certificate_chain=expected_cert, - private_key=expected_key - ) - - -@pytest.mark.parametrize("transport_name", [ - "grpc", - "grpc_asyncio", -]) -def test_certificate_authority_service_host_no_port(transport_name): - client = CertificateAuthorityServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - client_options=client_options.ClientOptions(api_endpoint='privateca.googleapis.com'), - transport=transport_name, - ) - assert client.transport._host == ( - 'privateca.googleapis.com:443' - ) - -@pytest.mark.parametrize("transport_name", [ - "grpc", - "grpc_asyncio", -]) -def test_certificate_authority_service_host_with_port(transport_name): - client = CertificateAuthorityServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - client_options=client_options.ClientOptions(api_endpoint='privateca.googleapis.com:8000'), - transport=transport_name, - ) - assert client.transport._host == ( - 'privateca.googleapis.com:8000' - ) - -def test_certificate_authority_service_grpc_transport_channel(): - channel = grpc.secure_channel('http://localhost/', grpc.local_channel_credentials()) - - # Check that channel is used if provided. - transport = transports.CertificateAuthorityServiceGrpcTransport( - host="squid.clam.whelk", - channel=channel, - ) - assert transport.grpc_channel == channel - assert transport._host == "squid.clam.whelk:443" - assert transport._ssl_channel_credentials == None - - -def test_certificate_authority_service_grpc_asyncio_transport_channel(): - channel = aio.secure_channel('http://localhost/', grpc.local_channel_credentials()) - - # Check that channel is used if provided. - transport = transports.CertificateAuthorityServiceGrpcAsyncIOTransport( - host="squid.clam.whelk", - channel=channel, - ) - assert transport.grpc_channel == channel - assert transport._host == "squid.clam.whelk:443" - assert transport._ssl_channel_credentials == None - - -# Remove this test when deprecated arguments (api_mtls_endpoint, client_cert_source) are -# removed from grpc/grpc_asyncio transport constructor. -@pytest.mark.parametrize("transport_class", [transports.CertificateAuthorityServiceGrpcTransport, transports.CertificateAuthorityServiceGrpcAsyncIOTransport]) -def test_certificate_authority_service_transport_channel_mtls_with_client_cert_source( - transport_class -): - with mock.patch("grpc.ssl_channel_credentials", autospec=True) as grpc_ssl_channel_cred: - with mock.patch.object(transport_class, "create_channel") as grpc_create_channel: - mock_ssl_cred = mock.Mock() - grpc_ssl_channel_cred.return_value = mock_ssl_cred - - mock_grpc_channel = mock.Mock() - grpc_create_channel.return_value = mock_grpc_channel - - cred = ga_credentials.AnonymousCredentials() - with pytest.warns(DeprecationWarning): - with mock.patch.object(google.auth, 'default') as adc: - adc.return_value = (cred, None) - transport = transport_class( - host="squid.clam.whelk", - api_mtls_endpoint="mtls.squid.clam.whelk", - client_cert_source=client_cert_source_callback, - ) - adc.assert_called_once() - - grpc_ssl_channel_cred.assert_called_once_with( - certificate_chain=b"cert bytes", private_key=b"key bytes" - ) - grpc_create_channel.assert_called_once_with( - "mtls.squid.clam.whelk:443", - credentials=cred, - credentials_file=None, - scopes=None, - ssl_credentials=mock_ssl_cred, - quota_project_id=None, - options=[ - ("grpc.max_send_message_length", -1), - ("grpc.max_receive_message_length", -1), - ], - ) - assert transport.grpc_channel == mock_grpc_channel - assert transport._ssl_channel_credentials == mock_ssl_cred - - -# Remove this test when deprecated arguments (api_mtls_endpoint, client_cert_source) are -# removed from grpc/grpc_asyncio transport constructor. -@pytest.mark.parametrize("transport_class", [transports.CertificateAuthorityServiceGrpcTransport, transports.CertificateAuthorityServiceGrpcAsyncIOTransport]) -def test_certificate_authority_service_transport_channel_mtls_with_adc( - transport_class -): - mock_ssl_cred = mock.Mock() - with mock.patch.multiple( - "google.auth.transport.grpc.SslCredentials", - __init__=mock.Mock(return_value=None), - ssl_credentials=mock.PropertyMock(return_value=mock_ssl_cred), - ): - with mock.patch.object(transport_class, "create_channel") as grpc_create_channel: - mock_grpc_channel = mock.Mock() - grpc_create_channel.return_value = mock_grpc_channel - mock_cred = mock.Mock() - - with pytest.warns(DeprecationWarning): - transport = transport_class( - host="squid.clam.whelk", - credentials=mock_cred, - api_mtls_endpoint="mtls.squid.clam.whelk", - client_cert_source=None, - ) - - grpc_create_channel.assert_called_once_with( - "mtls.squid.clam.whelk:443", - credentials=mock_cred, - credentials_file=None, - scopes=None, - ssl_credentials=mock_ssl_cred, - quota_project_id=None, - options=[ - ("grpc.max_send_message_length", -1), - ("grpc.max_receive_message_length", -1), - ], - ) - assert transport.grpc_channel == mock_grpc_channel - - -def test_certificate_authority_service_grpc_lro_client(): - client = CertificateAuthorityServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - transport='grpc', - ) - transport = client.transport - - # Ensure that we have a api-core operations client. - assert isinstance( - transport.operations_client, - operations_v1.OperationsClient, - ) - - # Ensure that subsequent calls to the property send the exact same object. - assert transport.operations_client is transport.operations_client - - -def test_certificate_authority_service_grpc_lro_async_client(): - client = CertificateAuthorityServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - transport='grpc_asyncio', - ) - transport = client.transport - - # Ensure that we have a api-core operations client. - assert isinstance( - transport.operations_client, - operations_v1.OperationsAsyncClient, - ) - - # Ensure that subsequent calls to the property send the exact same object. - assert transport.operations_client is transport.operations_client - - -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, ) - actual = CertificateAuthorityServiceClient.ca_pool_path(project, location, ca_pool) - assert expected == actual - - -def test_parse_ca_pool_path(): - expected = { - "project": "octopus", - "location": "oyster", - "ca_pool": "nudibranch", - } - path = CertificateAuthorityServiceClient.ca_pool_path(**expected) - - # Check that the path construction is reversible. - actual = CertificateAuthorityServiceClient.parse_ca_pool_path(path) - assert expected == actual - -def test_certificate_path(): - project = "cuttlefish" - 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, ) - actual = CertificateAuthorityServiceClient.certificate_path(project, location, ca_pool, certificate) - assert expected == actual - - -def test_parse_certificate_path(): - expected = { - "project": "scallop", - "location": "abalone", - "ca_pool": "squid", - "certificate": "clam", - } - path = CertificateAuthorityServiceClient.certificate_path(**expected) - - # Check that the path construction is reversible. - actual = CertificateAuthorityServiceClient.parse_certificate_path(path) - assert expected == actual - -def test_certificate_authority_path(): - project = "whelk" - location = "octopus" - ca_pool = "oyster" - certificate_authority = "nudibranch" - expected = "projects/{project}/locations/{location}/caPools/{ca_pool}/certificateAuthorities/{certificate_authority}".format(project=project, location=location, ca_pool=ca_pool, certificate_authority=certificate_authority, ) - actual = CertificateAuthorityServiceClient.certificate_authority_path(project, location, ca_pool, certificate_authority) - assert expected == actual - - -def test_parse_certificate_authority_path(): - expected = { - "project": "cuttlefish", - "location": "mussel", - "ca_pool": "winkle", - "certificate_authority": "nautilus", - } - path = CertificateAuthorityServiceClient.certificate_authority_path(**expected) - - # Check that the path construction is reversible. - actual = CertificateAuthorityServiceClient.parse_certificate_authority_path(path) - assert expected == actual - -def test_certificate_revocation_list_path(): - project = "scallop" - location = "abalone" - 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, ca_pool=ca_pool, certificate_authority=certificate_authority, certificate_revocation_list=certificate_revocation_list, ) - actual = CertificateAuthorityServiceClient.certificate_revocation_list_path(project, location, ca_pool, certificate_authority, certificate_revocation_list) - assert expected == actual - - -def test_parse_certificate_revocation_list_path(): - expected = { - "project": "octopus", - "location": "oyster", - "ca_pool": "nudibranch", - "certificate_authority": "cuttlefish", - "certificate_revocation_list": "mussel", - } - path = CertificateAuthorityServiceClient.certificate_revocation_list_path(**expected) - - # Check that the path construction is reversible. - actual = CertificateAuthorityServiceClient.parse_certificate_revocation_list_path(path) - assert expected == actual - -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, ) - actual = CertificateAuthorityServiceClient.certificate_template_path(project, location, certificate_template) - assert expected == actual - - -def test_parse_certificate_template_path(): - expected = { - "project": "abalone", - "location": "squid", - "certificate_template": "clam", - } - path = CertificateAuthorityServiceClient.certificate_template_path(**expected) - - # Check that the path construction is reversible. - actual = CertificateAuthorityServiceClient.parse_certificate_template_path(path) - assert expected == actual - -def test_common_billing_account_path(): - billing_account = "whelk" - expected = "billingAccounts/{billing_account}".format(billing_account=billing_account, ) - actual = CertificateAuthorityServiceClient.common_billing_account_path(billing_account) - assert expected == actual - - -def test_parse_common_billing_account_path(): - expected = { - "billing_account": "octopus", - } - path = CertificateAuthorityServiceClient.common_billing_account_path(**expected) - - # Check that the path construction is reversible. - actual = CertificateAuthorityServiceClient.parse_common_billing_account_path(path) - assert expected == actual - -def test_common_folder_path(): - folder = "oyster" - expected = "folders/{folder}".format(folder=folder, ) - actual = CertificateAuthorityServiceClient.common_folder_path(folder) - assert expected == actual - - -def test_parse_common_folder_path(): - expected = { - "folder": "nudibranch", - } - path = CertificateAuthorityServiceClient.common_folder_path(**expected) - - # Check that the path construction is reversible. - actual = CertificateAuthorityServiceClient.parse_common_folder_path(path) - assert expected == actual - -def test_common_organization_path(): - organization = "cuttlefish" - expected = "organizations/{organization}".format(organization=organization, ) - actual = CertificateAuthorityServiceClient.common_organization_path(organization) - assert expected == actual - - -def test_parse_common_organization_path(): - expected = { - "organization": "mussel", - } - path = CertificateAuthorityServiceClient.common_organization_path(**expected) - - # Check that the path construction is reversible. - actual = CertificateAuthorityServiceClient.parse_common_organization_path(path) - assert expected == actual - -def test_common_project_path(): - project = "winkle" - expected = "projects/{project}".format(project=project, ) - actual = CertificateAuthorityServiceClient.common_project_path(project) - assert expected == actual - - -def test_parse_common_project_path(): - expected = { - "project": "nautilus", - } - path = CertificateAuthorityServiceClient.common_project_path(**expected) - - # Check that the path construction is reversible. - actual = CertificateAuthorityServiceClient.parse_common_project_path(path) - assert expected == actual - -def test_common_location_path(): - project = "scallop" - location = "abalone" - expected = "projects/{project}/locations/{location}".format(project=project, location=location, ) - actual = CertificateAuthorityServiceClient.common_location_path(project, location) - assert expected == actual - - -def test_parse_common_location_path(): - expected = { - "project": "squid", - "location": "clam", - } - path = CertificateAuthorityServiceClient.common_location_path(**expected) - - # Check that the path construction is reversible. - actual = CertificateAuthorityServiceClient.parse_common_location_path(path) - assert expected == actual - - -def test_client_with_default_client_info(): - client_info = gapic_v1.client_info.ClientInfo() - - with mock.patch.object(transports.CertificateAuthorityServiceTransport, '_prep_wrapped_messages') as prep: - client = CertificateAuthorityServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - client_info=client_info, - ) - prep.assert_called_once_with(client_info) - - with mock.patch.object(transports.CertificateAuthorityServiceTransport, '_prep_wrapped_messages') as prep: - transport_class = CertificateAuthorityServiceClient.get_transport_class() - transport = transport_class( - credentials=ga_credentials.AnonymousCredentials(), - client_info=client_info, - ) - prep.assert_called_once_with(client_info) - -@pytest.mark.asyncio -async def test_transport_close_async(): - client = CertificateAuthorityServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="grpc_asyncio", - ) - with mock.patch.object(type(getattr(client.transport, "grpc_channel")), "close") as close: - async with client: - close.assert_not_called() - close.assert_called_once() - - -def test_transport_close(): - transports = { - "grpc": "_grpc_channel", - } - - for transport, close_name in transports.items(): - client = CertificateAuthorityServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport - ) - with mock.patch.object(type(getattr(client.transport, close_name)), "close") as close: - with client: - close.assert_not_called() - close.assert_called_once() - -def test_client_ctx(): - transports = [ - 'grpc', - ] - for transport in transports: - client = CertificateAuthorityServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport - ) - # Test client calls underlying transport. - with mock.patch.object(type(client.transport), "close") as close: - close.assert_not_called() - with client: - pass - close.assert_called() - -@pytest.mark.parametrize("client_class,transport_class", [ - (CertificateAuthorityServiceClient, transports.CertificateAuthorityServiceGrpcTransport), - (CertificateAuthorityServiceAsyncClient, transports.CertificateAuthorityServiceGrpcAsyncIOTransport), -]) -def test_api_key_credentials(client_class, transport_class): - with mock.patch.object( - google.auth._default, "get_api_key_credentials", create=True - ) as get_api_key_credentials: - mock_cred = mock.Mock() - get_api_key_credentials.return_value = mock_cred - options = client_options.ClientOptions() - options.api_key = "api_key" - with mock.patch.object(transport_class, "__init__") as patched: - patched.return_value = None - client = client_class(client_options=options) - patched.assert_called_once_with( - credentials=mock_cred, - credentials_file=None, - host=client.DEFAULT_ENDPOINT, - scopes=None, - client_cert_source_for_mtls=None, - quota_project_id=None, - client_info=transports.base.DEFAULT_CLIENT_INFO, - always_use_jwt_access=True, - api_audience=None, - ) diff --git a/owl-bot-staging/v1beta1/.coveragerc b/owl-bot-staging/v1beta1/.coveragerc deleted file mode 100644 index eeab431..0000000 --- a/owl-bot-staging/v1beta1/.coveragerc +++ /dev/null @@ -1,13 +0,0 @@ -[run] -branch = True - -[report] -show_missing = True -omit = - google/cloud/security/privateca/__init__.py - google/cloud/security/privateca/gapic_version.py -exclude_lines = - # Re-enable the standard pragma - pragma: NO COVER - # Ignore debug-only repr - def __repr__ diff --git a/owl-bot-staging/v1beta1/.flake8 b/owl-bot-staging/v1beta1/.flake8 deleted file mode 100644 index 29227d4..0000000 --- a/owl-bot-staging/v1beta1/.flake8 +++ /dev/null @@ -1,33 +0,0 @@ -# -*- 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 -# -# https://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. - -# Generated by synthtool. DO NOT EDIT! -[flake8] -ignore = E203, E266, E501, W503 -exclude = - # Exclude generated code. - **/proto/** - **/gapic/** - **/services/** - **/types/** - *_pb2.py - - # Standard linting exemptions. - **/.nox/** - __pycache__, - .git, - *.pyc, - conf.py diff --git a/owl-bot-staging/v1beta1/MANIFEST.in b/owl-bot-staging/v1beta1/MANIFEST.in deleted file mode 100644 index de196ee..0000000 --- a/owl-bot-staging/v1beta1/MANIFEST.in +++ /dev/null @@ -1,2 +0,0 @@ -recursive-include google/cloud/security/privateca *.py -recursive-include google/cloud/security/privateca_v1beta1 *.py diff --git a/owl-bot-staging/v1beta1/README.rst b/owl-bot-staging/v1beta1/README.rst deleted file mode 100644 index d1e676b..0000000 --- a/owl-bot-staging/v1beta1/README.rst +++ /dev/null @@ -1,49 +0,0 @@ -Python Client for Google Cloud Security Privateca API -================================================= - -Quick Start ------------ - -In order to use this library, you first need to go through the following steps: - -1. `Select or create a Cloud Platform project.`_ -2. `Enable billing for your project.`_ -3. Enable the Google Cloud Security Privateca API. -4. `Setup Authentication.`_ - -.. _Select or create a Cloud Platform project.: https://console.cloud.google.com/project -.. _Enable billing for your project.: https://cloud.google.com/billing/docs/how-to/modify-project#enable_billing_for_a_project -.. _Setup Authentication.: https://googleapis.dev/python/google-api-core/latest/auth.html - -Installation -~~~~~~~~~~~~ - -Install this library in a `virtualenv`_ using pip. `virtualenv`_ is a tool to -create isolated Python environments. The basic problem it addresses is one of -dependencies and versions, and indirectly permissions. - -With `virtualenv`_, it's possible to install this library without needing system -install permissions, and without clashing with the installed system -dependencies. - -.. _`virtualenv`: https://virtualenv.pypa.io/en/latest/ - - -Mac/Linux -^^^^^^^^^ - -.. code-block:: console - - python3 -m venv - source /bin/activate - /bin/pip install /path/to/library - - -Windows -^^^^^^^ - -.. code-block:: console - - python3 -m venv - \Scripts\activate - \Scripts\pip.exe install \path\to\library diff --git a/owl-bot-staging/v1beta1/docs/conf.py b/owl-bot-staging/v1beta1/docs/conf.py deleted file mode 100644 index 529fb70..0000000 --- a/owl-bot-staging/v1beta1/docs/conf.py +++ /dev/null @@ -1,376 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# -# google-cloud-private-ca documentation build configuration file -# -# This file is execfile()d with the current directory set to its -# containing dir. -# -# Note that not all possible configuration values are present in this -# autogenerated file. -# -# All configuration values have a default; values that are commented out -# serve to show the default. - -import sys -import os -import shlex - -# If extensions (or modules to document with autodoc) are in another directory, -# add these directories to sys.path here. If the directory is relative to the -# documentation root, use os.path.abspath to make it absolute, like shown here. -sys.path.insert(0, os.path.abspath("..")) - -__version__ = "0.1.0" - -# -- General configuration ------------------------------------------------ - -# If your documentation needs a minimal Sphinx version, state it here. -needs_sphinx = "4.0.1" - -# Add any Sphinx extension module names here, as strings. They can be -# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom -# ones. -extensions = [ - "sphinx.ext.autodoc", - "sphinx.ext.autosummary", - "sphinx.ext.intersphinx", - "sphinx.ext.coverage", - "sphinx.ext.napoleon", - "sphinx.ext.todo", - "sphinx.ext.viewcode", -] - -# autodoc/autosummary flags -autoclass_content = "both" -autodoc_default_flags = ["members"] -autosummary_generate = True - - -# Add any paths that contain templates here, relative to this directory. -templates_path = ["_templates"] - -# Allow markdown includes (so releases.md can include CHANGLEOG.md) -# http://www.sphinx-doc.org/en/master/markdown.html -source_parsers = {".md": "recommonmark.parser.CommonMarkParser"} - -# The suffix(es) of source filenames. -# You can specify multiple suffix as a list of string: -source_suffix = [".rst", ".md"] - -# The encoding of source files. -# source_encoding = 'utf-8-sig' - -# The root toctree document. -root_doc = "index" - -# General information about the project. -project = u"google-cloud-private-ca" -copyright = u"2022, Google, LLC" -author = u"Google APIs" # TODO: autogenerate this bit - -# The version info for the project you're documenting, acts as replacement for -# |version| and |release|, also used in various other places throughout the -# built documents. -# -# The full version, including alpha/beta/rc tags. -release = __version__ -# The short X.Y version. -version = ".".join(release.split(".")[0:2]) - -# The language for content autogenerated by Sphinx. Refer to documentation -# for a list of supported languages. -# -# This is also used if you do content translation via gettext catalogs. -# Usually you set "language" from the command line for these cases. -language = None - -# There are two options for replacing |today|: either, you set today to some -# non-false value, then it is used: -# today = '' -# Else, today_fmt is used as the format for a strftime call. -# today_fmt = '%B %d, %Y' - -# List of patterns, relative to source directory, that match files and -# directories to ignore when looking for source files. -exclude_patterns = ["_build"] - -# The reST default role (used for this markup: `text`) to use for all -# documents. -# default_role = None - -# If true, '()' will be appended to :func: etc. cross-reference text. -# add_function_parentheses = True - -# If true, the current module name will be prepended to all description -# unit titles (such as .. function::). -# add_module_names = True - -# If true, sectionauthor and moduleauthor directives will be shown in the -# output. They are ignored by default. -# show_authors = False - -# The name of the Pygments (syntax highlighting) style to use. -pygments_style = "sphinx" - -# A list of ignored prefixes for module index sorting. -# modindex_common_prefix = [] - -# If true, keep warnings as "system message" paragraphs in the built documents. -# keep_warnings = False - -# If true, `todo` and `todoList` produce output, else they produce nothing. -todo_include_todos = True - - -# -- Options for HTML output ---------------------------------------------- - -# The theme to use for HTML and HTML Help pages. See the documentation for -# a list of builtin themes. -html_theme = "alabaster" - -# Theme options are theme-specific and customize the look and feel of a theme -# further. For a list of options available for each theme, see the -# documentation. -html_theme_options = { - "description": "Google Cloud Security Client Libraries for Python", - "github_user": "googleapis", - "github_repo": "google-cloud-python", - "github_banner": True, - "font_family": "'Roboto', Georgia, sans", - "head_font_family": "'Roboto', Georgia, serif", - "code_font_family": "'Roboto Mono', 'Consolas', monospace", -} - -# Add any paths that contain custom themes here, relative to this directory. -# html_theme_path = [] - -# The name for this set of Sphinx documents. If None, it defaults to -# " v documentation". -# html_title = None - -# A shorter title for the navigation bar. Default is the same as html_title. -# html_short_title = None - -# The name of an image file (relative to this directory) to place at the top -# of the sidebar. -# html_logo = None - -# The name of an image file (within the static path) to use as favicon of the -# docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32 -# pixels large. -# html_favicon = None - -# Add any paths that contain custom static files (such as style sheets) here, -# relative to this directory. They are copied after the builtin static files, -# so a file named "default.css" will overwrite the builtin "default.css". -html_static_path = ["_static"] - -# Add any extra paths that contain custom files (such as robots.txt or -# .htaccess) here, relative to this directory. These files are copied -# directly to the root of the documentation. -# html_extra_path = [] - -# If not '', a 'Last updated on:' timestamp is inserted at every page bottom, -# using the given strftime format. -# html_last_updated_fmt = '%b %d, %Y' - -# If true, SmartyPants will be used to convert quotes and dashes to -# typographically correct entities. -# html_use_smartypants = True - -# Custom sidebar templates, maps document names to template names. -# html_sidebars = {} - -# Additional templates that should be rendered to pages, maps page names to -# template names. -# html_additional_pages = {} - -# If false, no module index is generated. -# html_domain_indices = True - -# If false, no index is generated. -# html_use_index = True - -# If true, the index is split into individual pages for each letter. -# html_split_index = False - -# If true, links to the reST sources are added to the pages. -# html_show_sourcelink = True - -# If true, "Created using Sphinx" is shown in the HTML footer. Default is True. -# html_show_sphinx = True - -# If true, "(C) Copyright ..." is shown in the HTML footer. Default is True. -# html_show_copyright = True - -# If true, an OpenSearch description file will be output, and all pages will -# contain a tag referring to it. The value of this option must be the -# base URL from which the finished HTML is served. -# html_use_opensearch = '' - -# This is the file name suffix for HTML files (e.g. ".xhtml"). -# html_file_suffix = None - -# Language to be used for generating the HTML full-text search index. -# Sphinx supports the following languages: -# 'da', 'de', 'en', 'es', 'fi', 'fr', 'hu', 'it', 'ja' -# 'nl', 'no', 'pt', 'ro', 'ru', 'sv', 'tr' -# html_search_language = 'en' - -# A dictionary with options for the search language support, empty by default. -# Now only 'ja' uses this config value -# html_search_options = {'type': 'default'} - -# The name of a javascript file (relative to the configuration directory) that -# implements a search results scorer. If empty, the default will be used. -# html_search_scorer = 'scorer.js' - -# Output file base name for HTML help builder. -htmlhelp_basename = "google-cloud-private-ca-doc" - -# -- Options for warnings ------------------------------------------------------ - - -suppress_warnings = [ - # Temporarily suppress this to avoid "more than one target found for - # cross-reference" warning, which are intractable for us to avoid while in - # a mono-repo. - # See https://github.com/sphinx-doc/sphinx/blob - # /2a65ffeef5c107c19084fabdd706cdff3f52d93c/sphinx/domains/python.py#L843 - "ref.python" -] - -# -- Options for LaTeX output --------------------------------------------- - -latex_elements = { - # The paper size ('letterpaper' or 'a4paper'). - # 'papersize': 'letterpaper', - # The font size ('10pt', '11pt' or '12pt'). - # 'pointsize': '10pt', - # Additional stuff for the LaTeX preamble. - # 'preamble': '', - # Latex figure (float) alignment - # 'figure_align': 'htbp', -} - -# Grouping the document tree into LaTeX files. List of tuples -# (source start file, target name, title, -# author, documentclass [howto, manual, or own class]). -latex_documents = [ - ( - root_doc, - "google-cloud-private-ca.tex", - u"google-cloud-private-ca Documentation", - author, - "manual", - ) -] - -# The name of an image file (relative to this directory) to place at the top of -# the title page. -# latex_logo = None - -# For "manual" documents, if this is true, then toplevel headings are parts, -# not chapters. -# latex_use_parts = False - -# If true, show page references after internal links. -# latex_show_pagerefs = False - -# If true, show URL addresses after external links. -# latex_show_urls = False - -# Documents to append as an appendix to all manuals. -# latex_appendices = [] - -# If false, no module index is generated. -# latex_domain_indices = True - - -# -- Options for manual page output --------------------------------------- - -# One entry per manual page. List of tuples -# (source start file, name, description, authors, manual section). -man_pages = [ - ( - root_doc, - "google-cloud-private-ca", - u"Google Cloud Security Privateca Documentation", - [author], - 1, - ) -] - -# If true, show URL addresses after external links. -# man_show_urls = False - - -# -- Options for Texinfo output ------------------------------------------- - -# Grouping the document tree into Texinfo files. List of tuples -# (source start file, target name, title, author, -# dir menu entry, description, category) -texinfo_documents = [ - ( - root_doc, - "google-cloud-private-ca", - u"google-cloud-private-ca Documentation", - author, - "google-cloud-private-ca", - "GAPIC library for Google Cloud Security Privateca API", - "APIs", - ) -] - -# Documents to append as an appendix to all manuals. -# texinfo_appendices = [] - -# If false, no module index is generated. -# texinfo_domain_indices = True - -# How to display URL addresses: 'footnote', 'no', or 'inline'. -# texinfo_show_urls = 'footnote' - -# If true, do not generate a @detailmenu in the "Top" node's menu. -# texinfo_no_detailmenu = False - - -# Example configuration for intersphinx: refer to the Python standard library. -intersphinx_mapping = { - "python": ("http://python.readthedocs.org/en/latest/", None), - "gax": ("https://gax-python.readthedocs.org/en/latest/", None), - "google-auth": ("https://google-auth.readthedocs.io/en/stable", None), - "google-gax": ("https://gax-python.readthedocs.io/en/latest/", None), - "google.api_core": ("https://googleapis.dev/python/google-api-core/latest/", None), - "grpc": ("https://grpc.io/grpc/python/", None), - "requests": ("http://requests.kennethreitz.org/en/stable/", None), - "proto": ("https://proto-plus-python.readthedocs.io/en/stable", None), - "protobuf": ("https://googleapis.dev/python/protobuf/latest/", None), -} - - -# Napoleon settings -napoleon_google_docstring = True -napoleon_numpy_docstring = True -napoleon_include_private_with_doc = False -napoleon_include_special_with_doc = True -napoleon_use_admonition_for_examples = False -napoleon_use_admonition_for_notes = False -napoleon_use_admonition_for_references = False -napoleon_use_ivar = False -napoleon_use_param = True -napoleon_use_rtype = True diff --git a/owl-bot-staging/v1beta1/docs/index.rst b/owl-bot-staging/v1beta1/docs/index.rst deleted file mode 100644 index 43f127e..0000000 --- a/owl-bot-staging/v1beta1/docs/index.rst +++ /dev/null @@ -1,7 +0,0 @@ -API Reference -------------- -.. toctree:: - :maxdepth: 2 - - privateca_v1beta1/services - privateca_v1beta1/types diff --git a/owl-bot-staging/v1beta1/docs/privateca_v1beta1/certificate_authority_service.rst b/owl-bot-staging/v1beta1/docs/privateca_v1beta1/certificate_authority_service.rst deleted file mode 100644 index 536a4c8..0000000 --- a/owl-bot-staging/v1beta1/docs/privateca_v1beta1/certificate_authority_service.rst +++ /dev/null @@ -1,10 +0,0 @@ -CertificateAuthorityService ---------------------------------------------- - -.. automodule:: google.cloud.security.privateca_v1beta1.services.certificate_authority_service - :members: - :inherited-members: - -.. automodule:: google.cloud.security.privateca_v1beta1.services.certificate_authority_service.pagers - :members: - :inherited-members: diff --git a/owl-bot-staging/v1beta1/docs/privateca_v1beta1/services.rst b/owl-bot-staging/v1beta1/docs/privateca_v1beta1/services.rst deleted file mode 100644 index bb5adb3..0000000 --- a/owl-bot-staging/v1beta1/docs/privateca_v1beta1/services.rst +++ /dev/null @@ -1,6 +0,0 @@ -Services for Google Cloud Security Privateca v1beta1 API -======================================================== -.. toctree:: - :maxdepth: 2 - - certificate_authority_service diff --git a/owl-bot-staging/v1beta1/docs/privateca_v1beta1/types.rst b/owl-bot-staging/v1beta1/docs/privateca_v1beta1/types.rst deleted file mode 100644 index f2394f1..0000000 --- a/owl-bot-staging/v1beta1/docs/privateca_v1beta1/types.rst +++ /dev/null @@ -1,6 +0,0 @@ -Types for Google Cloud Security Privateca v1beta1 API -===================================================== - -.. automodule:: google.cloud.security.privateca_v1beta1.types - :members: - :show-inheritance: diff --git a/owl-bot-staging/v1beta1/google/cloud/security/privateca/__init__.py b/owl-bot-staging/v1beta1/google/cloud/security/privateca/__init__.py deleted file mode 100644 index 243f36d..0000000 --- a/owl-bot-staging/v1beta1/google/cloud/security/privateca/__init__.py +++ /dev/null @@ -1,111 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -from google.cloud.security.privateca import gapic_version as package_version - -__version__ = package_version.__version__ - - -from google.cloud.security.privateca_v1beta1.services.certificate_authority_service.client import CertificateAuthorityServiceClient -from google.cloud.security.privateca_v1beta1.services.certificate_authority_service.async_client import CertificateAuthorityServiceAsyncClient - -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 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.resources import RevocationReason -from google.cloud.security.privateca_v1beta1.types.service import ActivateCertificateAuthorityRequest -from google.cloud.security.privateca_v1beta1.types.service import CreateCertificateAuthorityRequest -from google.cloud.security.privateca_v1beta1.types.service import CreateCertificateRequest -from google.cloud.security.privateca_v1beta1.types.service import DisableCertificateAuthorityRequest -from google.cloud.security.privateca_v1beta1.types.service import EnableCertificateAuthorityRequest -from google.cloud.security.privateca_v1beta1.types.service import FetchCertificateAuthorityCsrRequest -from google.cloud.security.privateca_v1beta1.types.service import FetchCertificateAuthorityCsrResponse -from google.cloud.security.privateca_v1beta1.types.service import GetCertificateAuthorityRequest -from google.cloud.security.privateca_v1beta1.types.service import GetCertificateRequest -from google.cloud.security.privateca_v1beta1.types.service import GetCertificateRevocationListRequest -from google.cloud.security.privateca_v1beta1.types.service import GetReusableConfigRequest -from google.cloud.security.privateca_v1beta1.types.service import ListCertificateAuthoritiesRequest -from google.cloud.security.privateca_v1beta1.types.service import ListCertificateAuthoritiesResponse -from google.cloud.security.privateca_v1beta1.types.service import ListCertificateRevocationListsRequest -from google.cloud.security.privateca_v1beta1.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_v1beta1.types.service import ListReusableConfigsRequest -from google.cloud.security.privateca_v1beta1.types.service import ListReusableConfigsResponse -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 UpdateCertificateAuthorityRequest -from google.cloud.security.privateca_v1beta1.types.service import UpdateCertificateRequest -from google.cloud.security.privateca_v1beta1.types.service import UpdateCertificateRevocationListRequest - -__all__ = ('CertificateAuthorityServiceClient', - 'CertificateAuthorityServiceAsyncClient', - 'Certificate', - 'CertificateAuthority', - 'CertificateConfig', - 'CertificateDescription', - 'CertificateRevocationList', - 'KeyUsage', - 'ObjectId', - 'PublicKey', - 'ReusableConfig', - 'ReusableConfigValues', - 'ReusableConfigWrapper', - 'Subject', - 'SubjectAltNames', - 'SubordinateConfig', - 'X509Extension', - 'RevocationReason', - 'ActivateCertificateAuthorityRequest', - 'CreateCertificateAuthorityRequest', - 'CreateCertificateRequest', - 'DisableCertificateAuthorityRequest', - 'EnableCertificateAuthorityRequest', - 'FetchCertificateAuthorityCsrRequest', - 'FetchCertificateAuthorityCsrResponse', - 'GetCertificateAuthorityRequest', - 'GetCertificateRequest', - 'GetCertificateRevocationListRequest', - 'GetReusableConfigRequest', - 'ListCertificateAuthoritiesRequest', - 'ListCertificateAuthoritiesResponse', - 'ListCertificateRevocationListsRequest', - 'ListCertificateRevocationListsResponse', - 'ListCertificatesRequest', - 'ListCertificatesResponse', - 'ListReusableConfigsRequest', - 'ListReusableConfigsResponse', - 'OperationMetadata', - 'RestoreCertificateAuthorityRequest', - 'RevokeCertificateRequest', - 'ScheduleDeleteCertificateAuthorityRequest', - 'UpdateCertificateAuthorityRequest', - 'UpdateCertificateRequest', - 'UpdateCertificateRevocationListRequest', -) diff --git a/owl-bot-staging/v1beta1/google/cloud/security/privateca/gapic_version.py b/owl-bot-staging/v1beta1/google/cloud/security/privateca/gapic_version.py deleted file mode 100644 index 405b1ce..0000000 --- a/owl-bot-staging/v1beta1/google/cloud/security/privateca/gapic_version.py +++ /dev/null @@ -1,16 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -__version__ = "0.1.0" # {x-release-please-version} diff --git a/owl-bot-staging/v1beta1/google/cloud/security/privateca/py.typed b/owl-bot-staging/v1beta1/google/cloud/security/privateca/py.typed deleted file mode 100644 index 2803606..0000000 --- a/owl-bot-staging/v1beta1/google/cloud/security/privateca/py.typed +++ /dev/null @@ -1,2 +0,0 @@ -# Marker file for PEP 561. -# The google-cloud-private-ca package uses inline types. diff --git a/owl-bot-staging/v1beta1/google/cloud/security/privateca_v1beta1/__init__.py b/owl-bot-staging/v1beta1/google/cloud/security/privateca_v1beta1/__init__.py deleted file mode 100644 index 7221827..0000000 --- a/owl-bot-staging/v1beta1/google/cloud/security/privateca_v1beta1/__init__.py +++ /dev/null @@ -1,112 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -from google.cloud.security.privateca_v1beta1 import gapic_version as package_version - -__version__ = package_version.__version__ - - -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 -from .types.resources import CertificateDescription -from .types.resources import CertificateRevocationList -from .types.resources import KeyUsage -from .types.resources import ObjectId -from .types.resources import PublicKey -from .types.resources import ReusableConfig -from .types.resources import ReusableConfigValues -from .types.resources import ReusableConfigWrapper -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 -from .types.service import DisableCertificateAuthorityRequest -from .types.service import EnableCertificateAuthorityRequest -from .types.service import FetchCertificateAuthorityCsrRequest -from .types.service import FetchCertificateAuthorityCsrResponse -from .types.service import GetCertificateAuthorityRequest -from .types.service import GetCertificateRequest -from .types.service import GetCertificateRevocationListRequest -from .types.service import GetReusableConfigRequest -from .types.service import ListCertificateAuthoritiesRequest -from .types.service import ListCertificateAuthoritiesResponse -from .types.service import ListCertificateRevocationListsRequest -from .types.service import ListCertificateRevocationListsResponse -from .types.service import ListCertificatesRequest -from .types.service import ListCertificatesResponse -from .types.service import ListReusableConfigsRequest -from .types.service import ListReusableConfigsResponse -from .types.service import OperationMetadata -from .types.service import RestoreCertificateAuthorityRequest -from .types.service import RevokeCertificateRequest -from .types.service import ScheduleDeleteCertificateAuthorityRequest -from .types.service import UpdateCertificateAuthorityRequest -from .types.service import UpdateCertificateRequest -from .types.service import UpdateCertificateRevocationListRequest - -__all__ = ( - 'CertificateAuthorityServiceAsyncClient', -'ActivateCertificateAuthorityRequest', -'Certificate', -'CertificateAuthority', -'CertificateAuthorityServiceClient', -'CertificateConfig', -'CertificateDescription', -'CertificateRevocationList', -'CreateCertificateAuthorityRequest', -'CreateCertificateRequest', -'DisableCertificateAuthorityRequest', -'EnableCertificateAuthorityRequest', -'FetchCertificateAuthorityCsrRequest', -'FetchCertificateAuthorityCsrResponse', -'GetCertificateAuthorityRequest', -'GetCertificateRequest', -'GetCertificateRevocationListRequest', -'GetReusableConfigRequest', -'KeyUsage', -'ListCertificateAuthoritiesRequest', -'ListCertificateAuthoritiesResponse', -'ListCertificateRevocationListsRequest', -'ListCertificateRevocationListsResponse', -'ListCertificatesRequest', -'ListCertificatesResponse', -'ListReusableConfigsRequest', -'ListReusableConfigsResponse', -'ObjectId', -'OperationMetadata', -'PublicKey', -'RestoreCertificateAuthorityRequest', -'ReusableConfig', -'ReusableConfigValues', -'ReusableConfigWrapper', -'RevocationReason', -'RevokeCertificateRequest', -'ScheduleDeleteCertificateAuthorityRequest', -'Subject', -'SubjectAltNames', -'SubordinateConfig', -'UpdateCertificateAuthorityRequest', -'UpdateCertificateRequest', -'UpdateCertificateRevocationListRequest', -'X509Extension', -) diff --git a/owl-bot-staging/v1beta1/google/cloud/security/privateca_v1beta1/gapic_metadata.json b/owl-bot-staging/v1beta1/google/cloud/security/privateca_v1beta1/gapic_metadata.json deleted file mode 100644 index 3406d51..0000000 --- a/owl-bot-staging/v1beta1/google/cloud/security/privateca_v1beta1/gapic_metadata.json +++ /dev/null @@ -1,223 +0,0 @@ - { - "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/owl-bot-staging/v1beta1/google/cloud/security/privateca_v1beta1/gapic_version.py b/owl-bot-staging/v1beta1/google/cloud/security/privateca_v1beta1/gapic_version.py deleted file mode 100644 index 405b1ce..0000000 --- a/owl-bot-staging/v1beta1/google/cloud/security/privateca_v1beta1/gapic_version.py +++ /dev/null @@ -1,16 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -__version__ = "0.1.0" # {x-release-please-version} diff --git a/owl-bot-staging/v1beta1/google/cloud/security/privateca_v1beta1/py.typed b/owl-bot-staging/v1beta1/google/cloud/security/privateca_v1beta1/py.typed deleted file mode 100644 index 2803606..0000000 --- a/owl-bot-staging/v1beta1/google/cloud/security/privateca_v1beta1/py.typed +++ /dev/null @@ -1,2 +0,0 @@ -# Marker file for PEP 561. -# The google-cloud-private-ca package uses inline types. diff --git a/owl-bot-staging/v1beta1/google/cloud/security/privateca_v1beta1/services/__init__.py b/owl-bot-staging/v1beta1/google/cloud/security/privateca_v1beta1/services/__init__.py deleted file mode 100644 index e8e1c38..0000000 --- a/owl-bot-staging/v1beta1/google/cloud/security/privateca_v1beta1/services/__init__.py +++ /dev/null @@ -1,15 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# diff --git a/owl-bot-staging/v1beta1/google/cloud/security/privateca_v1beta1/services/certificate_authority_service/__init__.py b/owl-bot-staging/v1beta1/google/cloud/security/privateca_v1beta1/services/certificate_authority_service/__init__.py deleted file mode 100644 index 713bfd9..0000000 --- a/owl-bot-staging/v1beta1/google/cloud/security/privateca_v1beta1/services/certificate_authority_service/__init__.py +++ /dev/null @@ -1,22 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -from .client import CertificateAuthorityServiceClient -from .async_client import CertificateAuthorityServiceAsyncClient - -__all__ = ( - 'CertificateAuthorityServiceClient', - 'CertificateAuthorityServiceAsyncClient', -) diff --git a/owl-bot-staging/v1beta1/google/cloud/security/privateca_v1beta1/services/certificate_authority_service/async_client.py b/owl-bot-staging/v1beta1/google/cloud/security/privateca_v1beta1/services/certificate_authority_service/async_client.py deleted file mode 100644 index b7ef08b..0000000 --- a/owl-bot-staging/v1beta1/google/cloud/security/privateca_v1beta1/services/certificate_authority_service/async_client.py +++ /dev/null @@ -1,2618 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -from collections import OrderedDict -import functools -import re -from typing import Dict, Mapping, MutableMapping, MutableSequence, Optional, Sequence, Tuple, Type, Union - -from google.cloud.security.privateca_v1beta1 import gapic_version as package_version - -from google.api_core.client_options import ClientOptions -from google.api_core import exceptions as core_exceptions -from google.api_core import gapic_v1 -from google.api_core import retry as retries -from google.auth import credentials as ga_credentials # type: ignore -from google.oauth2 import service_account # type: ignore - -try: - OptionalRetry = Union[retries.Retry, gapic_v1.method._MethodDefault] -except AttributeError: # pragma: NO COVER - OptionalRetry = Union[retries.Retry, object] # type: ignore - -from google.api_core import operation # type: ignore -from google.api_core import operation_async # type: ignore -from google.cloud.security.privateca_v1beta1.services.certificate_authority_service import pagers -from google.cloud.security.privateca_v1beta1.types import resources -from google.cloud.security.privateca_v1beta1.types import service -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 - - -class CertificateAuthorityServiceAsyncClient: - """[Certificate Authority - Service][google.cloud.security.privateca.v1beta1.CertificateAuthorityService] - manages private certificate authorities and issued certificates. - """ - - _client: CertificateAuthorityServiceClient - - DEFAULT_ENDPOINT = CertificateAuthorityServiceClient.DEFAULT_ENDPOINT - DEFAULT_MTLS_ENDPOINT = CertificateAuthorityServiceClient.DEFAULT_MTLS_ENDPOINT - - certificate_path = staticmethod(CertificateAuthorityServiceClient.certificate_path) - parse_certificate_path = staticmethod(CertificateAuthorityServiceClient.parse_certificate_path) - certificate_authority_path = staticmethod(CertificateAuthorityServiceClient.certificate_authority_path) - parse_certificate_authority_path = staticmethod(CertificateAuthorityServiceClient.parse_certificate_authority_path) - certificate_revocation_list_path = staticmethod(CertificateAuthorityServiceClient.certificate_revocation_list_path) - parse_certificate_revocation_list_path = staticmethod(CertificateAuthorityServiceClient.parse_certificate_revocation_list_path) - reusable_config_path = staticmethod(CertificateAuthorityServiceClient.reusable_config_path) - 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) - parse_common_location_path = staticmethod(CertificateAuthorityServiceClient.parse_common_location_path) - - @classmethod - def from_service_account_info(cls, info: dict, *args, **kwargs): - """Creates an instance of this client using the provided credentials - info. - - Args: - info (dict): The service account private key info. - args: Additional arguments to pass to the constructor. - kwargs: Additional arguments to pass to the constructor. - - Returns: - CertificateAuthorityServiceAsyncClient: The constructed client. - """ - return CertificateAuthorityServiceClient.from_service_account_info.__func__(CertificateAuthorityServiceAsyncClient, info, *args, **kwargs) # type: ignore - - @classmethod - def from_service_account_file(cls, filename: str, *args, **kwargs): - """Creates an instance of this client using the provided credentials - file. - - Args: - filename (str): The path to the service account private key json - file. - args: Additional arguments to pass to the constructor. - kwargs: Additional arguments to pass to the constructor. - - Returns: - CertificateAuthorityServiceAsyncClient: The constructed client. - """ - return CertificateAuthorityServiceClient.from_service_account_file.__func__(CertificateAuthorityServiceAsyncClient, filename, *args, **kwargs) # type: ignore - - from_service_account_json = from_service_account_file - - @classmethod - def get_mtls_endpoint_and_cert_source(cls, client_options: Optional[ClientOptions] = None): - """Return the API endpoint and client cert source for mutual TLS. - - The client cert source is determined in the following order: - (1) if `GOOGLE_API_USE_CLIENT_CERTIFICATE` environment variable is not "true", the - client cert source is None. - (2) if `client_options.client_cert_source` is provided, use the provided one; if the - default client cert source exists, use the default one; otherwise the client cert - source is None. - - The API endpoint is determined in the following order: - (1) if `client_options.api_endpoint` if provided, use the provided one. - (2) if `GOOGLE_API_USE_CLIENT_CERTIFICATE` environment variable is "always", use the - default mTLS endpoint; if the environment variable is "never", use the default API - endpoint; otherwise if client cert source exists, use the default mTLS endpoint, otherwise - use the default API endpoint. - - More details can be found at https://google.aip.dev/auth/4114. - - Args: - client_options (google.api_core.client_options.ClientOptions): Custom options for the - client. Only the `api_endpoint` and `client_cert_source` properties may be used - in this method. - - Returns: - Tuple[str, Callable[[], Tuple[bytes, bytes]]]: returns the API endpoint and the - client cert source to use. - - Raises: - google.auth.exceptions.MutualTLSChannelError: If any errors happen. - """ - return CertificateAuthorityServiceClient.get_mtls_endpoint_and_cert_source(client_options) # type: ignore - - @property - def transport(self) -> CertificateAuthorityServiceTransport: - """Returns the transport used by the client instance. - - Returns: - CertificateAuthorityServiceTransport: The transport used by the client instance. - """ - return self._client.transport - - get_transport_class = functools.partial(type(CertificateAuthorityServiceClient).get_transport_class, type(CertificateAuthorityServiceClient)) - - def __init__(self, *, - credentials: Optional[ga_credentials.Credentials] = None, - transport: Union[str, CertificateAuthorityServiceTransport] = "grpc_asyncio", - client_options: Optional[ClientOptions] = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - ) -> None: - """Instantiates the certificate authority service client. - - Args: - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - transport (Union[str, ~.CertificateAuthorityServiceTransport]): The - transport to use. If set to None, a transport is chosen - automatically. - client_options (ClientOptions): Custom options for the client. It - won't take effect if a ``transport`` instance is provided. - (1) The ``api_endpoint`` property can be used to override the - default endpoint provided by the client. GOOGLE_API_USE_MTLS_ENDPOINT - environment variable can also be used to override the endpoint: - "always" (always use the default mTLS endpoint), "never" (always - use the default regular endpoint) and "auto" (auto switch to the - default mTLS endpoint if client certificate is present, this is - the default value). However, the ``api_endpoint`` property takes - precedence if provided. - (2) If GOOGLE_API_USE_CLIENT_CERTIFICATE environment variable - is "true", then the ``client_cert_source`` property can be used - to provide client certificate for mutual TLS transport. If - not provided, the default SSL client certificate will be used if - present. If GOOGLE_API_USE_CLIENT_CERTIFICATE is "false" or not - set, no client certificate will be used. - - Raises: - google.auth.exceptions.MutualTlsChannelError: If mutual TLS transport - creation failed for any reason. - """ - self._client = CertificateAuthorityServiceClient( - credentials=credentials, - transport=transport, - client_options=client_options, - client_info=client_info, - - ) - - async def create_certificate(self, - request: Optional[Union[service.CreateCertificateRequest, dict]] = None, - *, - parent: Optional[str] = None, - certificate: Optional[resources.Certificate] = None, - certificate_id: Optional[str] = None, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), - ) -> resources.Certificate: - r"""Create a new - [Certificate][google.cloud.security.privateca.v1beta1.Certificate] - in a given Project, Location from a particular - [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority]. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud.security import privateca_v1beta1 - - async def sample_create_certificate(): - # Create a client - client = privateca_v1beta1.CertificateAuthorityServiceAsyncClient() - - # Initialize request argument(s) - certificate = privateca_v1beta1.Certificate() - certificate.pem_csr = "pem_csr_value" - - request = privateca_v1beta1.CreateCertificateRequest( - parent="parent_value", - certificate=certificate, - ) - - # Make the request - response = await client.create_certificate(request=request) - - # Handle the response - print(response) - - Args: - request (Optional[Union[google.cloud.security.privateca_v1beta1.types.CreateCertificateRequest, dict]]): - The request object. Request message for - [CertificateAuthorityService.CreateCertificate][google.cloud.security.privateca.v1beta1.CertificateAuthorityService.CreateCertificate]. - parent (:class:`str`): - Required. The resource name of the location and - [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority] - associated with the - [Certificate][google.cloud.security.privateca.v1beta1.Certificate], - in the format - ``projects/*/locations/*/certificateAuthorities/*``. - - This corresponds to the ``parent`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - certificate (:class:`google.cloud.security.privateca_v1beta1.types.Certificate`): - Required. A - [Certificate][google.cloud.security.privateca.v1beta1.Certificate] - with initial field values. - - This corresponds to the ``certificate`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - certificate_id (:class:`str`): - Optional. It must be unique within a location and match - the regular expression ``[a-zA-Z0-9_-]{1,63}``. This - field is required when using a - [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority] - in the Enterprise - [CertificateAuthority.Tier][google.cloud.security.privateca.v1beta1.CertificateAuthority.Tier], - but is optional and its value is ignored otherwise. - - 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. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.cloud.security.privateca_v1beta1.types.Certificate: - A [Certificate][google.cloud.security.privateca.v1beta1.Certificate] corresponds to a signed X.509 certificate issued by a - [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority]. - - """ - # Create or coerce a protobuf request object. - # Quick check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - has_flattened_params = any([parent, certificate, certificate_id]) - if request is not None and has_flattened_params: - raise ValueError("If the `request` argument is set, then none of " - "the individual field arguments should be set.") - - 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: - request.certificate = certificate - if certificate_id is not None: - request.certificate_id = certificate_id - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = gapic_v1.method_async.wrap_method( - self._client._transport.create_certificate, - default_timeout=None, - client_info=DEFAULT_CLIENT_INFO, - ) - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata(( - ("parent", request.parent), - )), - ) - - # Send the request. - response = await rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Done; return the response. - return response - - async def get_certificate(self, - request: Optional[Union[service.GetCertificateRequest, dict]] = None, - *, - name: Optional[str] = None, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), - ) -> resources.Certificate: - r"""Returns a - [Certificate][google.cloud.security.privateca.v1beta1.Certificate]. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud.security import privateca_v1beta1 - - async def sample_get_certificate(): - # Create a client - client = privateca_v1beta1.CertificateAuthorityServiceAsyncClient() - - # Initialize request argument(s) - request = privateca_v1beta1.GetCertificateRequest( - name="name_value", - ) - - # Make the request - response = await client.get_certificate(request=request) - - # Handle the response - print(response) - - Args: - request (Optional[Union[google.cloud.security.privateca_v1beta1.types.GetCertificateRequest, dict]]): - The request object. Request message for - [CertificateAuthorityService.GetCertificate][google.cloud.security.privateca.v1beta1.CertificateAuthorityService.GetCertificate]. - name (:class:`str`): - Required. The - [name][google.cloud.security.privateca.v1beta1.Certificate.name] - of the - [Certificate][google.cloud.security.privateca.v1beta1.Certificate] - to get. - - 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. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.cloud.security.privateca_v1beta1.types.Certificate: - A [Certificate][google.cloud.security.privateca.v1beta1.Certificate] corresponds to a signed X.509 certificate issued by a - [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority]. - - """ - # Create or coerce a protobuf request object. - # Quick check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - has_flattened_params = any([name]) - if request is not None and has_flattened_params: - raise ValueError("If the `request` argument is set, then none of " - "the individual field arguments should be set.") - - 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 - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = gapic_v1.method_async.wrap_method( - self._client._transport.get_certificate, - default_timeout=None, - client_info=DEFAULT_CLIENT_INFO, - ) - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata(( - ("name", request.name), - )), - ) - - # Send the request. - response = await rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Done; return the response. - return response - - async def list_certificates(self, - request: Optional[Union[service.ListCertificatesRequest, dict]] = None, - *, - parent: Optional[str] = None, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), - ) -> pagers.ListCertificatesAsyncPager: - r"""Lists - [Certificates][google.cloud.security.privateca.v1beta1.Certificate]. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud.security import privateca_v1beta1 - - async def sample_list_certificates(): - # Create a client - client = privateca_v1beta1.CertificateAuthorityServiceAsyncClient() - - # Initialize request argument(s) - request = privateca_v1beta1.ListCertificatesRequest( - parent="parent_value", - ) - - # Make the request - page_result = client.list_certificates(request=request) - - # Handle the response - async for response in page_result: - print(response) - - Args: - request (Optional[Union[google.cloud.security.privateca_v1beta1.types.ListCertificatesRequest, dict]]): - The request object. Request message for - [CertificateAuthorityService.ListCertificates][google.cloud.security.privateca.v1beta1.CertificateAuthorityService.ListCertificates]. - parent (:class:`str`): - Required. The resource name of the location associated - with the - [Certificates][google.cloud.security.privateca.v1beta1.Certificate], - in the format - ``projects/*/locations/*/certificateauthorities/*``. - - 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. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.cloud.security.privateca_v1beta1.services.certificate_authority_service.pagers.ListCertificatesAsyncPager: - Response message for - [CertificateAuthorityService.ListCertificates][google.cloud.security.privateca.v1beta1.CertificateAuthorityService.ListCertificates]. - - Iterating over this object will yield results and - resolve additional pages automatically. - - """ - # Create or coerce a protobuf request object. - # Quick check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - has_flattened_params = any([parent]) - if request is not None and has_flattened_params: - raise ValueError("If the `request` argument is set, then none of " - "the individual field arguments should be set.") - - 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 - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = gapic_v1.method_async.wrap_method( - self._client._transport.list_certificates, - default_timeout=None, - client_info=DEFAULT_CLIENT_INFO, - ) - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata(( - ("parent", request.parent), - )), - ) - - # Send the request. - response = await rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # This method is paged; wrap the response in a pager, which provides - # an `__aiter__` convenience method. - response = pagers.ListCertificatesAsyncPager( - method=rpc, - request=request, - response=response, - metadata=metadata, - ) - - # Done; return the response. - return response - - async def revoke_certificate(self, - request: Optional[Union[service.RevokeCertificateRequest, dict]] = None, - *, - name: Optional[str] = None, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), - ) -> resources.Certificate: - r"""Revoke a - [Certificate][google.cloud.security.privateca.v1beta1.Certificate]. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud.security import privateca_v1beta1 - - async def sample_revoke_certificate(): - # Create a client - client = privateca_v1beta1.CertificateAuthorityServiceAsyncClient() - - # Initialize request argument(s) - request = privateca_v1beta1.RevokeCertificateRequest( - name="name_value", - reason="ATTRIBUTE_AUTHORITY_COMPROMISE", - ) - - # Make the request - response = await client.revoke_certificate(request=request) - - # Handle the response - print(response) - - Args: - request (Optional[Union[google.cloud.security.privateca_v1beta1.types.RevokeCertificateRequest, dict]]): - The request object. Request message for - [CertificateAuthorityService.RevokeCertificate][google.cloud.security.privateca.v1beta1.CertificateAuthorityService.RevokeCertificate]. - name (:class:`str`): - Required. The resource name for this - [Certificate][google.cloud.security.privateca.v1beta1.Certificate] - in the format - ``projects/*/locations/*/certificateAuthorities/*/certificates/*``. - - 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. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.cloud.security.privateca_v1beta1.types.Certificate: - A [Certificate][google.cloud.security.privateca.v1beta1.Certificate] corresponds to a signed X.509 certificate issued by a - [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority]. - - """ - # Create or coerce a protobuf request object. - # Quick check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - has_flattened_params = any([name]) - if request is not None and has_flattened_params: - raise ValueError("If the `request` argument is set, then none of " - "the individual field arguments should be set.") - - 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 - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = gapic_v1.method_async.wrap_method( - self._client._transport.revoke_certificate, - default_timeout=None, - client_info=DEFAULT_CLIENT_INFO, - ) - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata(( - ("name", request.name), - )), - ) - - # Send the request. - response = await rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Done; return the response. - return response - - async def update_certificate(self, - request: Optional[Union[service.UpdateCertificateRequest, dict]] = None, - *, - certificate: Optional[resources.Certificate] = None, - update_mask: Optional[field_mask_pb2.FieldMask] = None, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), - ) -> resources.Certificate: - r"""Update a - [Certificate][google.cloud.security.privateca.v1beta1.Certificate]. - Currently, the only field you can update is the - [labels][google.cloud.security.privateca.v1beta1.Certificate.labels] - field. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud.security import privateca_v1beta1 - - async def sample_update_certificate(): - # Create a client - client = privateca_v1beta1.CertificateAuthorityServiceAsyncClient() - - # Initialize request argument(s) - certificate = privateca_v1beta1.Certificate() - certificate.pem_csr = "pem_csr_value" - - request = privateca_v1beta1.UpdateCertificateRequest( - certificate=certificate, - ) - - # Make the request - response = await client.update_certificate(request=request) - - # Handle the response - print(response) - - Args: - request (Optional[Union[google.cloud.security.privateca_v1beta1.types.UpdateCertificateRequest, dict]]): - The request object. Request message for - [CertificateAuthorityService.UpdateCertificate][google.cloud.security.privateca.v1beta1.CertificateAuthorityService.UpdateCertificate]. - certificate (:class:`google.cloud.security.privateca_v1beta1.types.Certificate`): - Required. - [Certificate][google.cloud.security.privateca.v1beta1.Certificate] - with updated values. - - This corresponds to the ``certificate`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - update_mask (:class:`google.protobuf.field_mask_pb2.FieldMask`): - Required. A list of fields to be - updated in this request. - - 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. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.cloud.security.privateca_v1beta1.types.Certificate: - A [Certificate][google.cloud.security.privateca.v1beta1.Certificate] corresponds to a signed X.509 certificate issued by a - [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority]. - - """ - # Create or coerce a protobuf request object. - # Quick check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - has_flattened_params = any([certificate, update_mask]) - if request is not None and has_flattened_params: - raise ValueError("If the `request` argument is set, then none of " - "the individual field arguments should be set.") - - 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: - request.update_mask = update_mask - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = gapic_v1.method_async.wrap_method( - self._client._transport.update_certificate, - default_timeout=None, - client_info=DEFAULT_CLIENT_INFO, - ) - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata(( - ("certificate.name", request.certificate.name), - )), - ) - - # Send the request. - response = await rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Done; return the response. - return response - - async def activate_certificate_authority(self, - request: Optional[Union[service.ActivateCertificateAuthorityRequest, dict]] = None, - *, - name: Optional[str] = None, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), - ) -> operation_async.AsyncOperation: - r"""Activate a - [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority] - that is in state - [PENDING_ACTIVATION][google.cloud.security.privateca.v1beta1.CertificateAuthority.State.PENDING_ACTIVATION] - and is of type - [SUBORDINATE][google.cloud.security.privateca.v1beta1.CertificateAuthority.Type.SUBORDINATE]. - After the parent Certificate Authority signs a certificate - signing request from - [FetchCertificateAuthorityCsr][google.cloud.security.privateca.v1beta1.CertificateAuthorityService.FetchCertificateAuthorityCsr], - this method can complete the activation process. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud.security import privateca_v1beta1 - - async def sample_activate_certificate_authority(): - # Create a client - client = privateca_v1beta1.CertificateAuthorityServiceAsyncClient() - - # Initialize request argument(s) - subordinate_config = privateca_v1beta1.SubordinateConfig() - subordinate_config.certificate_authority = "certificate_authority_value" - - request = privateca_v1beta1.ActivateCertificateAuthorityRequest( - name="name_value", - pem_ca_certificate="pem_ca_certificate_value", - subordinate_config=subordinate_config, - ) - - # Make the request - operation = client.activate_certificate_authority(request=request) - - print("Waiting for operation to complete...") - - response = (await operation).result() - - # Handle the response - print(response) - - Args: - request (Optional[Union[google.cloud.security.privateca_v1beta1.types.ActivateCertificateAuthorityRequest, dict]]): - The request object. Request message for - [CertificateAuthorityService.ActivateCertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthorityService.ActivateCertificateAuthority]. - name (:class:`str`): - Required. The resource name for this - [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority] - in the format - ``projects/*/locations/*/certificateAuthorities/*``. - - 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. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.api_core.operation_async.AsyncOperation: - An object representing a long-running operation. - - The result type for the operation will be :class:`google.cloud.security.privateca_v1beta1.types.CertificateAuthority` A [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority] represents an individual Certificate Authority. - A - [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority] - can be used to create - [Certificates][google.cloud.security.privateca.v1beta1.Certificate]. - - """ - # Create or coerce a protobuf request object. - # Quick check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - has_flattened_params = any([name]) - if request is not None and has_flattened_params: - raise ValueError("If the `request` argument is set, then none of " - "the individual field arguments should be set.") - - 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 - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = gapic_v1.method_async.wrap_method( - self._client._transport.activate_certificate_authority, - default_timeout=None, - client_info=DEFAULT_CLIENT_INFO, - ) - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata(( - ("name", request.name), - )), - ) - - # Send the request. - response = await rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Wrap the response in an operation future. - response = operation_async.from_gapic( - response, - self._client._transport.operations_client, - resources.CertificateAuthority, - metadata_type=service.OperationMetadata, - ) - - # Done; return the response. - return response - - async def create_certificate_authority(self, - request: Optional[Union[service.CreateCertificateAuthorityRequest, dict]] = None, - *, - parent: Optional[str] = None, - certificate_authority: Optional[resources.CertificateAuthority] = None, - certificate_authority_id: Optional[str] = None, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), - ) -> operation_async.AsyncOperation: - r"""Create a new - [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority] - in a given Project and Location. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud.security import privateca_v1beta1 - - async def sample_create_certificate_authority(): - # Create a client - client = privateca_v1beta1.CertificateAuthorityServiceAsyncClient() - - # Initialize request argument(s) - certificate_authority = privateca_v1beta1.CertificateAuthority() - certificate_authority.type_ = "SUBORDINATE" - certificate_authority.tier = "DEVOPS" - certificate_authority.config.reusable_config.reusable_config = "reusable_config_value" - certificate_authority.key_spec.cloud_kms_key_version = "cloud_kms_key_version_value" - - request = privateca_v1beta1.CreateCertificateAuthorityRequest( - parent="parent_value", - certificate_authority_id="certificate_authority_id_value", - certificate_authority=certificate_authority, - ) - - # Make the request - operation = client.create_certificate_authority(request=request) - - print("Waiting for operation to complete...") - - response = (await operation).result() - - # Handle the response - print(response) - - Args: - request (Optional[Union[google.cloud.security.privateca_v1beta1.types.CreateCertificateAuthorityRequest, dict]]): - The request object. Request message for - [CertificateAuthorityService.CreateCertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthorityService.CreateCertificateAuthority]. - parent (:class:`str`): - Required. The resource name of the location associated - with the - [CertificateAuthorities][google.cloud.security.privateca.v1beta1.CertificateAuthority], - in the format ``projects/*/locations/*``. - - This corresponds to the ``parent`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - certificate_authority (:class:`google.cloud.security.privateca_v1beta1.types.CertificateAuthority`): - Required. A - [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority] - with initial field values. - - This corresponds to the ``certificate_authority`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - certificate_authority_id (:class:`str`): - Required. It must be unique within a location and match - the regular expression ``[a-zA-Z0-9_-]{1,63}`` - - 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. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.api_core.operation_async.AsyncOperation: - An object representing a long-running operation. - - The result type for the operation will be :class:`google.cloud.security.privateca_v1beta1.types.CertificateAuthority` A [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority] represents an individual Certificate Authority. - A - [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority] - can be used to create - [Certificates][google.cloud.security.privateca.v1beta1.Certificate]. - - """ - # Create or coerce a protobuf request object. - # Quick check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - has_flattened_params = any([parent, certificate_authority, certificate_authority_id]) - if request is not None and has_flattened_params: - raise ValueError("If the `request` argument is set, then none of " - "the individual field arguments should be set.") - - 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: - request.certificate_authority = certificate_authority - if certificate_authority_id is not None: - request.certificate_authority_id = certificate_authority_id - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = gapic_v1.method_async.wrap_method( - self._client._transport.create_certificate_authority, - default_timeout=None, - client_info=DEFAULT_CLIENT_INFO, - ) - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata(( - ("parent", request.parent), - )), - ) - - # Send the request. - response = await rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Wrap the response in an operation future. - response = operation_async.from_gapic( - response, - self._client._transport.operations_client, - resources.CertificateAuthority, - metadata_type=service.OperationMetadata, - ) - - # Done; return the response. - return response - - async def disable_certificate_authority(self, - request: Optional[Union[service.DisableCertificateAuthorityRequest, dict]] = None, - *, - name: Optional[str] = None, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), - ) -> operation_async.AsyncOperation: - r"""Disable a - [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority]. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud.security import privateca_v1beta1 - - async def sample_disable_certificate_authority(): - # Create a client - client = privateca_v1beta1.CertificateAuthorityServiceAsyncClient() - - # Initialize request argument(s) - request = privateca_v1beta1.DisableCertificateAuthorityRequest( - name="name_value", - ) - - # Make the request - operation = client.disable_certificate_authority(request=request) - - print("Waiting for operation to complete...") - - response = (await operation).result() - - # Handle the response - print(response) - - Args: - request (Optional[Union[google.cloud.security.privateca_v1beta1.types.DisableCertificateAuthorityRequest, dict]]): - The request object. Request message for - [CertificateAuthorityService.DisableCertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthorityService.DisableCertificateAuthority]. - name (:class:`str`): - Required. The resource name for this - [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority] - in the format - ``projects/*/locations/*/certificateAuthorities/*``. - - 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. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.api_core.operation_async.AsyncOperation: - An object representing a long-running operation. - - The result type for the operation will be :class:`google.cloud.security.privateca_v1beta1.types.CertificateAuthority` A [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority] represents an individual Certificate Authority. - A - [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority] - can be used to create - [Certificates][google.cloud.security.privateca.v1beta1.Certificate]. - - """ - # Create or coerce a protobuf request object. - # Quick check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - has_flattened_params = any([name]) - if request is not None and has_flattened_params: - raise ValueError("If the `request` argument is set, then none of " - "the individual field arguments should be set.") - - 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 - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = gapic_v1.method_async.wrap_method( - self._client._transport.disable_certificate_authority, - default_timeout=None, - client_info=DEFAULT_CLIENT_INFO, - ) - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata(( - ("name", request.name), - )), - ) - - # Send the request. - response = await rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Wrap the response in an operation future. - response = operation_async.from_gapic( - response, - self._client._transport.operations_client, - resources.CertificateAuthority, - metadata_type=service.OperationMetadata, - ) - - # Done; return the response. - return response - - async def enable_certificate_authority(self, - request: Optional[Union[service.EnableCertificateAuthorityRequest, dict]] = None, - *, - name: Optional[str] = None, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), - ) -> operation_async.AsyncOperation: - r"""Enable a - [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority]. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud.security import privateca_v1beta1 - - async def sample_enable_certificate_authority(): - # Create a client - client = privateca_v1beta1.CertificateAuthorityServiceAsyncClient() - - # Initialize request argument(s) - request = privateca_v1beta1.EnableCertificateAuthorityRequest( - name="name_value", - ) - - # Make the request - operation = client.enable_certificate_authority(request=request) - - print("Waiting for operation to complete...") - - response = (await operation).result() - - # Handle the response - print(response) - - Args: - request (Optional[Union[google.cloud.security.privateca_v1beta1.types.EnableCertificateAuthorityRequest, dict]]): - The request object. Request message for - [CertificateAuthorityService.EnableCertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthorityService.EnableCertificateAuthority]. - name (:class:`str`): - Required. The resource name for this - [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority] - in the format - ``projects/*/locations/*/certificateAuthorities/*``. - - 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. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.api_core.operation_async.AsyncOperation: - An object representing a long-running operation. - - The result type for the operation will be :class:`google.cloud.security.privateca_v1beta1.types.CertificateAuthority` A [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority] represents an individual Certificate Authority. - A - [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority] - can be used to create - [Certificates][google.cloud.security.privateca.v1beta1.Certificate]. - - """ - # Create or coerce a protobuf request object. - # Quick check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - has_flattened_params = any([name]) - if request is not None and has_flattened_params: - raise ValueError("If the `request` argument is set, then none of " - "the individual field arguments should be set.") - - 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 - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = gapic_v1.method_async.wrap_method( - self._client._transport.enable_certificate_authority, - default_timeout=None, - client_info=DEFAULT_CLIENT_INFO, - ) - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata(( - ("name", request.name), - )), - ) - - # Send the request. - response = await rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Wrap the response in an operation future. - response = operation_async.from_gapic( - response, - self._client._transport.operations_client, - resources.CertificateAuthority, - metadata_type=service.OperationMetadata, - ) - - # Done; return the response. - return response - - async def fetch_certificate_authority_csr(self, - request: Optional[Union[service.FetchCertificateAuthorityCsrRequest, dict]] = None, - *, - name: Optional[str] = None, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), - ) -> service.FetchCertificateAuthorityCsrResponse: - r"""Fetch a certificate signing request (CSR) from a - [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority] - that is in state - [PENDING_ACTIVATION][google.cloud.security.privateca.v1beta1.CertificateAuthority.State.PENDING_ACTIVATION] - and is of type - [SUBORDINATE][google.cloud.security.privateca.v1beta1.CertificateAuthority.Type.SUBORDINATE]. - The CSR must then be signed by the desired parent Certificate - Authority, which could be another - [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority] - resource, or could be an on-prem certificate authority. See also - [ActivateCertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthorityService.ActivateCertificateAuthority]. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud.security import privateca_v1beta1 - - async def sample_fetch_certificate_authority_csr(): - # Create a client - client = privateca_v1beta1.CertificateAuthorityServiceAsyncClient() - - # Initialize request argument(s) - request = privateca_v1beta1.FetchCertificateAuthorityCsrRequest( - name="name_value", - ) - - # Make the request - response = await client.fetch_certificate_authority_csr(request=request) - - # Handle the response - print(response) - - Args: - request (Optional[Union[google.cloud.security.privateca_v1beta1.types.FetchCertificateAuthorityCsrRequest, dict]]): - The request object. Request message for - [CertificateAuthorityService.FetchCertificateAuthorityCsr][google.cloud.security.privateca.v1beta1.CertificateAuthorityService.FetchCertificateAuthorityCsr]. - name (:class:`str`): - Required. The resource name for this - [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority] - in the format - ``projects/*/locations/*/certificateAuthorities/*``. - - 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. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.cloud.security.privateca_v1beta1.types.FetchCertificateAuthorityCsrResponse: - Response message for - [CertificateAuthorityService.FetchCertificateAuthorityCsr][google.cloud.security.privateca.v1beta1.CertificateAuthorityService.FetchCertificateAuthorityCsr]. - - """ - # Create or coerce a protobuf request object. - # Quick check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - has_flattened_params = any([name]) - if request is not None and has_flattened_params: - raise ValueError("If the `request` argument is set, then none of " - "the individual field arguments should be set.") - - 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 - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = gapic_v1.method_async.wrap_method( - self._client._transport.fetch_certificate_authority_csr, - default_timeout=None, - client_info=DEFAULT_CLIENT_INFO, - ) - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata(( - ("name", request.name), - )), - ) - - # Send the request. - response = await rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Done; return the response. - return response - - async def get_certificate_authority(self, - request: Optional[Union[service.GetCertificateAuthorityRequest, dict]] = None, - *, - name: Optional[str] = None, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), - ) -> resources.CertificateAuthority: - r"""Returns a - [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority]. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud.security import privateca_v1beta1 - - async def sample_get_certificate_authority(): - # Create a client - client = privateca_v1beta1.CertificateAuthorityServiceAsyncClient() - - # Initialize request argument(s) - request = privateca_v1beta1.GetCertificateAuthorityRequest( - name="name_value", - ) - - # Make the request - response = await client.get_certificate_authority(request=request) - - # Handle the response - print(response) - - Args: - request (Optional[Union[google.cloud.security.privateca_v1beta1.types.GetCertificateAuthorityRequest, dict]]): - The request object. Request message for - [CertificateAuthorityService.GetCertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthorityService.GetCertificateAuthority]. - name (:class:`str`): - Required. The - [name][google.cloud.security.privateca.v1beta1.CertificateAuthority.name] - of the - [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority] - to get. - - 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. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.cloud.security.privateca_v1beta1.types.CertificateAuthority: - A [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority] represents an individual Certificate Authority. - A - [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority] - can be used to create - [Certificates][google.cloud.security.privateca.v1beta1.Certificate]. - - """ - # Create or coerce a protobuf request object. - # Quick check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - has_flattened_params = any([name]) - if request is not None and has_flattened_params: - raise ValueError("If the `request` argument is set, then none of " - "the individual field arguments should be set.") - - 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 - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = gapic_v1.method_async.wrap_method( - self._client._transport.get_certificate_authority, - default_timeout=None, - client_info=DEFAULT_CLIENT_INFO, - ) - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata(( - ("name", request.name), - )), - ) - - # Send the request. - response = await rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Done; return the response. - return response - - async def list_certificate_authorities(self, - request: Optional[Union[service.ListCertificateAuthoritiesRequest, dict]] = None, - *, - parent: Optional[str] = None, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), - ) -> pagers.ListCertificateAuthoritiesAsyncPager: - r"""Lists - [CertificateAuthorities][google.cloud.security.privateca.v1beta1.CertificateAuthority]. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud.security import privateca_v1beta1 - - async def sample_list_certificate_authorities(): - # Create a client - client = privateca_v1beta1.CertificateAuthorityServiceAsyncClient() - - # Initialize request argument(s) - request = privateca_v1beta1.ListCertificateAuthoritiesRequest( - parent="parent_value", - ) - - # Make the request - page_result = client.list_certificate_authorities(request=request) - - # Handle the response - async for response in page_result: - print(response) - - Args: - request (Optional[Union[google.cloud.security.privateca_v1beta1.types.ListCertificateAuthoritiesRequest, dict]]): - The request object. Request message for - [CertificateAuthorityService.ListCertificateAuthorities][google.cloud.security.privateca.v1beta1.CertificateAuthorityService.ListCertificateAuthorities]. - parent (:class:`str`): - Required. The resource name of the location associated - with the - [CertificateAuthorities][google.cloud.security.privateca.v1beta1.CertificateAuthority], - in the format ``projects/*/locations/*``. - - 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. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.cloud.security.privateca_v1beta1.services.certificate_authority_service.pagers.ListCertificateAuthoritiesAsyncPager: - Response message for - [CertificateAuthorityService.ListCertificateAuthorities][google.cloud.security.privateca.v1beta1.CertificateAuthorityService.ListCertificateAuthorities]. - - Iterating over this object will yield results and - resolve additional pages automatically. - - """ - # Create or coerce a protobuf request object. - # Quick check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - has_flattened_params = any([parent]) - if request is not None and has_flattened_params: - raise ValueError("If the `request` argument is set, then none of " - "the individual field arguments should be set.") - - 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 - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = gapic_v1.method_async.wrap_method( - self._client._transport.list_certificate_authorities, - default_timeout=None, - client_info=DEFAULT_CLIENT_INFO, - ) - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata(( - ("parent", request.parent), - )), - ) - - # Send the request. - response = await rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # This method is paged; wrap the response in a pager, which provides - # an `__aiter__` convenience method. - response = pagers.ListCertificateAuthoritiesAsyncPager( - method=rpc, - request=request, - response=response, - metadata=metadata, - ) - - # Done; return the response. - return response - - async def restore_certificate_authority(self, - request: Optional[Union[service.RestoreCertificateAuthorityRequest, dict]] = None, - *, - name: Optional[str] = None, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), - ) -> operation_async.AsyncOperation: - r"""Restore a - [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority] - that is scheduled for deletion. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud.security import privateca_v1beta1 - - async def sample_restore_certificate_authority(): - # Create a client - client = privateca_v1beta1.CertificateAuthorityServiceAsyncClient() - - # Initialize request argument(s) - request = privateca_v1beta1.RestoreCertificateAuthorityRequest( - name="name_value", - ) - - # Make the request - operation = client.restore_certificate_authority(request=request) - - print("Waiting for operation to complete...") - - response = (await operation).result() - - # Handle the response - print(response) - - Args: - request (Optional[Union[google.cloud.security.privateca_v1beta1.types.RestoreCertificateAuthorityRequest, dict]]): - The request object. Request message for - [CertificateAuthorityService.RestoreCertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthorityService.RestoreCertificateAuthority]. - name (:class:`str`): - Required. The resource name for this - [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority] - in the format - ``projects/*/locations/*/certificateAuthorities/*``. - - 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. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.api_core.operation_async.AsyncOperation: - An object representing a long-running operation. - - The result type for the operation will be :class:`google.cloud.security.privateca_v1beta1.types.CertificateAuthority` A [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority] represents an individual Certificate Authority. - A - [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority] - can be used to create - [Certificates][google.cloud.security.privateca.v1beta1.Certificate]. - - """ - # Create or coerce a protobuf request object. - # Quick check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - has_flattened_params = any([name]) - if request is not None and has_flattened_params: - raise ValueError("If the `request` argument is set, then none of " - "the individual field arguments should be set.") - - 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 - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = gapic_v1.method_async.wrap_method( - self._client._transport.restore_certificate_authority, - default_timeout=None, - client_info=DEFAULT_CLIENT_INFO, - ) - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata(( - ("name", request.name), - )), - ) - - # Send the request. - response = await rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Wrap the response in an operation future. - response = operation_async.from_gapic( - response, - self._client._transport.operations_client, - resources.CertificateAuthority, - metadata_type=service.OperationMetadata, - ) - - # Done; return the response. - return response - - async def schedule_delete_certificate_authority(self, - request: Optional[Union[service.ScheduleDeleteCertificateAuthorityRequest, dict]] = None, - *, - name: Optional[str] = None, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), - ) -> operation_async.AsyncOperation: - r"""Schedule a - [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority] - for deletion. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud.security import privateca_v1beta1 - - async def sample_schedule_delete_certificate_authority(): - # Create a client - client = privateca_v1beta1.CertificateAuthorityServiceAsyncClient() - - # Initialize request argument(s) - request = privateca_v1beta1.ScheduleDeleteCertificateAuthorityRequest( - name="name_value", - ) - - # Make the request - operation = client.schedule_delete_certificate_authority(request=request) - - print("Waiting for operation to complete...") - - response = (await operation).result() - - # Handle the response - print(response) - - Args: - request (Optional[Union[google.cloud.security.privateca_v1beta1.types.ScheduleDeleteCertificateAuthorityRequest, dict]]): - The request object. Request message for - [CertificateAuthorityService.ScheduleDeleteCertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthorityService.ScheduleDeleteCertificateAuthority]. - name (:class:`str`): - Required. The resource name for this - [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority] - in the format - ``projects/*/locations/*/certificateAuthorities/*``. - - 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. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.api_core.operation_async.AsyncOperation: - An object representing a long-running operation. - - The result type for the operation will be :class:`google.cloud.security.privateca_v1beta1.types.CertificateAuthority` A [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority] represents an individual Certificate Authority. - A - [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority] - can be used to create - [Certificates][google.cloud.security.privateca.v1beta1.Certificate]. - - """ - # Create or coerce a protobuf request object. - # Quick check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - has_flattened_params = any([name]) - if request is not None and has_flattened_params: - raise ValueError("If the `request` argument is set, then none of " - "the individual field arguments should be set.") - - 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 - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = gapic_v1.method_async.wrap_method( - self._client._transport.schedule_delete_certificate_authority, - default_timeout=None, - client_info=DEFAULT_CLIENT_INFO, - ) - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata(( - ("name", request.name), - )), - ) - - # Send the request. - response = await rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Wrap the response in an operation future. - response = operation_async.from_gapic( - response, - self._client._transport.operations_client, - resources.CertificateAuthority, - metadata_type=service.OperationMetadata, - ) - - # Done; return the response. - return response - - async def update_certificate_authority(self, - request: Optional[Union[service.UpdateCertificateAuthorityRequest, dict]] = None, - *, - certificate_authority: Optional[resources.CertificateAuthority] = None, - update_mask: Optional[field_mask_pb2.FieldMask] = None, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), - ) -> operation_async.AsyncOperation: - r"""Update a - [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority]. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud.security import privateca_v1beta1 - - async def sample_update_certificate_authority(): - # Create a client - client = privateca_v1beta1.CertificateAuthorityServiceAsyncClient() - - # Initialize request argument(s) - certificate_authority = privateca_v1beta1.CertificateAuthority() - certificate_authority.type_ = "SUBORDINATE" - certificate_authority.tier = "DEVOPS" - certificate_authority.config.reusable_config.reusable_config = "reusable_config_value" - certificate_authority.key_spec.cloud_kms_key_version = "cloud_kms_key_version_value" - - request = privateca_v1beta1.UpdateCertificateAuthorityRequest( - certificate_authority=certificate_authority, - ) - - # Make the request - operation = client.update_certificate_authority(request=request) - - print("Waiting for operation to complete...") - - response = (await operation).result() - - # Handle the response - print(response) - - Args: - request (Optional[Union[google.cloud.security.privateca_v1beta1.types.UpdateCertificateAuthorityRequest, dict]]): - The request object. Request message for - [CertificateAuthorityService.UpdateCertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthorityService.UpdateCertificateAuthority]. - certificate_authority (:class:`google.cloud.security.privateca_v1beta1.types.CertificateAuthority`): - Required. - [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority] - with updated values. - - This corresponds to the ``certificate_authority`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - update_mask (:class:`google.protobuf.field_mask_pb2.FieldMask`): - Required. A list of fields to be - updated in this request. - - 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. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.api_core.operation_async.AsyncOperation: - An object representing a long-running operation. - - The result type for the operation will be :class:`google.cloud.security.privateca_v1beta1.types.CertificateAuthority` A [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority] represents an individual Certificate Authority. - A - [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority] - can be used to create - [Certificates][google.cloud.security.privateca.v1beta1.Certificate]. - - """ - # Create or coerce a protobuf request object. - # Quick check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - has_flattened_params = any([certificate_authority, update_mask]) - if request is not None and has_flattened_params: - raise ValueError("If the `request` argument is set, then none of " - "the individual field arguments should be set.") - - 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: - request.update_mask = update_mask - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = gapic_v1.method_async.wrap_method( - self._client._transport.update_certificate_authority, - default_timeout=None, - client_info=DEFAULT_CLIENT_INFO, - ) - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata(( - ("certificate_authority.name", request.certificate_authority.name), - )), - ) - - # Send the request. - response = await rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Wrap the response in an operation future. - response = operation_async.from_gapic( - response, - self._client._transport.operations_client, - resources.CertificateAuthority, - metadata_type=service.OperationMetadata, - ) - - # Done; return the response. - return response - - async def get_certificate_revocation_list(self, - request: Optional[Union[service.GetCertificateRevocationListRequest, dict]] = None, - *, - name: Optional[str] = None, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), - ) -> resources.CertificateRevocationList: - r"""Returns a - [CertificateRevocationList][google.cloud.security.privateca.v1beta1.CertificateRevocationList]. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud.security import privateca_v1beta1 - - async def sample_get_certificate_revocation_list(): - # Create a client - client = privateca_v1beta1.CertificateAuthorityServiceAsyncClient() - - # Initialize request argument(s) - request = privateca_v1beta1.GetCertificateRevocationListRequest( - name="name_value", - ) - - # Make the request - response = await client.get_certificate_revocation_list(request=request) - - # Handle the response - print(response) - - Args: - request (Optional[Union[google.cloud.security.privateca_v1beta1.types.GetCertificateRevocationListRequest, dict]]): - The request object. Request message for - [CertificateAuthorityService.GetCertificateRevocationList][google.cloud.security.privateca.v1beta1.CertificateAuthorityService.GetCertificateRevocationList]. - name (:class:`str`): - Required. The - [name][google.cloud.security.privateca.v1beta1.CertificateRevocationList.name] - of the - [CertificateRevocationList][google.cloud.security.privateca.v1beta1.CertificateRevocationList] - to get. - - 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. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.cloud.security.privateca_v1beta1.types.CertificateRevocationList: - A [CertificateRevocationList][google.cloud.security.privateca.v1beta1.CertificateRevocationList] corresponds to a signed X.509 certificate - Revocation List (CRL). A CRL contains the serial - numbers of certificates that should no longer be - trusted. - - """ - # Create or coerce a protobuf request object. - # Quick check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - has_flattened_params = any([name]) - if request is not None and has_flattened_params: - raise ValueError("If the `request` argument is set, then none of " - "the individual field arguments should be set.") - - 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 - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = gapic_v1.method_async.wrap_method( - self._client._transport.get_certificate_revocation_list, - default_timeout=None, - client_info=DEFAULT_CLIENT_INFO, - ) - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata(( - ("name", request.name), - )), - ) - - # Send the request. - response = await rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Done; return the response. - return response - - async def list_certificate_revocation_lists(self, - request: Optional[Union[service.ListCertificateRevocationListsRequest, dict]] = None, - *, - parent: Optional[str] = None, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), - ) -> pagers.ListCertificateRevocationListsAsyncPager: - r"""Lists - [CertificateRevocationLists][google.cloud.security.privateca.v1beta1.CertificateRevocationList]. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud.security import privateca_v1beta1 - - async def sample_list_certificate_revocation_lists(): - # Create a client - client = privateca_v1beta1.CertificateAuthorityServiceAsyncClient() - - # Initialize request argument(s) - request = privateca_v1beta1.ListCertificateRevocationListsRequest( - parent="parent_value", - ) - - # Make the request - page_result = client.list_certificate_revocation_lists(request=request) - - # Handle the response - async for response in page_result: - print(response) - - Args: - request (Optional[Union[google.cloud.security.privateca_v1beta1.types.ListCertificateRevocationListsRequest, dict]]): - The request object. Request message for - [CertificateAuthorityService.ListCertificateRevocationLists][google.cloud.security.privateca.v1beta1.CertificateAuthorityService.ListCertificateRevocationLists]. - parent (:class:`str`): - Required. The resource name of the location associated - with the - [CertificateRevocationLists][google.cloud.security.privateca.v1beta1.CertificateRevocationList], - in the format - ``projects/*/locations/*/certificateauthorities/*``. - - 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. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.cloud.security.privateca_v1beta1.services.certificate_authority_service.pagers.ListCertificateRevocationListsAsyncPager: - Response message for - [CertificateAuthorityService.ListCertificateRevocationLists][google.cloud.security.privateca.v1beta1.CertificateAuthorityService.ListCertificateRevocationLists]. - - Iterating over this object will yield results and - resolve additional pages automatically. - - """ - # Create or coerce a protobuf request object. - # Quick check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - has_flattened_params = any([parent]) - if request is not None and has_flattened_params: - raise ValueError("If the `request` argument is set, then none of " - "the individual field arguments should be set.") - - 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 - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = gapic_v1.method_async.wrap_method( - self._client._transport.list_certificate_revocation_lists, - default_timeout=None, - client_info=DEFAULT_CLIENT_INFO, - ) - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata(( - ("parent", request.parent), - )), - ) - - # Send the request. - response = await rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # This method is paged; wrap the response in a pager, which provides - # an `__aiter__` convenience method. - response = pagers.ListCertificateRevocationListsAsyncPager( - method=rpc, - request=request, - response=response, - metadata=metadata, - ) - - # Done; return the response. - return response - - async def update_certificate_revocation_list(self, - request: Optional[Union[service.UpdateCertificateRevocationListRequest, dict]] = None, - *, - certificate_revocation_list: Optional[resources.CertificateRevocationList] = None, - update_mask: Optional[field_mask_pb2.FieldMask] = None, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), - ) -> operation_async.AsyncOperation: - r"""Update a - [CertificateRevocationList][google.cloud.security.privateca.v1beta1.CertificateRevocationList]. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud.security import privateca_v1beta1 - - async def sample_update_certificate_revocation_list(): - # Create a client - client = privateca_v1beta1.CertificateAuthorityServiceAsyncClient() - - # Initialize request argument(s) - request = privateca_v1beta1.UpdateCertificateRevocationListRequest( - ) - - # Make the request - operation = client.update_certificate_revocation_list(request=request) - - print("Waiting for operation to complete...") - - response = (await operation).result() - - # Handle the response - print(response) - - Args: - request (Optional[Union[google.cloud.security.privateca_v1beta1.types.UpdateCertificateRevocationListRequest, dict]]): - The request object. Request message for - [CertificateAuthorityService.UpdateCertificateRevocationList][google.cloud.security.privateca.v1beta1.CertificateAuthorityService.UpdateCertificateRevocationList]. - certificate_revocation_list (:class:`google.cloud.security.privateca_v1beta1.types.CertificateRevocationList`): - Required. - [CertificateRevocationList][google.cloud.security.privateca.v1beta1.CertificateRevocationList] - with updated values. - - This corresponds to the ``certificate_revocation_list`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - update_mask (:class:`google.protobuf.field_mask_pb2.FieldMask`): - Required. A list of fields to be - updated in this request. - - 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. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.api_core.operation_async.AsyncOperation: - An object representing a long-running operation. - - The result type for the operation will be :class:`google.cloud.security.privateca_v1beta1.types.CertificateRevocationList` A [CertificateRevocationList][google.cloud.security.privateca.v1beta1.CertificateRevocationList] corresponds to a signed X.509 certificate - Revocation List (CRL). A CRL contains the serial - numbers of certificates that should no longer be - trusted. - - """ - # Create or coerce a protobuf request object. - # Quick check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - has_flattened_params = any([certificate_revocation_list, update_mask]) - if request is not None and has_flattened_params: - raise ValueError("If the `request` argument is set, then none of " - "the individual field arguments should be set.") - - 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: - request.update_mask = update_mask - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = gapic_v1.method_async.wrap_method( - self._client._transport.update_certificate_revocation_list, - default_timeout=None, - client_info=DEFAULT_CLIENT_INFO, - ) - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata(( - ("certificate_revocation_list.name", request.certificate_revocation_list.name), - )), - ) - - # Send the request. - response = await rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Wrap the response in an operation future. - response = operation_async.from_gapic( - response, - self._client._transport.operations_client, - resources.CertificateRevocationList, - metadata_type=service.OperationMetadata, - ) - - # Done; return the response. - return response - - async def get_reusable_config(self, - request: Optional[Union[service.GetReusableConfigRequest, dict]] = None, - *, - name: Optional[str] = None, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), - ) -> resources.ReusableConfig: - r"""Returns a - [ReusableConfig][google.cloud.security.privateca.v1beta1.ReusableConfig]. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud.security import privateca_v1beta1 - - async def sample_get_reusable_config(): - # Create a client - client = privateca_v1beta1.CertificateAuthorityServiceAsyncClient() - - # Initialize request argument(s) - request = privateca_v1beta1.GetReusableConfigRequest( - name="name_value", - ) - - # Make the request - response = await client.get_reusable_config(request=request) - - # Handle the response - print(response) - - Args: - request (Optional[Union[google.cloud.security.privateca_v1beta1.types.GetReusableConfigRequest, dict]]): - The request object. Request message for - [CertificateAuthorityService.GetReusableConfig][google.cloud.security.privateca.v1beta1.CertificateAuthorityService.GetReusableConfig]. - name (:class:`str`): - Required. The [name][ReusableConfigs.name] of the - [ReusableConfigs][] to get. - - 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. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.cloud.security.privateca_v1beta1.types.ReusableConfig: - A [ReusableConfig][google.cloud.security.privateca.v1beta1.ReusableConfig] refers to a managed [ReusableConfigValues][google.cloud.security.privateca.v1beta1.ReusableConfigValues]. Those, in - turn, are used to describe certain fields of an X.509 - certificate, such as the key usage fields, fields - specific to CA certificates, certificate policy - extensions and custom extensions. - - """ - # Create or coerce a protobuf request object. - # Quick check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - has_flattened_params = any([name]) - if request is not None and has_flattened_params: - raise ValueError("If the `request` argument is set, then none of " - "the individual field arguments should be set.") - - 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 - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = gapic_v1.method_async.wrap_method( - self._client._transport.get_reusable_config, - default_timeout=None, - client_info=DEFAULT_CLIENT_INFO, - ) - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata(( - ("name", request.name), - )), - ) - - # Send the request. - response = await rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Done; return the response. - return response - - async def list_reusable_configs(self, - request: Optional[Union[service.ListReusableConfigsRequest, dict]] = None, - *, - parent: Optional[str] = None, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), - ) -> pagers.ListReusableConfigsAsyncPager: - r"""Lists - [ReusableConfigs][google.cloud.security.privateca.v1beta1.ReusableConfig]. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud.security import privateca_v1beta1 - - async def sample_list_reusable_configs(): - # Create a client - client = privateca_v1beta1.CertificateAuthorityServiceAsyncClient() - - # Initialize request argument(s) - request = privateca_v1beta1.ListReusableConfigsRequest( - parent="parent_value", - ) - - # Make the request - page_result = client.list_reusable_configs(request=request) - - # Handle the response - async for response in page_result: - print(response) - - Args: - request (Optional[Union[google.cloud.security.privateca_v1beta1.types.ListReusableConfigsRequest, dict]]): - The request object. Request message for - [CertificateAuthorityService.ListReusableConfigs][google.cloud.security.privateca.v1beta1.CertificateAuthorityService.ListReusableConfigs]. - parent (:class:`str`): - Required. The resource name of the location associated - with the - [ReusableConfigs][google.cloud.security.privateca.v1beta1.ReusableConfig], - in the format ``projects/*/locations/*``. - - 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. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.cloud.security.privateca_v1beta1.services.certificate_authority_service.pagers.ListReusableConfigsAsyncPager: - Response message for - [CertificateAuthorityService.ListReusableConfigs][google.cloud.security.privateca.v1beta1.CertificateAuthorityService.ListReusableConfigs]. - - Iterating over this object will yield results and - resolve additional pages automatically. - - """ - # Create or coerce a protobuf request object. - # Quick check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - has_flattened_params = any([parent]) - if request is not None and has_flattened_params: - raise ValueError("If the `request` argument is set, then none of " - "the individual field arguments should be set.") - - 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 - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = gapic_v1.method_async.wrap_method( - self._client._transport.list_reusable_configs, - default_timeout=None, - client_info=DEFAULT_CLIENT_INFO, - ) - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata(( - ("parent", request.parent), - )), - ) - - # Send the request. - response = await rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # This method is paged; wrap the response in a pager, which provides - # an `__aiter__` convenience method. - response = pagers.ListReusableConfigsAsyncPager( - method=rpc, - request=request, - response=response, - metadata=metadata, - ) - - # Done; return the response. - return response - - async def __aenter__(self): - return self - - async def __aexit__(self, exc_type, exc, tb): - await self.transport.close() - -DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo(gapic_version=package_version.__version__) - - -__all__ = ( - "CertificateAuthorityServiceAsyncClient", -) diff --git a/owl-bot-staging/v1beta1/google/cloud/security/privateca_v1beta1/services/certificate_authority_service/client.py b/owl-bot-staging/v1beta1/google/cloud/security/privateca_v1beta1/services/certificate_authority_service/client.py deleted file mode 100644 index 71a1f2b..0000000 --- a/owl-bot-staging/v1beta1/google/cloud/security/privateca_v1beta1/services/certificate_authority_service/client.py +++ /dev/null @@ -1,2847 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -from collections import OrderedDict -import os -import re -from typing import Dict, Mapping, MutableMapping, MutableSequence, Optional, Sequence, Tuple, Type, Union, cast - -from google.cloud.security.privateca_v1beta1 import gapic_version as package_version - -from google.api_core import client_options as client_options_lib -from google.api_core import exceptions as core_exceptions -from google.api_core import gapic_v1 -from google.api_core import retry as retries -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 -from google.oauth2 import service_account # type: ignore - -try: - OptionalRetry = Union[retries.Retry, gapic_v1.method._MethodDefault] -except AttributeError: # pragma: NO COVER - OptionalRetry = Union[retries.Retry, object] # type: ignore - -from google.api_core import operation # type: ignore -from google.api_core import operation_async # type: ignore -from google.cloud.security.privateca_v1beta1.services.certificate_authority_service import pagers -from google.cloud.security.privateca_v1beta1.types import resources -from google.cloud.security.privateca_v1beta1.types import service -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 - - -class CertificateAuthorityServiceClientMeta(type): - """Metaclass for the CertificateAuthorityService client. - - This provides class-level methods for building and retrieving - support objects (e.g. transport) without polluting the client instance - objects. - """ - _transport_registry = OrderedDict() # type: Dict[str, Type[CertificateAuthorityServiceTransport]] - _transport_registry["grpc"] = CertificateAuthorityServiceGrpcTransport - _transport_registry["grpc_asyncio"] = CertificateAuthorityServiceGrpcAsyncIOTransport - - def get_transport_class(cls, - label: Optional[str] = None, - ) -> Type[CertificateAuthorityServiceTransport]: - """Returns an appropriate transport class. - - Args: - label: The name of the desired transport. If none is - provided, then the first transport in the registry is used. - - Returns: - The transport class to use. - """ - # If a specific transport is requested, return that one. - if label: - return cls._transport_registry[label] - - # No transport is requested; return the default (that is, the first one - # in the dictionary). - return next(iter(cls._transport_registry.values())) - - -class CertificateAuthorityServiceClient(metaclass=CertificateAuthorityServiceClientMeta): - """[Certificate Authority - Service][google.cloud.security.privateca.v1beta1.CertificateAuthorityService] - manages private certificate authorities and issued certificates. - """ - - @staticmethod - def _get_default_mtls_endpoint(api_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: - api_endpoint (Optional[str]): the api endpoint to convert. - Returns: - str: converted mTLS api endpoint. - """ - if not api_endpoint: - return api_endpoint - - mtls_endpoint_re = re.compile( - r"(?P[^.]+)(?P\.mtls)?(?P\.sandbox)?(?P\.googleapis\.com)?" - ) - - m = mtls_endpoint_re.match(api_endpoint) - name, mtls, sandbox, googledomain = m.groups() - if mtls or not googledomain: - return api_endpoint - - if sandbox: - return api_endpoint.replace( - "sandbox.googleapis.com", "mtls.sandbox.googleapis.com" - ) - - return api_endpoint.replace(".googleapis.com", ".mtls.googleapis.com") - - DEFAULT_ENDPOINT = "privateca.googleapis.com" - DEFAULT_MTLS_ENDPOINT = _get_default_mtls_endpoint.__func__( # type: ignore - DEFAULT_ENDPOINT - ) - - @classmethod - def from_service_account_info(cls, info: dict, *args, **kwargs): - """Creates an instance of this client using the provided credentials - info. - - Args: - info (dict): The service account private key info. - args: Additional arguments to pass to the constructor. - kwargs: Additional arguments to pass to the constructor. - - Returns: - CertificateAuthorityServiceClient: The constructed client. - """ - credentials = service_account.Credentials.from_service_account_info(info) - kwargs["credentials"] = credentials - return cls(*args, **kwargs) - - @classmethod - def from_service_account_file(cls, filename: str, *args, **kwargs): - """Creates an instance of this client using the provided credentials - file. - - Args: - filename (str): The path to the service account private key json - file. - args: Additional arguments to pass to the constructor. - kwargs: Additional arguments to pass to the constructor. - - Returns: - CertificateAuthorityServiceClient: The constructed client. - """ - credentials = service_account.Credentials.from_service_account_file( - filename) - kwargs["credentials"] = credentials - return cls(*args, **kwargs) - - from_service_account_json = from_service_account_file - - @property - def transport(self) -> CertificateAuthorityServiceTransport: - """Returns the transport used by the client instance. - - Returns: - CertificateAuthorityServiceTransport: The transport used by the client - instance. - """ - return self._transport - - @staticmethod - def certificate_path(project: str,location: str,certificate_authority: str,certificate: str,) -> str: - """Returns a fully-qualified certificate string.""" - return "projects/{project}/locations/{location}/certificateAuthorities/{certificate_authority}/certificates/{certificate}".format(project=project, location=location, certificate_authority=certificate_authority, certificate=certificate, ) - - @staticmethod - def parse_certificate_path(path: str) -> Dict[str,str]: - """Parses a certificate path into its component segments.""" - m = re.match(r"^projects/(?P.+?)/locations/(?P.+?)/certificateAuthorities/(?P.+?)/certificates/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def certificate_authority_path(project: str,location: str,certificate_authority: str,) -> str: - """Returns a fully-qualified certificate_authority string.""" - return "projects/{project}/locations/{location}/certificateAuthorities/{certificate_authority}".format(project=project, location=location, certificate_authority=certificate_authority, ) - - @staticmethod - def parse_certificate_authority_path(path: str) -> Dict[str,str]: - """Parses a certificate_authority path into its component segments.""" - m = re.match(r"^projects/(?P.+?)/locations/(?P.+?)/certificateAuthorities/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def certificate_revocation_list_path(project: str,location: str,certificate_authority: str,certificate_revocation_list: str,) -> str: - """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, certificate_authority=certificate_authority, certificate_revocation_list=certificate_revocation_list, ) - - @staticmethod - def parse_certificate_revocation_list_path(path: str) -> Dict[str,str]: - """Parses a certificate_revocation_list path into its component segments.""" - m = re.match(r"^projects/(?P.+?)/locations/(?P.+?)/certificateAuthorities/(?P.+?)/certificateRevocationLists/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def reusable_config_path(project: str,location: str,reusable_config: str,) -> str: - """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]: - """Parses a reusable_config path into its component segments.""" - m = re.match(r"^projects/(?P.+?)/locations/(?P.+?)/reusableConfigs/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_billing_account_path(billing_account: str, ) -> str: - """Returns a fully-qualified billing_account string.""" - return "billingAccounts/{billing_account}".format(billing_account=billing_account, ) - - @staticmethod - def parse_common_billing_account_path(path: str) -> Dict[str,str]: - """Parse a billing_account path into its component segments.""" - m = re.match(r"^billingAccounts/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_folder_path(folder: str, ) -> str: - """Returns a fully-qualified folder string.""" - return "folders/{folder}".format(folder=folder, ) - - @staticmethod - def parse_common_folder_path(path: str) -> Dict[str,str]: - """Parse a folder path into its component segments.""" - m = re.match(r"^folders/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_organization_path(organization: str, ) -> str: - """Returns a fully-qualified organization string.""" - return "organizations/{organization}".format(organization=organization, ) - - @staticmethod - def parse_common_organization_path(path: str) -> Dict[str,str]: - """Parse a organization path into its component segments.""" - m = re.match(r"^organizations/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_project_path(project: str, ) -> str: - """Returns a fully-qualified project string.""" - return "projects/{project}".format(project=project, ) - - @staticmethod - def parse_common_project_path(path: str) -> Dict[str,str]: - """Parse a project path into its component segments.""" - m = re.match(r"^projects/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_location_path(project: str, location: str, ) -> str: - """Returns a fully-qualified location string.""" - return "projects/{project}/locations/{location}".format(project=project, location=location, ) - - @staticmethod - def parse_common_location_path(path: str) -> Dict[str,str]: - """Parse a location path into its component segments.""" - m = re.match(r"^projects/(?P.+?)/locations/(?P.+?)$", path) - return m.groupdict() if m else {} - - @classmethod - def get_mtls_endpoint_and_cert_source(cls, client_options: Optional[client_options_lib.ClientOptions] = None): - """Return the API endpoint and client cert source for mutual TLS. - - The client cert source is determined in the following order: - (1) if `GOOGLE_API_USE_CLIENT_CERTIFICATE` environment variable is not "true", the - client cert source is None. - (2) if `client_options.client_cert_source` is provided, use the provided one; if the - default client cert source exists, use the default one; otherwise the client cert - source is None. - - The API endpoint is determined in the following order: - (1) if `client_options.api_endpoint` if provided, use the provided one. - (2) if `GOOGLE_API_USE_CLIENT_CERTIFICATE` environment variable is "always", use the - default mTLS endpoint; if the environment variable is "never", use the default API - endpoint; otherwise if client cert source exists, use the default mTLS endpoint, otherwise - use the default API endpoint. - - More details can be found at https://google.aip.dev/auth/4114. - - Args: - client_options (google.api_core.client_options.ClientOptions): Custom options for the - client. Only the `api_endpoint` and `client_cert_source` properties may be used - in this method. - - Returns: - Tuple[str, Callable[[], Tuple[bytes, bytes]]]: returns the API endpoint and the - client cert source to use. - - Raises: - google.auth.exceptions.MutualTLSChannelError: If any errors happen. - """ - if client_options is None: - client_options = client_options_lib.ClientOptions() - use_client_cert = os.getenv("GOOGLE_API_USE_CLIENT_CERTIFICATE", "false") - use_mtls_endpoint = os.getenv("GOOGLE_API_USE_MTLS_ENDPOINT", "auto") - if use_client_cert not in ("true", "false"): - raise ValueError("Environment variable `GOOGLE_API_USE_CLIENT_CERTIFICATE` must be either `true` or `false`") - if use_mtls_endpoint not in ("auto", "never", "always"): - raise MutualTLSChannelError("Environment variable `GOOGLE_API_USE_MTLS_ENDPOINT` must be `never`, `auto` or `always`") - - # Figure out the client cert source to use. - client_cert_source = None - if use_client_cert == "true": - if client_options.client_cert_source: - client_cert_source = client_options.client_cert_source - elif mtls.has_default_client_cert_source(): - client_cert_source = mtls.default_client_cert_source() - - # Figure out which api endpoint to use. - if client_options.api_endpoint is not None: - api_endpoint = client_options.api_endpoint - elif use_mtls_endpoint == "always" or (use_mtls_endpoint == "auto" and client_cert_source): - api_endpoint = cls.DEFAULT_MTLS_ENDPOINT - else: - api_endpoint = cls.DEFAULT_ENDPOINT - - return api_endpoint, client_cert_source - - def __init__(self, *, - credentials: Optional[ga_credentials.Credentials] = None, - transport: Optional[Union[str, CertificateAuthorityServiceTransport]] = None, - client_options: Optional[Union[client_options_lib.ClientOptions, dict]] = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - ) -> None: - """Instantiates the certificate authority service client. - - Args: - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - transport (Union[str, CertificateAuthorityServiceTransport]): The - transport to use. If set to None, a transport is chosen - automatically. - client_options (Optional[Union[google.api_core.client_options.ClientOptions, dict]]): Custom options for the - client. It won't take effect if a ``transport`` instance is provided. - (1) The ``api_endpoint`` property can be used to override the - default endpoint provided by the client. GOOGLE_API_USE_MTLS_ENDPOINT - environment variable can also be used to override the endpoint: - "always" (always use the default mTLS endpoint), "never" (always - use the default regular endpoint) and "auto" (auto switch to the - default mTLS endpoint if client certificate is present, this is - the default value). However, the ``api_endpoint`` property takes - precedence if provided. - (2) If GOOGLE_API_USE_CLIENT_CERTIFICATE environment variable - is "true", then the ``client_cert_source`` property can be used - to provide client certificate for mutual TLS transport. If - not provided, the default SSL client certificate will be used if - present. If GOOGLE_API_USE_CLIENT_CERTIFICATE is "false" or not - set, no client certificate will be used. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - - Raises: - google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport - creation failed for any reason. - """ - if isinstance(client_options, dict): - client_options = client_options_lib.from_dict(client_options) - if client_options is None: - client_options = client_options_lib.ClientOptions() - client_options = cast(client_options_lib.ClientOptions, client_options) - - api_endpoint, client_cert_source_func = self.get_mtls_endpoint_and_cert_source(client_options) - - api_key_value = getattr(client_options, "api_key", None) - if api_key_value and credentials: - raise ValueError("client_options.api_key and credentials are mutually exclusive") - - # Save or instantiate the transport. - # Ordinarily, we provide the transport, but allowing a custom transport - # instance provides an extensibility point for unusual situations. - if isinstance(transport, CertificateAuthorityServiceTransport): - # transport is a CertificateAuthorityServiceTransport instance. - if credentials or client_options.credentials_file or api_key_value: - raise ValueError("When providing a transport instance, " - "provide its credentials directly.") - if client_options.scopes: - raise ValueError( - "When providing a transport instance, provide its scopes " - "directly." - ) - self._transport = transport - else: - import google.auth._default # type: ignore - - if api_key_value and hasattr(google.auth._default, "get_api_key_credentials"): - credentials = google.auth._default.get_api_key_credentials(api_key_value) - - Transport = type(self).get_transport_class(transport) - self._transport = Transport( - credentials=credentials, - credentials_file=client_options.credentials_file, - host=api_endpoint, - scopes=client_options.scopes, - client_cert_source_for_mtls=client_cert_source_func, - quota_project_id=client_options.quota_project_id, - client_info=client_info, - always_use_jwt_access=True, - api_audience=client_options.api_audience, - ) - - def create_certificate(self, - request: Optional[Union[service.CreateCertificateRequest, dict]] = None, - *, - parent: Optional[str] = None, - certificate: Optional[resources.Certificate] = None, - certificate_id: Optional[str] = None, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), - ) -> resources.Certificate: - r"""Create a new - [Certificate][google.cloud.security.privateca.v1beta1.Certificate] - in a given Project, Location from a particular - [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority]. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud.security import privateca_v1beta1 - - def sample_create_certificate(): - # Create a client - client = privateca_v1beta1.CertificateAuthorityServiceClient() - - # Initialize request argument(s) - certificate = privateca_v1beta1.Certificate() - certificate.pem_csr = "pem_csr_value" - - request = privateca_v1beta1.CreateCertificateRequest( - parent="parent_value", - certificate=certificate, - ) - - # Make the request - response = client.create_certificate(request=request) - - # Handle the response - print(response) - - Args: - request (Union[google.cloud.security.privateca_v1beta1.types.CreateCertificateRequest, dict]): - The request object. Request message for - [CertificateAuthorityService.CreateCertificate][google.cloud.security.privateca.v1beta1.CertificateAuthorityService.CreateCertificate]. - parent (str): - Required. The resource name of the location and - [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority] - associated with the - [Certificate][google.cloud.security.privateca.v1beta1.Certificate], - in the format - ``projects/*/locations/*/certificateAuthorities/*``. - - This corresponds to the ``parent`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - certificate (google.cloud.security.privateca_v1beta1.types.Certificate): - Required. A - [Certificate][google.cloud.security.privateca.v1beta1.Certificate] - with initial field values. - - This corresponds to the ``certificate`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - certificate_id (str): - Optional. It must be unique within a location and match - the regular expression ``[a-zA-Z0-9_-]{1,63}``. This - field is required when using a - [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority] - in the Enterprise - [CertificateAuthority.Tier][google.cloud.security.privateca.v1beta1.CertificateAuthority.Tier], - but is optional and its value is ignored otherwise. - - 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. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.cloud.security.privateca_v1beta1.types.Certificate: - A [Certificate][google.cloud.security.privateca.v1beta1.Certificate] corresponds to a signed X.509 certificate issued by a - [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority]. - - """ - # Create or coerce a protobuf request object. - # Quick check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - has_flattened_params = any([parent, certificate, certificate_id]) - if request is not None and has_flattened_params: - raise ValueError('If the `request` argument is set, then none of ' - 'the individual field arguments should be set.') - - # Minor optimization to avoid making a copy if the user passes - # in a service.CreateCertificateRequest. - # There's no risk of modifying the input as we've already verified - # 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: - request.certificate = certificate - if certificate_id is not None: - request.certificate_id = certificate_id - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[self._transport.create_certificate] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata(( - ("parent", request.parent), - )), - ) - - # Send the request. - response = rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Done; return the response. - return response - - def get_certificate(self, - request: Optional[Union[service.GetCertificateRequest, dict]] = None, - *, - name: Optional[str] = None, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), - ) -> resources.Certificate: - r"""Returns a - [Certificate][google.cloud.security.privateca.v1beta1.Certificate]. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud.security import privateca_v1beta1 - - def sample_get_certificate(): - # Create a client - client = privateca_v1beta1.CertificateAuthorityServiceClient() - - # Initialize request argument(s) - request = privateca_v1beta1.GetCertificateRequest( - name="name_value", - ) - - # Make the request - response = client.get_certificate(request=request) - - # Handle the response - print(response) - - Args: - request (Union[google.cloud.security.privateca_v1beta1.types.GetCertificateRequest, dict]): - The request object. Request message for - [CertificateAuthorityService.GetCertificate][google.cloud.security.privateca.v1beta1.CertificateAuthorityService.GetCertificate]. - name (str): - Required. The - [name][google.cloud.security.privateca.v1beta1.Certificate.name] - of the - [Certificate][google.cloud.security.privateca.v1beta1.Certificate] - to get. - - 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. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.cloud.security.privateca_v1beta1.types.Certificate: - A [Certificate][google.cloud.security.privateca.v1beta1.Certificate] corresponds to a signed X.509 certificate issued by a - [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority]. - - """ - # Create or coerce a protobuf request object. - # Quick check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - has_flattened_params = any([name]) - if request is not None and has_flattened_params: - raise ValueError('If the `request` argument is set, then none of ' - 'the individual field arguments should be set.') - - # Minor optimization to avoid making a copy if the user passes - # in a service.GetCertificateRequest. - # There's no risk of modifying the input as we've already verified - # 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 - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[self._transport.get_certificate] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata(( - ("name", request.name), - )), - ) - - # Send the request. - response = rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Done; return the response. - return response - - def list_certificates(self, - request: Optional[Union[service.ListCertificatesRequest, dict]] = None, - *, - parent: Optional[str] = None, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), - ) -> pagers.ListCertificatesPager: - r"""Lists - [Certificates][google.cloud.security.privateca.v1beta1.Certificate]. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud.security import privateca_v1beta1 - - def sample_list_certificates(): - # Create a client - client = privateca_v1beta1.CertificateAuthorityServiceClient() - - # Initialize request argument(s) - request = privateca_v1beta1.ListCertificatesRequest( - parent="parent_value", - ) - - # Make the request - page_result = client.list_certificates(request=request) - - # Handle the response - for response in page_result: - print(response) - - Args: - request (Union[google.cloud.security.privateca_v1beta1.types.ListCertificatesRequest, dict]): - The request object. Request message for - [CertificateAuthorityService.ListCertificates][google.cloud.security.privateca.v1beta1.CertificateAuthorityService.ListCertificates]. - parent (str): - Required. The resource name of the location associated - with the - [Certificates][google.cloud.security.privateca.v1beta1.Certificate], - in the format - ``projects/*/locations/*/certificateauthorities/*``. - - 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. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.cloud.security.privateca_v1beta1.services.certificate_authority_service.pagers.ListCertificatesPager: - Response message for - [CertificateAuthorityService.ListCertificates][google.cloud.security.privateca.v1beta1.CertificateAuthorityService.ListCertificates]. - - Iterating over this object will yield results and - resolve additional pages automatically. - - """ - # Create or coerce a protobuf request object. - # Quick check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - has_flattened_params = any([parent]) - if request is not None and has_flattened_params: - raise ValueError('If the `request` argument is set, then none of ' - 'the individual field arguments should be set.') - - # Minor optimization to avoid making a copy if the user passes - # in a service.ListCertificatesRequest. - # There's no risk of modifying the input as we've already verified - # 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 - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[self._transport.list_certificates] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata(( - ("parent", request.parent), - )), - ) - - # Send the request. - response = rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # This method is paged; wrap the response in a pager, which provides - # an `__iter__` convenience method. - response = pagers.ListCertificatesPager( - method=rpc, - request=request, - response=response, - metadata=metadata, - ) - - # Done; return the response. - return response - - def revoke_certificate(self, - request: Optional[Union[service.RevokeCertificateRequest, dict]] = None, - *, - name: Optional[str] = None, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), - ) -> resources.Certificate: - r"""Revoke a - [Certificate][google.cloud.security.privateca.v1beta1.Certificate]. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud.security import privateca_v1beta1 - - def sample_revoke_certificate(): - # Create a client - client = privateca_v1beta1.CertificateAuthorityServiceClient() - - # Initialize request argument(s) - request = privateca_v1beta1.RevokeCertificateRequest( - name="name_value", - reason="ATTRIBUTE_AUTHORITY_COMPROMISE", - ) - - # Make the request - response = client.revoke_certificate(request=request) - - # Handle the response - print(response) - - Args: - request (Union[google.cloud.security.privateca_v1beta1.types.RevokeCertificateRequest, dict]): - The request object. Request message for - [CertificateAuthorityService.RevokeCertificate][google.cloud.security.privateca.v1beta1.CertificateAuthorityService.RevokeCertificate]. - name (str): - Required. The resource name for this - [Certificate][google.cloud.security.privateca.v1beta1.Certificate] - in the format - ``projects/*/locations/*/certificateAuthorities/*/certificates/*``. - - 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. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.cloud.security.privateca_v1beta1.types.Certificate: - A [Certificate][google.cloud.security.privateca.v1beta1.Certificate] corresponds to a signed X.509 certificate issued by a - [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority]. - - """ - # Create or coerce a protobuf request object. - # Quick check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - has_flattened_params = any([name]) - if request is not None and has_flattened_params: - raise ValueError('If the `request` argument is set, then none of ' - 'the individual field arguments should be set.') - - # Minor optimization to avoid making a copy if the user passes - # in a service.RevokeCertificateRequest. - # There's no risk of modifying the input as we've already verified - # 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 - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[self._transport.revoke_certificate] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata(( - ("name", request.name), - )), - ) - - # Send the request. - response = rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Done; return the response. - return response - - def update_certificate(self, - request: Optional[Union[service.UpdateCertificateRequest, dict]] = None, - *, - certificate: Optional[resources.Certificate] = None, - update_mask: Optional[field_mask_pb2.FieldMask] = None, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), - ) -> resources.Certificate: - r"""Update a - [Certificate][google.cloud.security.privateca.v1beta1.Certificate]. - Currently, the only field you can update is the - [labels][google.cloud.security.privateca.v1beta1.Certificate.labels] - field. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud.security import privateca_v1beta1 - - def sample_update_certificate(): - # Create a client - client = privateca_v1beta1.CertificateAuthorityServiceClient() - - # Initialize request argument(s) - certificate = privateca_v1beta1.Certificate() - certificate.pem_csr = "pem_csr_value" - - request = privateca_v1beta1.UpdateCertificateRequest( - certificate=certificate, - ) - - # Make the request - response = client.update_certificate(request=request) - - # Handle the response - print(response) - - Args: - request (Union[google.cloud.security.privateca_v1beta1.types.UpdateCertificateRequest, dict]): - The request object. Request message for - [CertificateAuthorityService.UpdateCertificate][google.cloud.security.privateca.v1beta1.CertificateAuthorityService.UpdateCertificate]. - certificate (google.cloud.security.privateca_v1beta1.types.Certificate): - Required. - [Certificate][google.cloud.security.privateca.v1beta1.Certificate] - with updated values. - - This corresponds to the ``certificate`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - update_mask (google.protobuf.field_mask_pb2.FieldMask): - Required. A list of fields to be - updated in this request. - - 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. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.cloud.security.privateca_v1beta1.types.Certificate: - A [Certificate][google.cloud.security.privateca.v1beta1.Certificate] corresponds to a signed X.509 certificate issued by a - [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority]. - - """ - # Create or coerce a protobuf request object. - # Quick check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - has_flattened_params = any([certificate, update_mask]) - if request is not None and has_flattened_params: - raise ValueError('If the `request` argument is set, then none of ' - 'the individual field arguments should be set.') - - # Minor optimization to avoid making a copy if the user passes - # in a service.UpdateCertificateRequest. - # There's no risk of modifying the input as we've already verified - # 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: - request.update_mask = update_mask - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[self._transport.update_certificate] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata(( - ("certificate.name", request.certificate.name), - )), - ) - - # Send the request. - response = rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Done; return the response. - return response - - def activate_certificate_authority(self, - request: Optional[Union[service.ActivateCertificateAuthorityRequest, dict]] = None, - *, - name: Optional[str] = None, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), - ) -> operation.Operation: - r"""Activate a - [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority] - that is in state - [PENDING_ACTIVATION][google.cloud.security.privateca.v1beta1.CertificateAuthority.State.PENDING_ACTIVATION] - and is of type - [SUBORDINATE][google.cloud.security.privateca.v1beta1.CertificateAuthority.Type.SUBORDINATE]. - After the parent Certificate Authority signs a certificate - signing request from - [FetchCertificateAuthorityCsr][google.cloud.security.privateca.v1beta1.CertificateAuthorityService.FetchCertificateAuthorityCsr], - this method can complete the activation process. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud.security import privateca_v1beta1 - - def sample_activate_certificate_authority(): - # Create a client - client = privateca_v1beta1.CertificateAuthorityServiceClient() - - # Initialize request argument(s) - subordinate_config = privateca_v1beta1.SubordinateConfig() - subordinate_config.certificate_authority = "certificate_authority_value" - - request = privateca_v1beta1.ActivateCertificateAuthorityRequest( - name="name_value", - pem_ca_certificate="pem_ca_certificate_value", - subordinate_config=subordinate_config, - ) - - # Make the request - operation = client.activate_certificate_authority(request=request) - - print("Waiting for operation to complete...") - - response = operation.result() - - # Handle the response - print(response) - - Args: - request (Union[google.cloud.security.privateca_v1beta1.types.ActivateCertificateAuthorityRequest, dict]): - The request object. Request message for - [CertificateAuthorityService.ActivateCertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthorityService.ActivateCertificateAuthority]. - name (str): - Required. The resource name for this - [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority] - in the format - ``projects/*/locations/*/certificateAuthorities/*``. - - 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. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.api_core.operation.Operation: - An object representing a long-running operation. - - The result type for the operation will be :class:`google.cloud.security.privateca_v1beta1.types.CertificateAuthority` A [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority] represents an individual Certificate Authority. - A - [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority] - can be used to create - [Certificates][google.cloud.security.privateca.v1beta1.Certificate]. - - """ - # Create or coerce a protobuf request object. - # Quick check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - has_flattened_params = any([name]) - if request is not None and has_flattened_params: - raise ValueError('If the `request` argument is set, then none of ' - 'the individual field arguments should be set.') - - # Minor optimization to avoid making a copy if the user passes - # in a service.ActivateCertificateAuthorityRequest. - # There's no risk of modifying the input as we've already verified - # 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 - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[self._transport.activate_certificate_authority] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata(( - ("name", request.name), - )), - ) - - # Send the request. - response = rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Wrap the response in an operation future. - response = operation.from_gapic( - response, - self._transport.operations_client, - resources.CertificateAuthority, - metadata_type=service.OperationMetadata, - ) - - # Done; return the response. - return response - - def create_certificate_authority(self, - request: Optional[Union[service.CreateCertificateAuthorityRequest, dict]] = None, - *, - parent: Optional[str] = None, - certificate_authority: Optional[resources.CertificateAuthority] = None, - certificate_authority_id: Optional[str] = None, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), - ) -> operation.Operation: - r"""Create a new - [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority] - in a given Project and Location. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud.security import privateca_v1beta1 - - def sample_create_certificate_authority(): - # Create a client - client = privateca_v1beta1.CertificateAuthorityServiceClient() - - # Initialize request argument(s) - certificate_authority = privateca_v1beta1.CertificateAuthority() - certificate_authority.type_ = "SUBORDINATE" - certificate_authority.tier = "DEVOPS" - certificate_authority.config.reusable_config.reusable_config = "reusable_config_value" - certificate_authority.key_spec.cloud_kms_key_version = "cloud_kms_key_version_value" - - request = privateca_v1beta1.CreateCertificateAuthorityRequest( - parent="parent_value", - certificate_authority_id="certificate_authority_id_value", - certificate_authority=certificate_authority, - ) - - # Make the request - operation = client.create_certificate_authority(request=request) - - print("Waiting for operation to complete...") - - response = operation.result() - - # Handle the response - print(response) - - Args: - request (Union[google.cloud.security.privateca_v1beta1.types.CreateCertificateAuthorityRequest, dict]): - The request object. Request message for - [CertificateAuthorityService.CreateCertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthorityService.CreateCertificateAuthority]. - parent (str): - Required. The resource name of the location associated - with the - [CertificateAuthorities][google.cloud.security.privateca.v1beta1.CertificateAuthority], - in the format ``projects/*/locations/*``. - - This corresponds to the ``parent`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - certificate_authority (google.cloud.security.privateca_v1beta1.types.CertificateAuthority): - Required. A - [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority] - with initial field values. - - This corresponds to the ``certificate_authority`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - certificate_authority_id (str): - Required. It must be unique within a location and match - the regular expression ``[a-zA-Z0-9_-]{1,63}`` - - 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. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.api_core.operation.Operation: - An object representing a long-running operation. - - The result type for the operation will be :class:`google.cloud.security.privateca_v1beta1.types.CertificateAuthority` A [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority] represents an individual Certificate Authority. - A - [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority] - can be used to create - [Certificates][google.cloud.security.privateca.v1beta1.Certificate]. - - """ - # Create or coerce a protobuf request object. - # Quick check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - has_flattened_params = any([parent, certificate_authority, certificate_authority_id]) - if request is not None and has_flattened_params: - raise ValueError('If the `request` argument is set, then none of ' - 'the individual field arguments should be set.') - - # Minor optimization to avoid making a copy if the user passes - # in a service.CreateCertificateAuthorityRequest. - # There's no risk of modifying the input as we've already verified - # 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: - request.certificate_authority = certificate_authority - if certificate_authority_id is not None: - request.certificate_authority_id = certificate_authority_id - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[self._transport.create_certificate_authority] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata(( - ("parent", request.parent), - )), - ) - - # Send the request. - response = rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Wrap the response in an operation future. - response = operation.from_gapic( - response, - self._transport.operations_client, - resources.CertificateAuthority, - metadata_type=service.OperationMetadata, - ) - - # Done; return the response. - return response - - def disable_certificate_authority(self, - request: Optional[Union[service.DisableCertificateAuthorityRequest, dict]] = None, - *, - name: Optional[str] = None, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), - ) -> operation.Operation: - r"""Disable a - [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority]. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud.security import privateca_v1beta1 - - def sample_disable_certificate_authority(): - # Create a client - client = privateca_v1beta1.CertificateAuthorityServiceClient() - - # Initialize request argument(s) - request = privateca_v1beta1.DisableCertificateAuthorityRequest( - name="name_value", - ) - - # Make the request - operation = client.disable_certificate_authority(request=request) - - print("Waiting for operation to complete...") - - response = operation.result() - - # Handle the response - print(response) - - Args: - request (Union[google.cloud.security.privateca_v1beta1.types.DisableCertificateAuthorityRequest, dict]): - The request object. Request message for - [CertificateAuthorityService.DisableCertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthorityService.DisableCertificateAuthority]. - name (str): - Required. The resource name for this - [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority] - in the format - ``projects/*/locations/*/certificateAuthorities/*``. - - 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. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.api_core.operation.Operation: - An object representing a long-running operation. - - The result type for the operation will be :class:`google.cloud.security.privateca_v1beta1.types.CertificateAuthority` A [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority] represents an individual Certificate Authority. - A - [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority] - can be used to create - [Certificates][google.cloud.security.privateca.v1beta1.Certificate]. - - """ - # Create or coerce a protobuf request object. - # Quick check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - has_flattened_params = any([name]) - if request is not None and has_flattened_params: - raise ValueError('If the `request` argument is set, then none of ' - 'the individual field arguments should be set.') - - # Minor optimization to avoid making a copy if the user passes - # in a service.DisableCertificateAuthorityRequest. - # There's no risk of modifying the input as we've already verified - # 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 - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[self._transport.disable_certificate_authority] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata(( - ("name", request.name), - )), - ) - - # Send the request. - response = rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Wrap the response in an operation future. - response = operation.from_gapic( - response, - self._transport.operations_client, - resources.CertificateAuthority, - metadata_type=service.OperationMetadata, - ) - - # Done; return the response. - return response - - def enable_certificate_authority(self, - request: Optional[Union[service.EnableCertificateAuthorityRequest, dict]] = None, - *, - name: Optional[str] = None, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), - ) -> operation.Operation: - r"""Enable a - [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority]. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud.security import privateca_v1beta1 - - def sample_enable_certificate_authority(): - # Create a client - client = privateca_v1beta1.CertificateAuthorityServiceClient() - - # Initialize request argument(s) - request = privateca_v1beta1.EnableCertificateAuthorityRequest( - name="name_value", - ) - - # Make the request - operation = client.enable_certificate_authority(request=request) - - print("Waiting for operation to complete...") - - response = operation.result() - - # Handle the response - print(response) - - Args: - request (Union[google.cloud.security.privateca_v1beta1.types.EnableCertificateAuthorityRequest, dict]): - The request object. Request message for - [CertificateAuthorityService.EnableCertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthorityService.EnableCertificateAuthority]. - name (str): - Required. The resource name for this - [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority] - in the format - ``projects/*/locations/*/certificateAuthorities/*``. - - 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. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.api_core.operation.Operation: - An object representing a long-running operation. - - The result type for the operation will be :class:`google.cloud.security.privateca_v1beta1.types.CertificateAuthority` A [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority] represents an individual Certificate Authority. - A - [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority] - can be used to create - [Certificates][google.cloud.security.privateca.v1beta1.Certificate]. - - """ - # Create or coerce a protobuf request object. - # Quick check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - has_flattened_params = any([name]) - if request is not None and has_flattened_params: - raise ValueError('If the `request` argument is set, then none of ' - 'the individual field arguments should be set.') - - # Minor optimization to avoid making a copy if the user passes - # in a service.EnableCertificateAuthorityRequest. - # There's no risk of modifying the input as we've already verified - # 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 - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[self._transport.enable_certificate_authority] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata(( - ("name", request.name), - )), - ) - - # Send the request. - response = rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Wrap the response in an operation future. - response = operation.from_gapic( - response, - self._transport.operations_client, - resources.CertificateAuthority, - metadata_type=service.OperationMetadata, - ) - - # Done; return the response. - return response - - def fetch_certificate_authority_csr(self, - request: Optional[Union[service.FetchCertificateAuthorityCsrRequest, dict]] = None, - *, - name: Optional[str] = None, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), - ) -> service.FetchCertificateAuthorityCsrResponse: - r"""Fetch a certificate signing request (CSR) from a - [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority] - that is in state - [PENDING_ACTIVATION][google.cloud.security.privateca.v1beta1.CertificateAuthority.State.PENDING_ACTIVATION] - and is of type - [SUBORDINATE][google.cloud.security.privateca.v1beta1.CertificateAuthority.Type.SUBORDINATE]. - The CSR must then be signed by the desired parent Certificate - Authority, which could be another - [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority] - resource, or could be an on-prem certificate authority. See also - [ActivateCertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthorityService.ActivateCertificateAuthority]. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud.security import privateca_v1beta1 - - def sample_fetch_certificate_authority_csr(): - # Create a client - client = privateca_v1beta1.CertificateAuthorityServiceClient() - - # Initialize request argument(s) - request = privateca_v1beta1.FetchCertificateAuthorityCsrRequest( - name="name_value", - ) - - # Make the request - response = client.fetch_certificate_authority_csr(request=request) - - # Handle the response - print(response) - - Args: - request (Union[google.cloud.security.privateca_v1beta1.types.FetchCertificateAuthorityCsrRequest, dict]): - The request object. Request message for - [CertificateAuthorityService.FetchCertificateAuthorityCsr][google.cloud.security.privateca.v1beta1.CertificateAuthorityService.FetchCertificateAuthorityCsr]. - name (str): - Required. The resource name for this - [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority] - in the format - ``projects/*/locations/*/certificateAuthorities/*``. - - 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. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.cloud.security.privateca_v1beta1.types.FetchCertificateAuthorityCsrResponse: - Response message for - [CertificateAuthorityService.FetchCertificateAuthorityCsr][google.cloud.security.privateca.v1beta1.CertificateAuthorityService.FetchCertificateAuthorityCsr]. - - """ - # Create or coerce a protobuf request object. - # Quick check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - has_flattened_params = any([name]) - if request is not None and has_flattened_params: - raise ValueError('If the `request` argument is set, then none of ' - 'the individual field arguments should be set.') - - # Minor optimization to avoid making a copy if the user passes - # in a service.FetchCertificateAuthorityCsrRequest. - # There's no risk of modifying the input as we've already verified - # 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 - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[self._transport.fetch_certificate_authority_csr] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata(( - ("name", request.name), - )), - ) - - # Send the request. - response = rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Done; return the response. - return response - - def get_certificate_authority(self, - request: Optional[Union[service.GetCertificateAuthorityRequest, dict]] = None, - *, - name: Optional[str] = None, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), - ) -> resources.CertificateAuthority: - r"""Returns a - [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority]. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud.security import privateca_v1beta1 - - def sample_get_certificate_authority(): - # Create a client - client = privateca_v1beta1.CertificateAuthorityServiceClient() - - # Initialize request argument(s) - request = privateca_v1beta1.GetCertificateAuthorityRequest( - name="name_value", - ) - - # Make the request - response = client.get_certificate_authority(request=request) - - # Handle the response - print(response) - - Args: - request (Union[google.cloud.security.privateca_v1beta1.types.GetCertificateAuthorityRequest, dict]): - The request object. Request message for - [CertificateAuthorityService.GetCertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthorityService.GetCertificateAuthority]. - name (str): - Required. The - [name][google.cloud.security.privateca.v1beta1.CertificateAuthority.name] - of the - [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority] - to get. - - 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. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.cloud.security.privateca_v1beta1.types.CertificateAuthority: - A [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority] represents an individual Certificate Authority. - A - [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority] - can be used to create - [Certificates][google.cloud.security.privateca.v1beta1.Certificate]. - - """ - # Create or coerce a protobuf request object. - # Quick check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - has_flattened_params = any([name]) - if request is not None and has_flattened_params: - raise ValueError('If the `request` argument is set, then none of ' - 'the individual field arguments should be set.') - - # Minor optimization to avoid making a copy if the user passes - # in a service.GetCertificateAuthorityRequest. - # There's no risk of modifying the input as we've already verified - # 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 - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[self._transport.get_certificate_authority] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata(( - ("name", request.name), - )), - ) - - # Send the request. - response = rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Done; return the response. - return response - - def list_certificate_authorities(self, - request: Optional[Union[service.ListCertificateAuthoritiesRequest, dict]] = None, - *, - parent: Optional[str] = None, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), - ) -> pagers.ListCertificateAuthoritiesPager: - r"""Lists - [CertificateAuthorities][google.cloud.security.privateca.v1beta1.CertificateAuthority]. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud.security import privateca_v1beta1 - - def sample_list_certificate_authorities(): - # Create a client - client = privateca_v1beta1.CertificateAuthorityServiceClient() - - # Initialize request argument(s) - request = privateca_v1beta1.ListCertificateAuthoritiesRequest( - parent="parent_value", - ) - - # Make the request - page_result = client.list_certificate_authorities(request=request) - - # Handle the response - for response in page_result: - print(response) - - Args: - request (Union[google.cloud.security.privateca_v1beta1.types.ListCertificateAuthoritiesRequest, dict]): - The request object. Request message for - [CertificateAuthorityService.ListCertificateAuthorities][google.cloud.security.privateca.v1beta1.CertificateAuthorityService.ListCertificateAuthorities]. - parent (str): - Required. The resource name of the location associated - with the - [CertificateAuthorities][google.cloud.security.privateca.v1beta1.CertificateAuthority], - in the format ``projects/*/locations/*``. - - 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. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.cloud.security.privateca_v1beta1.services.certificate_authority_service.pagers.ListCertificateAuthoritiesPager: - Response message for - [CertificateAuthorityService.ListCertificateAuthorities][google.cloud.security.privateca.v1beta1.CertificateAuthorityService.ListCertificateAuthorities]. - - Iterating over this object will yield results and - resolve additional pages automatically. - - """ - # Create or coerce a protobuf request object. - # Quick check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - has_flattened_params = any([parent]) - if request is not None and has_flattened_params: - raise ValueError('If the `request` argument is set, then none of ' - 'the individual field arguments should be set.') - - # Minor optimization to avoid making a copy if the user passes - # in a service.ListCertificateAuthoritiesRequest. - # There's no risk of modifying the input as we've already verified - # 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 - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[self._transport.list_certificate_authorities] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata(( - ("parent", request.parent), - )), - ) - - # Send the request. - response = rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # This method is paged; wrap the response in a pager, which provides - # an `__iter__` convenience method. - response = pagers.ListCertificateAuthoritiesPager( - method=rpc, - request=request, - response=response, - metadata=metadata, - ) - - # Done; return the response. - return response - - def restore_certificate_authority(self, - request: Optional[Union[service.RestoreCertificateAuthorityRequest, dict]] = None, - *, - name: Optional[str] = None, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), - ) -> operation.Operation: - r"""Restore a - [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority] - that is scheduled for deletion. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud.security import privateca_v1beta1 - - def sample_restore_certificate_authority(): - # Create a client - client = privateca_v1beta1.CertificateAuthorityServiceClient() - - # Initialize request argument(s) - request = privateca_v1beta1.RestoreCertificateAuthorityRequest( - name="name_value", - ) - - # Make the request - operation = client.restore_certificate_authority(request=request) - - print("Waiting for operation to complete...") - - response = operation.result() - - # Handle the response - print(response) - - Args: - request (Union[google.cloud.security.privateca_v1beta1.types.RestoreCertificateAuthorityRequest, dict]): - The request object. Request message for - [CertificateAuthorityService.RestoreCertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthorityService.RestoreCertificateAuthority]. - name (str): - Required. The resource name for this - [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority] - in the format - ``projects/*/locations/*/certificateAuthorities/*``. - - 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. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.api_core.operation.Operation: - An object representing a long-running operation. - - The result type for the operation will be :class:`google.cloud.security.privateca_v1beta1.types.CertificateAuthority` A [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority] represents an individual Certificate Authority. - A - [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority] - can be used to create - [Certificates][google.cloud.security.privateca.v1beta1.Certificate]. - - """ - # Create or coerce a protobuf request object. - # Quick check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - has_flattened_params = any([name]) - if request is not None and has_flattened_params: - raise ValueError('If the `request` argument is set, then none of ' - 'the individual field arguments should be set.') - - # Minor optimization to avoid making a copy if the user passes - # in a service.RestoreCertificateAuthorityRequest. - # There's no risk of modifying the input as we've already verified - # 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 - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[self._transport.restore_certificate_authority] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata(( - ("name", request.name), - )), - ) - - # Send the request. - response = rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Wrap the response in an operation future. - response = operation.from_gapic( - response, - self._transport.operations_client, - resources.CertificateAuthority, - metadata_type=service.OperationMetadata, - ) - - # Done; return the response. - return response - - def schedule_delete_certificate_authority(self, - request: Optional[Union[service.ScheduleDeleteCertificateAuthorityRequest, dict]] = None, - *, - name: Optional[str] = None, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), - ) -> operation.Operation: - r"""Schedule a - [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority] - for deletion. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud.security import privateca_v1beta1 - - def sample_schedule_delete_certificate_authority(): - # Create a client - client = privateca_v1beta1.CertificateAuthorityServiceClient() - - # Initialize request argument(s) - request = privateca_v1beta1.ScheduleDeleteCertificateAuthorityRequest( - name="name_value", - ) - - # Make the request - operation = client.schedule_delete_certificate_authority(request=request) - - print("Waiting for operation to complete...") - - response = operation.result() - - # Handle the response - print(response) - - Args: - request (Union[google.cloud.security.privateca_v1beta1.types.ScheduleDeleteCertificateAuthorityRequest, dict]): - The request object. Request message for - [CertificateAuthorityService.ScheduleDeleteCertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthorityService.ScheduleDeleteCertificateAuthority]. - name (str): - Required. The resource name for this - [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority] - in the format - ``projects/*/locations/*/certificateAuthorities/*``. - - 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. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.api_core.operation.Operation: - An object representing a long-running operation. - - The result type for the operation will be :class:`google.cloud.security.privateca_v1beta1.types.CertificateAuthority` A [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority] represents an individual Certificate Authority. - A - [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority] - can be used to create - [Certificates][google.cloud.security.privateca.v1beta1.Certificate]. - - """ - # Create or coerce a protobuf request object. - # Quick check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - has_flattened_params = any([name]) - if request is not None and has_flattened_params: - raise ValueError('If the `request` argument is set, then none of ' - 'the individual field arguments should be set.') - - # Minor optimization to avoid making a copy if the user passes - # in a service.ScheduleDeleteCertificateAuthorityRequest. - # There's no risk of modifying the input as we've already verified - # 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 - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[self._transport.schedule_delete_certificate_authority] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata(( - ("name", request.name), - )), - ) - - # Send the request. - response = rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Wrap the response in an operation future. - response = operation.from_gapic( - response, - self._transport.operations_client, - resources.CertificateAuthority, - metadata_type=service.OperationMetadata, - ) - - # Done; return the response. - return response - - def update_certificate_authority(self, - request: Optional[Union[service.UpdateCertificateAuthorityRequest, dict]] = None, - *, - certificate_authority: Optional[resources.CertificateAuthority] = None, - update_mask: Optional[field_mask_pb2.FieldMask] = None, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), - ) -> operation.Operation: - r"""Update a - [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority]. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud.security import privateca_v1beta1 - - def sample_update_certificate_authority(): - # Create a client - client = privateca_v1beta1.CertificateAuthorityServiceClient() - - # Initialize request argument(s) - certificate_authority = privateca_v1beta1.CertificateAuthority() - certificate_authority.type_ = "SUBORDINATE" - certificate_authority.tier = "DEVOPS" - certificate_authority.config.reusable_config.reusable_config = "reusable_config_value" - certificate_authority.key_spec.cloud_kms_key_version = "cloud_kms_key_version_value" - - request = privateca_v1beta1.UpdateCertificateAuthorityRequest( - certificate_authority=certificate_authority, - ) - - # Make the request - operation = client.update_certificate_authority(request=request) - - print("Waiting for operation to complete...") - - response = operation.result() - - # Handle the response - print(response) - - Args: - request (Union[google.cloud.security.privateca_v1beta1.types.UpdateCertificateAuthorityRequest, dict]): - The request object. Request message for - [CertificateAuthorityService.UpdateCertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthorityService.UpdateCertificateAuthority]. - certificate_authority (google.cloud.security.privateca_v1beta1.types.CertificateAuthority): - Required. - [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority] - with updated values. - - This corresponds to the ``certificate_authority`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - update_mask (google.protobuf.field_mask_pb2.FieldMask): - Required. A list of fields to be - updated in this request. - - 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. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.api_core.operation.Operation: - An object representing a long-running operation. - - The result type for the operation will be :class:`google.cloud.security.privateca_v1beta1.types.CertificateAuthority` A [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority] represents an individual Certificate Authority. - A - [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority] - can be used to create - [Certificates][google.cloud.security.privateca.v1beta1.Certificate]. - - """ - # Create or coerce a protobuf request object. - # Quick check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - has_flattened_params = any([certificate_authority, update_mask]) - if request is not None and has_flattened_params: - raise ValueError('If the `request` argument is set, then none of ' - 'the individual field arguments should be set.') - - # Minor optimization to avoid making a copy if the user passes - # in a service.UpdateCertificateAuthorityRequest. - # There's no risk of modifying the input as we've already verified - # 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: - request.update_mask = update_mask - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[self._transport.update_certificate_authority] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata(( - ("certificate_authority.name", request.certificate_authority.name), - )), - ) - - # Send the request. - response = rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Wrap the response in an operation future. - response = operation.from_gapic( - response, - self._transport.operations_client, - resources.CertificateAuthority, - metadata_type=service.OperationMetadata, - ) - - # Done; return the response. - return response - - def get_certificate_revocation_list(self, - request: Optional[Union[service.GetCertificateRevocationListRequest, dict]] = None, - *, - name: Optional[str] = None, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), - ) -> resources.CertificateRevocationList: - r"""Returns a - [CertificateRevocationList][google.cloud.security.privateca.v1beta1.CertificateRevocationList]. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud.security import privateca_v1beta1 - - def sample_get_certificate_revocation_list(): - # Create a client - client = privateca_v1beta1.CertificateAuthorityServiceClient() - - # Initialize request argument(s) - request = privateca_v1beta1.GetCertificateRevocationListRequest( - name="name_value", - ) - - # Make the request - response = client.get_certificate_revocation_list(request=request) - - # Handle the response - print(response) - - Args: - request (Union[google.cloud.security.privateca_v1beta1.types.GetCertificateRevocationListRequest, dict]): - The request object. Request message for - [CertificateAuthorityService.GetCertificateRevocationList][google.cloud.security.privateca.v1beta1.CertificateAuthorityService.GetCertificateRevocationList]. - name (str): - Required. The - [name][google.cloud.security.privateca.v1beta1.CertificateRevocationList.name] - of the - [CertificateRevocationList][google.cloud.security.privateca.v1beta1.CertificateRevocationList] - to get. - - 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. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.cloud.security.privateca_v1beta1.types.CertificateRevocationList: - A [CertificateRevocationList][google.cloud.security.privateca.v1beta1.CertificateRevocationList] corresponds to a signed X.509 certificate - Revocation List (CRL). A CRL contains the serial - numbers of certificates that should no longer be - trusted. - - """ - # Create or coerce a protobuf request object. - # Quick check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - has_flattened_params = any([name]) - if request is not None and has_flattened_params: - raise ValueError('If the `request` argument is set, then none of ' - 'the individual field arguments should be set.') - - # Minor optimization to avoid making a copy if the user passes - # in a service.GetCertificateRevocationListRequest. - # There's no risk of modifying the input as we've already verified - # 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 - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[self._transport.get_certificate_revocation_list] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata(( - ("name", request.name), - )), - ) - - # Send the request. - response = rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Done; return the response. - return response - - def list_certificate_revocation_lists(self, - request: Optional[Union[service.ListCertificateRevocationListsRequest, dict]] = None, - *, - parent: Optional[str] = None, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), - ) -> pagers.ListCertificateRevocationListsPager: - r"""Lists - [CertificateRevocationLists][google.cloud.security.privateca.v1beta1.CertificateRevocationList]. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud.security import privateca_v1beta1 - - def sample_list_certificate_revocation_lists(): - # Create a client - client = privateca_v1beta1.CertificateAuthorityServiceClient() - - # Initialize request argument(s) - request = privateca_v1beta1.ListCertificateRevocationListsRequest( - parent="parent_value", - ) - - # Make the request - page_result = client.list_certificate_revocation_lists(request=request) - - # Handle the response - for response in page_result: - print(response) - - Args: - request (Union[google.cloud.security.privateca_v1beta1.types.ListCertificateRevocationListsRequest, dict]): - The request object. Request message for - [CertificateAuthorityService.ListCertificateRevocationLists][google.cloud.security.privateca.v1beta1.CertificateAuthorityService.ListCertificateRevocationLists]. - parent (str): - Required. The resource name of the location associated - with the - [CertificateRevocationLists][google.cloud.security.privateca.v1beta1.CertificateRevocationList], - in the format - ``projects/*/locations/*/certificateauthorities/*``. - - 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. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.cloud.security.privateca_v1beta1.services.certificate_authority_service.pagers.ListCertificateRevocationListsPager: - Response message for - [CertificateAuthorityService.ListCertificateRevocationLists][google.cloud.security.privateca.v1beta1.CertificateAuthorityService.ListCertificateRevocationLists]. - - Iterating over this object will yield results and - resolve additional pages automatically. - - """ - # Create or coerce a protobuf request object. - # Quick check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - has_flattened_params = any([parent]) - if request is not None and has_flattened_params: - raise ValueError('If the `request` argument is set, then none of ' - 'the individual field arguments should be set.') - - # Minor optimization to avoid making a copy if the user passes - # in a service.ListCertificateRevocationListsRequest. - # There's no risk of modifying the input as we've already verified - # 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 - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[self._transport.list_certificate_revocation_lists] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata(( - ("parent", request.parent), - )), - ) - - # Send the request. - response = rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # This method is paged; wrap the response in a pager, which provides - # an `__iter__` convenience method. - response = pagers.ListCertificateRevocationListsPager( - method=rpc, - request=request, - response=response, - metadata=metadata, - ) - - # Done; return the response. - return response - - def update_certificate_revocation_list(self, - request: Optional[Union[service.UpdateCertificateRevocationListRequest, dict]] = None, - *, - certificate_revocation_list: Optional[resources.CertificateRevocationList] = None, - update_mask: Optional[field_mask_pb2.FieldMask] = None, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), - ) -> operation.Operation: - r"""Update a - [CertificateRevocationList][google.cloud.security.privateca.v1beta1.CertificateRevocationList]. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud.security import privateca_v1beta1 - - def sample_update_certificate_revocation_list(): - # Create a client - client = privateca_v1beta1.CertificateAuthorityServiceClient() - - # Initialize request argument(s) - request = privateca_v1beta1.UpdateCertificateRevocationListRequest( - ) - - # Make the request - operation = client.update_certificate_revocation_list(request=request) - - print("Waiting for operation to complete...") - - response = operation.result() - - # Handle the response - print(response) - - Args: - request (Union[google.cloud.security.privateca_v1beta1.types.UpdateCertificateRevocationListRequest, dict]): - The request object. Request message for - [CertificateAuthorityService.UpdateCertificateRevocationList][google.cloud.security.privateca.v1beta1.CertificateAuthorityService.UpdateCertificateRevocationList]. - certificate_revocation_list (google.cloud.security.privateca_v1beta1.types.CertificateRevocationList): - Required. - [CertificateRevocationList][google.cloud.security.privateca.v1beta1.CertificateRevocationList] - with updated values. - - This corresponds to the ``certificate_revocation_list`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - update_mask (google.protobuf.field_mask_pb2.FieldMask): - Required. A list of fields to be - updated in this request. - - 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. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.api_core.operation.Operation: - An object representing a long-running operation. - - The result type for the operation will be :class:`google.cloud.security.privateca_v1beta1.types.CertificateRevocationList` A [CertificateRevocationList][google.cloud.security.privateca.v1beta1.CertificateRevocationList] corresponds to a signed X.509 certificate - Revocation List (CRL). A CRL contains the serial - numbers of certificates that should no longer be - trusted. - - """ - # Create or coerce a protobuf request object. - # Quick check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - has_flattened_params = any([certificate_revocation_list, update_mask]) - if request is not None and has_flattened_params: - raise ValueError('If the `request` argument is set, then none of ' - 'the individual field arguments should be set.') - - # Minor optimization to avoid making a copy if the user passes - # in a service.UpdateCertificateRevocationListRequest. - # There's no risk of modifying the input as we've already verified - # 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: - request.update_mask = update_mask - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[self._transport.update_certificate_revocation_list] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata(( - ("certificate_revocation_list.name", request.certificate_revocation_list.name), - )), - ) - - # Send the request. - response = rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Wrap the response in an operation future. - response = operation.from_gapic( - response, - self._transport.operations_client, - resources.CertificateRevocationList, - metadata_type=service.OperationMetadata, - ) - - # Done; return the response. - return response - - def get_reusable_config(self, - request: Optional[Union[service.GetReusableConfigRequest, dict]] = None, - *, - name: Optional[str] = None, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), - ) -> resources.ReusableConfig: - r"""Returns a - [ReusableConfig][google.cloud.security.privateca.v1beta1.ReusableConfig]. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud.security import privateca_v1beta1 - - def sample_get_reusable_config(): - # Create a client - client = privateca_v1beta1.CertificateAuthorityServiceClient() - - # Initialize request argument(s) - request = privateca_v1beta1.GetReusableConfigRequest( - name="name_value", - ) - - # Make the request - response = client.get_reusable_config(request=request) - - # Handle the response - print(response) - - Args: - request (Union[google.cloud.security.privateca_v1beta1.types.GetReusableConfigRequest, dict]): - The request object. Request message for - [CertificateAuthorityService.GetReusableConfig][google.cloud.security.privateca.v1beta1.CertificateAuthorityService.GetReusableConfig]. - name (str): - Required. The [name][ReusableConfigs.name] of the - [ReusableConfigs][] to get. - - 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. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.cloud.security.privateca_v1beta1.types.ReusableConfig: - A [ReusableConfig][google.cloud.security.privateca.v1beta1.ReusableConfig] refers to a managed [ReusableConfigValues][google.cloud.security.privateca.v1beta1.ReusableConfigValues]. Those, in - turn, are used to describe certain fields of an X.509 - certificate, such as the key usage fields, fields - specific to CA certificates, certificate policy - extensions and custom extensions. - - """ - # Create or coerce a protobuf request object. - # Quick check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - has_flattened_params = any([name]) - if request is not None and has_flattened_params: - raise ValueError('If the `request` argument is set, then none of ' - 'the individual field arguments should be set.') - - # Minor optimization to avoid making a copy if the user passes - # in a service.GetReusableConfigRequest. - # There's no risk of modifying the input as we've already verified - # 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 - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[self._transport.get_reusable_config] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata(( - ("name", request.name), - )), - ) - - # Send the request. - response = rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Done; return the response. - return response - - def list_reusable_configs(self, - request: Optional[Union[service.ListReusableConfigsRequest, dict]] = None, - *, - parent: Optional[str] = None, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), - ) -> pagers.ListReusableConfigsPager: - r"""Lists - [ReusableConfigs][google.cloud.security.privateca.v1beta1.ReusableConfig]. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud.security import privateca_v1beta1 - - def sample_list_reusable_configs(): - # Create a client - client = privateca_v1beta1.CertificateAuthorityServiceClient() - - # Initialize request argument(s) - request = privateca_v1beta1.ListReusableConfigsRequest( - parent="parent_value", - ) - - # Make the request - page_result = client.list_reusable_configs(request=request) - - # Handle the response - for response in page_result: - print(response) - - Args: - request (Union[google.cloud.security.privateca_v1beta1.types.ListReusableConfigsRequest, dict]): - The request object. Request message for - [CertificateAuthorityService.ListReusableConfigs][google.cloud.security.privateca.v1beta1.CertificateAuthorityService.ListReusableConfigs]. - parent (str): - Required. The resource name of the location associated - with the - [ReusableConfigs][google.cloud.security.privateca.v1beta1.ReusableConfig], - in the format ``projects/*/locations/*``. - - 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. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.cloud.security.privateca_v1beta1.services.certificate_authority_service.pagers.ListReusableConfigsPager: - Response message for - [CertificateAuthorityService.ListReusableConfigs][google.cloud.security.privateca.v1beta1.CertificateAuthorityService.ListReusableConfigs]. - - Iterating over this object will yield results and - resolve additional pages automatically. - - """ - # Create or coerce a protobuf request object. - # Quick check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - has_flattened_params = any([parent]) - if request is not None and has_flattened_params: - raise ValueError('If the `request` argument is set, then none of ' - 'the individual field arguments should be set.') - - # Minor optimization to avoid making a copy if the user passes - # in a service.ListReusableConfigsRequest. - # There's no risk of modifying the input as we've already verified - # 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 - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[self._transport.list_reusable_configs] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata(( - ("parent", request.parent), - )), - ) - - # Send the request. - response = rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # This method is paged; wrap the response in a pager, which provides - # an `__iter__` convenience method. - response = pagers.ListReusableConfigsPager( - method=rpc, - request=request, - response=response, - metadata=metadata, - ) - - # Done; return the response. - return response - - def __enter__(self) -> "CertificateAuthorityServiceClient": - return self - - def __exit__(self, type, value, traceback): - """Releases underlying transport's resources. - - .. warning:: - ONLY use as a context manager if the transport is NOT shared - with other clients! Exiting the with block will CLOSE the transport - and may cause errors in other clients! - """ - self.transport.close() - - - - - - - -DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo(gapic_version=package_version.__version__) - - -__all__ = ( - "CertificateAuthorityServiceClient", -) diff --git a/owl-bot-staging/v1beta1/google/cloud/security/privateca_v1beta1/services/certificate_authority_service/pagers.py b/owl-bot-staging/v1beta1/google/cloud/security/privateca_v1beta1/services/certificate_authority_service/pagers.py deleted file mode 100644 index 3ec66c3..0000000 --- a/owl-bot-staging/v1beta1/google/cloud/security/privateca_v1beta1/services/certificate_authority_service/pagers.py +++ /dev/null @@ -1,503 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -from typing import Any, AsyncIterator, Awaitable, Callable, Sequence, Tuple, Optional, Iterator - -from google.cloud.security.privateca_v1beta1.types import resources -from google.cloud.security.privateca_v1beta1.types import service - - -class ListCertificatesPager: - """A pager for iterating through ``list_certificates`` requests. - - This class thinly wraps an initial - :class:`google.cloud.security.privateca_v1beta1.types.ListCertificatesResponse` object, and - provides an ``__iter__`` method to iterate through its - ``certificates`` field. - - If there are more pages, the ``__iter__`` method will make additional - ``ListCertificates`` requests and continue to iterate - through the ``certificates`` field on the - corresponding responses. - - All the usual :class:`google.cloud.security.privateca_v1beta1.types.ListCertificatesResponse` - attributes are available on the pager. If multiple requests are made, only - the most recent response is retained, and thus used for attribute lookup. - """ - def __init__(self, - method: Callable[..., service.ListCertificatesResponse], - request: service.ListCertificatesRequest, - response: service.ListCertificatesResponse, - *, - metadata: Sequence[Tuple[str, str]] = ()): - """Instantiate the pager. - - Args: - method (Callable): The method that was originally called, and - which instantiated this pager. - request (google.cloud.security.privateca_v1beta1.types.ListCertificatesRequest): - The initial request object. - response (google.cloud.security.privateca_v1beta1.types.ListCertificatesResponse): - The initial response object. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - """ - self._method = method - self._request = service.ListCertificatesRequest(request) - self._response = response - self._metadata = metadata - - def __getattr__(self, name: str) -> Any: - return getattr(self._response, name) - - @property - def pages(self) -> Iterator[service.ListCertificatesResponse]: - yield self._response - while self._response.next_page_token: - self._request.page_token = self._response.next_page_token - self._response = self._method(self._request, metadata=self._metadata) - yield self._response - - def __iter__(self) -> Iterator[resources.Certificate]: - for page in self.pages: - yield from page.certificates - - def __repr__(self) -> str: - return '{0}<{1!r}>'.format(self.__class__.__name__, self._response) - - -class ListCertificatesAsyncPager: - """A pager for iterating through ``list_certificates`` requests. - - This class thinly wraps an initial - :class:`google.cloud.security.privateca_v1beta1.types.ListCertificatesResponse` object, and - provides an ``__aiter__`` method to iterate through its - ``certificates`` field. - - If there are more pages, the ``__aiter__`` method will make additional - ``ListCertificates`` requests and continue to iterate - through the ``certificates`` field on the - corresponding responses. - - All the usual :class:`google.cloud.security.privateca_v1beta1.types.ListCertificatesResponse` - attributes are available on the pager. If multiple requests are made, only - the most recent response is retained, and thus used for attribute lookup. - """ - def __init__(self, - method: Callable[..., Awaitable[service.ListCertificatesResponse]], - request: service.ListCertificatesRequest, - response: service.ListCertificatesResponse, - *, - metadata: Sequence[Tuple[str, str]] = ()): - """Instantiates the pager. - - Args: - method (Callable): The method that was originally called, and - which instantiated this pager. - request (google.cloud.security.privateca_v1beta1.types.ListCertificatesRequest): - The initial request object. - response (google.cloud.security.privateca_v1beta1.types.ListCertificatesResponse): - The initial response object. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - """ - self._method = method - self._request = service.ListCertificatesRequest(request) - self._response = response - self._metadata = metadata - - def __getattr__(self, name: str) -> Any: - return getattr(self._response, name) - - @property - async def pages(self) -> AsyncIterator[service.ListCertificatesResponse]: - yield self._response - while self._response.next_page_token: - self._request.page_token = self._response.next_page_token - self._response = await self._method(self._request, metadata=self._metadata) - yield self._response - def __aiter__(self) -> AsyncIterator[resources.Certificate]: - async def async_generator(): - async for page in self.pages: - for response in page.certificates: - yield response - - return async_generator() - - def __repr__(self) -> str: - return '{0}<{1!r}>'.format(self.__class__.__name__, self._response) - - -class ListCertificateAuthoritiesPager: - """A pager for iterating through ``list_certificate_authorities`` requests. - - This class thinly wraps an initial - :class:`google.cloud.security.privateca_v1beta1.types.ListCertificateAuthoritiesResponse` object, and - provides an ``__iter__`` method to iterate through its - ``certificate_authorities`` field. - - If there are more pages, the ``__iter__`` method will make additional - ``ListCertificateAuthorities`` requests and continue to iterate - through the ``certificate_authorities`` field on the - corresponding responses. - - All the usual :class:`google.cloud.security.privateca_v1beta1.types.ListCertificateAuthoritiesResponse` - attributes are available on the pager. If multiple requests are made, only - the most recent response is retained, and thus used for attribute lookup. - """ - def __init__(self, - method: Callable[..., service.ListCertificateAuthoritiesResponse], - request: service.ListCertificateAuthoritiesRequest, - response: service.ListCertificateAuthoritiesResponse, - *, - metadata: Sequence[Tuple[str, str]] = ()): - """Instantiate the pager. - - Args: - method (Callable): The method that was originally called, and - which instantiated this pager. - request (google.cloud.security.privateca_v1beta1.types.ListCertificateAuthoritiesRequest): - The initial request object. - response (google.cloud.security.privateca_v1beta1.types.ListCertificateAuthoritiesResponse): - The initial response object. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - """ - self._method = method - self._request = service.ListCertificateAuthoritiesRequest(request) - self._response = response - self._metadata = metadata - - def __getattr__(self, name: str) -> Any: - return getattr(self._response, name) - - @property - def pages(self) -> Iterator[service.ListCertificateAuthoritiesResponse]: - yield self._response - while self._response.next_page_token: - self._request.page_token = self._response.next_page_token - self._response = self._method(self._request, metadata=self._metadata) - yield self._response - - def __iter__(self) -> Iterator[resources.CertificateAuthority]: - for page in self.pages: - yield from page.certificate_authorities - - def __repr__(self) -> str: - return '{0}<{1!r}>'.format(self.__class__.__name__, self._response) - - -class ListCertificateAuthoritiesAsyncPager: - """A pager for iterating through ``list_certificate_authorities`` requests. - - This class thinly wraps an initial - :class:`google.cloud.security.privateca_v1beta1.types.ListCertificateAuthoritiesResponse` object, and - provides an ``__aiter__`` method to iterate through its - ``certificate_authorities`` field. - - If there are more pages, the ``__aiter__`` method will make additional - ``ListCertificateAuthorities`` requests and continue to iterate - through the ``certificate_authorities`` field on the - corresponding responses. - - All the usual :class:`google.cloud.security.privateca_v1beta1.types.ListCertificateAuthoritiesResponse` - attributes are available on the pager. If multiple requests are made, only - the most recent response is retained, and thus used for attribute lookup. - """ - def __init__(self, - method: Callable[..., Awaitable[service.ListCertificateAuthoritiesResponse]], - request: service.ListCertificateAuthoritiesRequest, - response: service.ListCertificateAuthoritiesResponse, - *, - metadata: Sequence[Tuple[str, str]] = ()): - """Instantiates the pager. - - Args: - method (Callable): The method that was originally called, and - which instantiated this pager. - request (google.cloud.security.privateca_v1beta1.types.ListCertificateAuthoritiesRequest): - The initial request object. - response (google.cloud.security.privateca_v1beta1.types.ListCertificateAuthoritiesResponse): - The initial response object. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - """ - self._method = method - self._request = service.ListCertificateAuthoritiesRequest(request) - self._response = response - self._metadata = metadata - - def __getattr__(self, name: str) -> Any: - return getattr(self._response, name) - - @property - async def pages(self) -> AsyncIterator[service.ListCertificateAuthoritiesResponse]: - yield self._response - while self._response.next_page_token: - self._request.page_token = self._response.next_page_token - self._response = await self._method(self._request, metadata=self._metadata) - yield self._response - def __aiter__(self) -> AsyncIterator[resources.CertificateAuthority]: - async def async_generator(): - async for page in self.pages: - for response in page.certificate_authorities: - yield response - - return async_generator() - - def __repr__(self) -> str: - return '{0}<{1!r}>'.format(self.__class__.__name__, self._response) - - -class ListCertificateRevocationListsPager: - """A pager for iterating through ``list_certificate_revocation_lists`` requests. - - This class thinly wraps an initial - :class:`google.cloud.security.privateca_v1beta1.types.ListCertificateRevocationListsResponse` object, and - provides an ``__iter__`` method to iterate through its - ``certificate_revocation_lists`` field. - - If there are more pages, the ``__iter__`` method will make additional - ``ListCertificateRevocationLists`` requests and continue to iterate - through the ``certificate_revocation_lists`` field on the - corresponding responses. - - All the usual :class:`google.cloud.security.privateca_v1beta1.types.ListCertificateRevocationListsResponse` - attributes are available on the pager. If multiple requests are made, only - the most recent response is retained, and thus used for attribute lookup. - """ - def __init__(self, - method: Callable[..., service.ListCertificateRevocationListsResponse], - request: service.ListCertificateRevocationListsRequest, - response: service.ListCertificateRevocationListsResponse, - *, - metadata: Sequence[Tuple[str, str]] = ()): - """Instantiate the pager. - - Args: - method (Callable): The method that was originally called, and - which instantiated this pager. - request (google.cloud.security.privateca_v1beta1.types.ListCertificateRevocationListsRequest): - The initial request object. - response (google.cloud.security.privateca_v1beta1.types.ListCertificateRevocationListsResponse): - The initial response object. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - """ - self._method = method - self._request = service.ListCertificateRevocationListsRequest(request) - self._response = response - self._metadata = metadata - - def __getattr__(self, name: str) -> Any: - return getattr(self._response, name) - - @property - def pages(self) -> Iterator[service.ListCertificateRevocationListsResponse]: - yield self._response - while self._response.next_page_token: - self._request.page_token = self._response.next_page_token - self._response = self._method(self._request, metadata=self._metadata) - yield self._response - - def __iter__(self) -> Iterator[resources.CertificateRevocationList]: - for page in self.pages: - yield from page.certificate_revocation_lists - - def __repr__(self) -> str: - return '{0}<{1!r}>'.format(self.__class__.__name__, self._response) - - -class ListCertificateRevocationListsAsyncPager: - """A pager for iterating through ``list_certificate_revocation_lists`` requests. - - This class thinly wraps an initial - :class:`google.cloud.security.privateca_v1beta1.types.ListCertificateRevocationListsResponse` object, and - provides an ``__aiter__`` method to iterate through its - ``certificate_revocation_lists`` field. - - If there are more pages, the ``__aiter__`` method will make additional - ``ListCertificateRevocationLists`` requests and continue to iterate - through the ``certificate_revocation_lists`` field on the - corresponding responses. - - All the usual :class:`google.cloud.security.privateca_v1beta1.types.ListCertificateRevocationListsResponse` - attributes are available on the pager. If multiple requests are made, only - the most recent response is retained, and thus used for attribute lookup. - """ - def __init__(self, - method: Callable[..., Awaitable[service.ListCertificateRevocationListsResponse]], - request: service.ListCertificateRevocationListsRequest, - response: service.ListCertificateRevocationListsResponse, - *, - metadata: Sequence[Tuple[str, str]] = ()): - """Instantiates the pager. - - Args: - method (Callable): The method that was originally called, and - which instantiated this pager. - request (google.cloud.security.privateca_v1beta1.types.ListCertificateRevocationListsRequest): - The initial request object. - response (google.cloud.security.privateca_v1beta1.types.ListCertificateRevocationListsResponse): - The initial response object. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - """ - self._method = method - self._request = service.ListCertificateRevocationListsRequest(request) - self._response = response - self._metadata = metadata - - def __getattr__(self, name: str) -> Any: - return getattr(self._response, name) - - @property - async def pages(self) -> AsyncIterator[service.ListCertificateRevocationListsResponse]: - yield self._response - while self._response.next_page_token: - self._request.page_token = self._response.next_page_token - self._response = await self._method(self._request, metadata=self._metadata) - yield self._response - def __aiter__(self) -> AsyncIterator[resources.CertificateRevocationList]: - async def async_generator(): - async for page in self.pages: - for response in page.certificate_revocation_lists: - yield response - - return async_generator() - - def __repr__(self) -> str: - return '{0}<{1!r}>'.format(self.__class__.__name__, self._response) - - -class ListReusableConfigsPager: - """A pager for iterating through ``list_reusable_configs`` requests. - - This class thinly wraps an initial - :class:`google.cloud.security.privateca_v1beta1.types.ListReusableConfigsResponse` object, and - provides an ``__iter__`` method to iterate through its - ``reusable_configs`` field. - - If there are more pages, the ``__iter__`` method will make additional - ``ListReusableConfigs`` requests and continue to iterate - through the ``reusable_configs`` field on the - corresponding responses. - - All the usual :class:`google.cloud.security.privateca_v1beta1.types.ListReusableConfigsResponse` - attributes are available on the pager. If multiple requests are made, only - the most recent response is retained, and thus used for attribute lookup. - """ - def __init__(self, - method: Callable[..., service.ListReusableConfigsResponse], - request: service.ListReusableConfigsRequest, - response: service.ListReusableConfigsResponse, - *, - metadata: Sequence[Tuple[str, str]] = ()): - """Instantiate the pager. - - Args: - method (Callable): The method that was originally called, and - which instantiated this pager. - request (google.cloud.security.privateca_v1beta1.types.ListReusableConfigsRequest): - The initial request object. - response (google.cloud.security.privateca_v1beta1.types.ListReusableConfigsResponse): - The initial response object. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - """ - self._method = method - self._request = service.ListReusableConfigsRequest(request) - self._response = response - self._metadata = metadata - - def __getattr__(self, name: str) -> Any: - return getattr(self._response, name) - - @property - def pages(self) -> Iterator[service.ListReusableConfigsResponse]: - yield self._response - while self._response.next_page_token: - self._request.page_token = self._response.next_page_token - self._response = self._method(self._request, metadata=self._metadata) - yield self._response - - def __iter__(self) -> Iterator[resources.ReusableConfig]: - for page in self.pages: - yield from page.reusable_configs - - def __repr__(self) -> str: - return '{0}<{1!r}>'.format(self.__class__.__name__, self._response) - - -class ListReusableConfigsAsyncPager: - """A pager for iterating through ``list_reusable_configs`` requests. - - This class thinly wraps an initial - :class:`google.cloud.security.privateca_v1beta1.types.ListReusableConfigsResponse` object, and - provides an ``__aiter__`` method to iterate through its - ``reusable_configs`` field. - - If there are more pages, the ``__aiter__`` method will make additional - ``ListReusableConfigs`` requests and continue to iterate - through the ``reusable_configs`` field on the - corresponding responses. - - All the usual :class:`google.cloud.security.privateca_v1beta1.types.ListReusableConfigsResponse` - attributes are available on the pager. If multiple requests are made, only - the most recent response is retained, and thus used for attribute lookup. - """ - def __init__(self, - method: Callable[..., Awaitable[service.ListReusableConfigsResponse]], - request: service.ListReusableConfigsRequest, - response: service.ListReusableConfigsResponse, - *, - metadata: Sequence[Tuple[str, str]] = ()): - """Instantiates the pager. - - Args: - method (Callable): The method that was originally called, and - which instantiated this pager. - request (google.cloud.security.privateca_v1beta1.types.ListReusableConfigsRequest): - The initial request object. - response (google.cloud.security.privateca_v1beta1.types.ListReusableConfigsResponse): - The initial response object. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - """ - self._method = method - self._request = service.ListReusableConfigsRequest(request) - self._response = response - self._metadata = metadata - - def __getattr__(self, name: str) -> Any: - return getattr(self._response, name) - - @property - async def pages(self) -> AsyncIterator[service.ListReusableConfigsResponse]: - yield self._response - while self._response.next_page_token: - self._request.page_token = self._response.next_page_token - self._response = await self._method(self._request, metadata=self._metadata) - yield self._response - def __aiter__(self) -> AsyncIterator[resources.ReusableConfig]: - async def async_generator(): - async for page in self.pages: - for response in page.reusable_configs: - yield response - - return async_generator() - - def __repr__(self) -> str: - return '{0}<{1!r}>'.format(self.__class__.__name__, self._response) diff --git a/owl-bot-staging/v1beta1/google/cloud/security/privateca_v1beta1/services/certificate_authority_service/transports/__init__.py b/owl-bot-staging/v1beta1/google/cloud/security/privateca_v1beta1/services/certificate_authority_service/transports/__init__.py deleted file mode 100644 index 9564748..0000000 --- a/owl-bot-staging/v1beta1/google/cloud/security/privateca_v1beta1/services/certificate_authority_service/transports/__init__.py +++ /dev/null @@ -1,33 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -from collections import OrderedDict -from typing import Dict, Type - -from .base import CertificateAuthorityServiceTransport -from .grpc import CertificateAuthorityServiceGrpcTransport -from .grpc_asyncio import CertificateAuthorityServiceGrpcAsyncIOTransport - - -# Compile a registry of transports. -_transport_registry = OrderedDict() # type: Dict[str, Type[CertificateAuthorityServiceTransport]] -_transport_registry['grpc'] = CertificateAuthorityServiceGrpcTransport -_transport_registry['grpc_asyncio'] = CertificateAuthorityServiceGrpcAsyncIOTransport - -__all__ = ( - 'CertificateAuthorityServiceTransport', - 'CertificateAuthorityServiceGrpcTransport', - 'CertificateAuthorityServiceGrpcAsyncIOTransport', -) diff --git a/owl-bot-staging/v1beta1/google/cloud/security/privateca_v1beta1/services/certificate_authority_service/transports/base.py b/owl-bot-staging/v1beta1/google/cloud/security/privateca_v1beta1/services/certificate_authority_service/transports/base.py deleted file mode 100644 index a1f05ab..0000000 --- a/owl-bot-staging/v1beta1/google/cloud/security/privateca_v1beta1/services/certificate_authority_service/transports/base.py +++ /dev/null @@ -1,422 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -import abc -from typing import Awaitable, Callable, Dict, Optional, Sequence, Union - -from google.cloud.security.privateca_v1beta1 import gapic_version as package_version - -import google.auth # type: ignore -import google.api_core -from google.api_core import exceptions as core_exceptions -from google.api_core import gapic_v1 -from google.api_core import retry as retries -from google.api_core import operations_v1 -from google.auth import credentials as ga_credentials # type: ignore -from google.oauth2 import service_account # 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 # type: ignore - -DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo(gapic_version=package_version.__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 = DEFAULT_HOST, - credentials: Optional[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, - always_use_jwt_access: Optional[bool] = False, - api_audience: Optional[str] = None, - **kwargs, - ) -> None: - """Instantiate the transport. - - Args: - 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 - are specified, the client will attempt to ascertain the - credentials from the environment. - 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. - 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): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - always_use_jwt_access (Optional[bool]): Whether self signed JWT should - be used for service account credentials. - """ - - scopes_kwargs = {"scopes": scopes, "default_scopes": self.AUTH_SCOPES} - - # Save the scopes. - self._scopes = scopes - - # If no credentials are provided, then determine the appropriate - # defaults. - if credentials and credentials_file: - raise core_exceptions.DuplicateCredentialArgs("'credentials_file' and 'credentials' are mutually exclusive") - - if credentials_file is not None: - credentials, _ = google.auth.load_credentials_from_file( - credentials_file, - **scopes_kwargs, - quota_project_id=quota_project_id - ) - elif credentials is None: - credentials, _ = google.auth.default(**scopes_kwargs, quota_project_id=quota_project_id) - # Don't apply audience if the credentials file passed from user. - if hasattr(credentials, "with_gdch_audience"): - credentials = credentials.with_gdch_audience(api_audience if api_audience else host) - - # If the credentials are service account credentials, then always try to use self signed JWT. - if always_use_jwt_access and isinstance(credentials, service_account.Credentials) and hasattr(service_account.Credentials, "with_always_use_jwt_access"): - credentials = credentials.with_always_use_jwt_access(True) - - # Save the credentials. - self._credentials = credentials - - # Save the hostname. Default to port 443 (HTTPS) if none is specified. - if ':' not in host: - host += ':443' - self._host = host - - def _prep_wrapped_messages(self, client_info): - # Precompute the wrapped methods. - self._wrapped_methods = { - self.create_certificate: gapic_v1.method.wrap_method( - self.create_certificate, - default_timeout=None, - client_info=client_info, - ), - self.get_certificate: gapic_v1.method.wrap_method( - self.get_certificate, - default_timeout=None, - client_info=client_info, - ), - self.list_certificates: gapic_v1.method.wrap_method( - self.list_certificates, - default_timeout=None, - client_info=client_info, - ), - self.revoke_certificate: gapic_v1.method.wrap_method( - self.revoke_certificate, - default_timeout=None, - client_info=client_info, - ), - self.update_certificate: gapic_v1.method.wrap_method( - self.update_certificate, - default_timeout=None, - client_info=client_info, - ), - self.activate_certificate_authority: gapic_v1.method.wrap_method( - self.activate_certificate_authority, - default_timeout=None, - client_info=client_info, - ), - self.create_certificate_authority: gapic_v1.method.wrap_method( - self.create_certificate_authority, - default_timeout=None, - client_info=client_info, - ), - self.disable_certificate_authority: gapic_v1.method.wrap_method( - self.disable_certificate_authority, - default_timeout=None, - client_info=client_info, - ), - self.enable_certificate_authority: gapic_v1.method.wrap_method( - self.enable_certificate_authority, - default_timeout=None, - client_info=client_info, - ), - self.fetch_certificate_authority_csr: gapic_v1.method.wrap_method( - self.fetch_certificate_authority_csr, - default_timeout=None, - client_info=client_info, - ), - self.get_certificate_authority: gapic_v1.method.wrap_method( - self.get_certificate_authority, - default_timeout=None, - client_info=client_info, - ), - self.list_certificate_authorities: gapic_v1.method.wrap_method( - self.list_certificate_authorities, - default_timeout=None, - client_info=client_info, - ), - self.restore_certificate_authority: gapic_v1.method.wrap_method( - self.restore_certificate_authority, - default_timeout=None, - client_info=client_info, - ), - self.schedule_delete_certificate_authority: gapic_v1.method.wrap_method( - self.schedule_delete_certificate_authority, - default_timeout=None, - client_info=client_info, - ), - self.update_certificate_authority: gapic_v1.method.wrap_method( - self.update_certificate_authority, - default_timeout=None, - client_info=client_info, - ), - self.get_certificate_revocation_list: gapic_v1.method.wrap_method( - self.get_certificate_revocation_list, - default_timeout=None, - client_info=client_info, - ), - self.list_certificate_revocation_lists: gapic_v1.method.wrap_method( - self.list_certificate_revocation_lists, - default_timeout=None, - client_info=client_info, - ), - self.update_certificate_revocation_list: gapic_v1.method.wrap_method( - self.update_certificate_revocation_list, - default_timeout=None, - client_info=client_info, - ), - self.get_reusable_config: gapic_v1.method.wrap_method( - self.get_reusable_config, - default_timeout=None, - client_info=client_info, - ), - self.list_reusable_configs: gapic_v1.method.wrap_method( - self.list_reusable_configs, - default_timeout=None, - client_info=client_info, - ), - } - - def close(self): - """Closes resources associated with the transport. - - .. warning:: - Only call this method if the transport is NOT shared - with other clients - this may cause errors in other clients! - """ - raise NotImplementedError() - - @property - def operations_client(self): - """Return the client designed to process long-running operations.""" - raise NotImplementedError() - - @property - def create_certificate(self) -> Callable[ - [service.CreateCertificateRequest], - Union[ - resources.Certificate, - Awaitable[resources.Certificate] - ]]: - raise NotImplementedError() - - @property - def get_certificate(self) -> Callable[ - [service.GetCertificateRequest], - Union[ - resources.Certificate, - Awaitable[resources.Certificate] - ]]: - raise NotImplementedError() - - @property - def list_certificates(self) -> Callable[ - [service.ListCertificatesRequest], - Union[ - service.ListCertificatesResponse, - Awaitable[service.ListCertificatesResponse] - ]]: - raise NotImplementedError() - - @property - def revoke_certificate(self) -> Callable[ - [service.RevokeCertificateRequest], - Union[ - resources.Certificate, - Awaitable[resources.Certificate] - ]]: - raise NotImplementedError() - - @property - def update_certificate(self) -> Callable[ - [service.UpdateCertificateRequest], - Union[ - resources.Certificate, - Awaitable[resources.Certificate] - ]]: - raise NotImplementedError() - - @property - def activate_certificate_authority(self) -> Callable[ - [service.ActivateCertificateAuthorityRequest], - Union[ - operations_pb2.Operation, - Awaitable[operations_pb2.Operation] - ]]: - raise NotImplementedError() - - @property - def create_certificate_authority(self) -> Callable[ - [service.CreateCertificateAuthorityRequest], - Union[ - operations_pb2.Operation, - Awaitable[operations_pb2.Operation] - ]]: - raise NotImplementedError() - - @property - def disable_certificate_authority(self) -> Callable[ - [service.DisableCertificateAuthorityRequest], - Union[ - operations_pb2.Operation, - Awaitable[operations_pb2.Operation] - ]]: - raise NotImplementedError() - - @property - def enable_certificate_authority(self) -> Callable[ - [service.EnableCertificateAuthorityRequest], - Union[ - operations_pb2.Operation, - Awaitable[operations_pb2.Operation] - ]]: - raise NotImplementedError() - - @property - def fetch_certificate_authority_csr(self) -> Callable[ - [service.FetchCertificateAuthorityCsrRequest], - Union[ - service.FetchCertificateAuthorityCsrResponse, - Awaitable[service.FetchCertificateAuthorityCsrResponse] - ]]: - raise NotImplementedError() - - @property - def get_certificate_authority(self) -> Callable[ - [service.GetCertificateAuthorityRequest], - Union[ - resources.CertificateAuthority, - Awaitable[resources.CertificateAuthority] - ]]: - raise NotImplementedError() - - @property - def list_certificate_authorities(self) -> Callable[ - [service.ListCertificateAuthoritiesRequest], - Union[ - service.ListCertificateAuthoritiesResponse, - Awaitable[service.ListCertificateAuthoritiesResponse] - ]]: - raise NotImplementedError() - - @property - def restore_certificate_authority(self) -> Callable[ - [service.RestoreCertificateAuthorityRequest], - Union[ - operations_pb2.Operation, - Awaitable[operations_pb2.Operation] - ]]: - raise NotImplementedError() - - @property - def schedule_delete_certificate_authority(self) -> Callable[ - [service.ScheduleDeleteCertificateAuthorityRequest], - Union[ - operations_pb2.Operation, - Awaitable[operations_pb2.Operation] - ]]: - raise NotImplementedError() - - @property - def update_certificate_authority(self) -> Callable[ - [service.UpdateCertificateAuthorityRequest], - Union[ - operations_pb2.Operation, - Awaitable[operations_pb2.Operation] - ]]: - raise NotImplementedError() - - @property - def get_certificate_revocation_list(self) -> Callable[ - [service.GetCertificateRevocationListRequest], - Union[ - resources.CertificateRevocationList, - Awaitable[resources.CertificateRevocationList] - ]]: - raise NotImplementedError() - - @property - def list_certificate_revocation_lists(self) -> Callable[ - [service.ListCertificateRevocationListsRequest], - Union[ - service.ListCertificateRevocationListsResponse, - Awaitable[service.ListCertificateRevocationListsResponse] - ]]: - raise NotImplementedError() - - @property - def update_certificate_revocation_list(self) -> Callable[ - [service.UpdateCertificateRevocationListRequest], - Union[ - operations_pb2.Operation, - Awaitable[operations_pb2.Operation] - ]]: - raise NotImplementedError() - - @property - def get_reusable_config(self) -> Callable[ - [service.GetReusableConfigRequest], - Union[ - resources.ReusableConfig, - Awaitable[resources.ReusableConfig] - ]]: - raise NotImplementedError() - - @property - def list_reusable_configs(self) -> Callable[ - [service.ListReusableConfigsRequest], - Union[ - service.ListReusableConfigsResponse, - Awaitable[service.ListReusableConfigsResponse] - ]]: - raise NotImplementedError() - - @property - def kind(self) -> str: - raise NotImplementedError() - - -__all__ = ( - 'CertificateAuthorityServiceTransport', -) diff --git a/owl-bot-staging/v1beta1/google/cloud/security/privateca_v1beta1/services/certificate_authority_service/transports/grpc.py b/owl-bot-staging/v1beta1/google/cloud/security/privateca_v1beta1/services/certificate_authority_service/transports/grpc.py deleted file mode 100644 index 33cbca8..0000000 --- a/owl-bot-staging/v1beta1/google/cloud/security/privateca_v1beta1/services/certificate_authority_service/transports/grpc.py +++ /dev/null @@ -1,830 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -import warnings -from typing import Callable, Dict, Optional, Sequence, Tuple, Union - -from google.api_core import grpc_helpers -from google.api_core import operations_v1 -from google.api_core import gapic_v1 -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 # type: ignore -from .base import CertificateAuthorityServiceTransport, DEFAULT_CLIENT_INFO - - -class CertificateAuthorityServiceGrpcTransport(CertificateAuthorityServiceTransport): - """gRPC backend transport for CertificateAuthorityService. - - [Certificate Authority - Service][google.cloud.security.privateca.v1beta1.CertificateAuthorityService] - manages private certificate authorities and issued certificates. - - This class defines the same methods as the primary client, so the - primary client can load the underlying transport implementation - and call it. - - It sends protocol buffers over the wire using gRPC (which is built on - top of HTTP/2); the ``grpcio`` package must be installed. - """ - _stubs: Dict[str, Callable] - - def __init__(self, *, - host: str = 'privateca.googleapis.com', - credentials: Optional[ga_credentials.Credentials] = None, - credentials_file: Optional[str] = None, - scopes: Optional[Sequence[str]] = None, - channel: Optional[grpc.Channel] = None, - api_mtls_endpoint: Optional[str] = None, - client_cert_source: Optional[Callable[[], Tuple[bytes, bytes]]] = None, - ssl_channel_credentials: Optional[grpc.ChannelCredentials] = None, - client_cert_source_for_mtls: Optional[Callable[[], Tuple[bytes, bytes]]] = None, - quota_project_id: Optional[str] = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - always_use_jwt_access: Optional[bool] = False, - api_audience: Optional[str] = None, - ) -> None: - """Instantiate the transport. - - Args: - 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 - are specified, the client will attempt to ascertain the - credentials from the environment. - This argument is ignored if ``channel`` is provided. - credentials_file (Optional[str]): A file with credentials that can - be loaded with :func:`google.auth.load_credentials_from_file`. - This argument is ignored if ``channel`` is provided. - scopes (Optional(Sequence[str])): A list of scopes. This argument is - ignored if ``channel`` is provided. - channel (Optional[grpc.Channel]): A ``Channel`` instance through - which to make calls. - api_mtls_endpoint (Optional[str]): Deprecated. The mutual TLS endpoint. - If provided, it overrides the ``host`` argument and tries to create - a mutual TLS channel with client SSL credentials from - ``client_cert_source`` or application default SSL credentials. - client_cert_source (Optional[Callable[[], Tuple[bytes, bytes]]]): - Deprecated. A callback to provide client SSL certificate bytes and - private key bytes, both in PEM format. It is ignored if - ``api_mtls_endpoint`` is None. - ssl_channel_credentials (grpc.ChannelCredentials): SSL credentials - for the grpc channel. It is ignored if ``channel`` is provided. - client_cert_source_for_mtls (Optional[Callable[[], Tuple[bytes, bytes]]]): - A callback to provide client certificate bytes and private key bytes, - both in PEM format. It is used to configure a mutual TLS channel. It is - ignored if ``channel`` or ``ssl_channel_credentials`` is provided. - quota_project_id (Optional[str]): An optional project to use for billing - and quota. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - always_use_jwt_access (Optional[bool]): Whether self signed JWT should - be used for service account credentials. - - Raises: - google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport - creation failed for any reason. - google.api_core.exceptions.DuplicateCredentialArgs: If both ``credentials`` - and ``credentials_file`` are passed. - """ - self._grpc_channel = None - self._ssl_channel_credentials = ssl_channel_credentials - self._stubs: Dict[str, Callable] = {} - self._operations_client: Optional[operations_v1.OperationsClient] = None - - if api_mtls_endpoint: - warnings.warn("api_mtls_endpoint is deprecated", DeprecationWarning) - if client_cert_source: - warnings.warn("client_cert_source is deprecated", DeprecationWarning) - - if channel: - # Ignore credentials if a channel was passed. - credentials = False - # 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 - - # Create SSL credentials with client_cert_source or application - # default SSL credentials. - if client_cert_source: - cert, key = client_cert_source() - self._ssl_channel_credentials = grpc.ssl_channel_credentials( - certificate_chain=cert, private_key=key - ) - else: - self._ssl_channel_credentials = SslCredentials().ssl_credentials - - else: - if client_cert_source_for_mtls and not ssl_channel_credentials: - cert, key = client_cert_source_for_mtls() - self._ssl_channel_credentials = grpc.ssl_channel_credentials( - certificate_chain=cert, private_key=key - ) - - # The base transport sets the host, credentials and scopes - super().__init__( - host=host, - credentials=credentials, - credentials_file=credentials_file, - scopes=scopes, - quota_project_id=quota_project_id, - client_info=client_info, - always_use_jwt_access=always_use_jwt_access, - api_audience=api_audience, - ) - - if not self._grpc_channel: - self._grpc_channel = type(self).create_channel( - self._host, - # use the credentials which are saved - credentials=self._credentials, - # Set ``credentials_file`` to ``None`` here as - # the credentials that we saved earlier should be used. - credentials_file=None, - scopes=self._scopes, - ssl_credentials=self._ssl_channel_credentials, - quota_project_id=quota_project_id, - options=[ - ("grpc.max_send_message_length", -1), - ("grpc.max_receive_message_length", -1), - ], - ) - - # Wrap messages. This must be done after self._grpc_channel exists - self._prep_wrapped_messages(client_info) - - @classmethod - def create_channel(cls, - host: str = 'privateca.googleapis.com', - credentials: Optional[ga_credentials.Credentials] = None, - credentials_file: Optional[str] = None, - scopes: Optional[Sequence[str]] = None, - quota_project_id: Optional[str] = None, - **kwargs) -> grpc.Channel: - """Create and return a gRPC channel object. - Args: - host (Optional[str]): The host for the channel to use. - credentials (Optional[~.Credentials]): The - authorization credentials to attach to requests. These - credentials identify this application to the service. If - none are specified, the client will attempt to ascertain - the credentials from the environment. - 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. - scopes (Optional[Sequence[str]]): A optional list of scopes needed for this - service. These are only used when credentials are not specified and - are passed to :func:`google.auth.default`. - quota_project_id (Optional[str]): An optional project to use for billing - and quota. - kwargs (Optional[dict]): Keyword arguments, which are passed to the - channel creation. - Returns: - grpc.Channel: A gRPC channel object. - - Raises: - google.api_core.exceptions.DuplicateCredentialArgs: If both ``credentials`` - and ``credentials_file`` are passed. - """ - - return grpc_helpers.create_channel( - host, - credentials=credentials, - credentials_file=credentials_file, - quota_project_id=quota_project_id, - default_scopes=cls.AUTH_SCOPES, - scopes=scopes, - default_host=cls.DEFAULT_HOST, - **kwargs - ) - - @property - def grpc_channel(self) -> grpc.Channel: - """Return the channel designed to connect to this service. - """ - return self._grpc_channel - - @property - def operations_client(self) -> operations_v1.OperationsClient: - """Create the client designed to process long-running operations. - - This property caches on the instance; repeated calls return the same - client. - """ - # Quick check: Only create a new client if we do not already have one. - if self._operations_client is None: - self._operations_client = operations_v1.OperationsClient( - self.grpc_channel - ) - - # Return the client from cache. - return self._operations_client - - @property - def create_certificate(self) -> Callable[ - [service.CreateCertificateRequest], - resources.Certificate]: - r"""Return a callable for the create certificate method over gRPC. - - Create a new - [Certificate][google.cloud.security.privateca.v1beta1.Certificate] - in a given Project, Location from a particular - [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority]. - - Returns: - Callable[[~.CreateCertificateRequest], - ~.Certificate]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if 'create_certificate' not in self._stubs: - self._stubs['create_certificate'] = self.grpc_channel.unary_unary( - '/google.cloud.security.privateca.v1beta1.CertificateAuthorityService/CreateCertificate', - request_serializer=service.CreateCertificateRequest.serialize, - response_deserializer=resources.Certificate.deserialize, - ) - return self._stubs['create_certificate'] - - @property - def get_certificate(self) -> Callable[ - [service.GetCertificateRequest], - resources.Certificate]: - r"""Return a callable for the get certificate method over gRPC. - - Returns a - [Certificate][google.cloud.security.privateca.v1beta1.Certificate]. - - Returns: - Callable[[~.GetCertificateRequest], - ~.Certificate]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if 'get_certificate' not in self._stubs: - self._stubs['get_certificate'] = self.grpc_channel.unary_unary( - '/google.cloud.security.privateca.v1beta1.CertificateAuthorityService/GetCertificate', - request_serializer=service.GetCertificateRequest.serialize, - response_deserializer=resources.Certificate.deserialize, - ) - return self._stubs['get_certificate'] - - @property - def list_certificates(self) -> Callable[ - [service.ListCertificatesRequest], - service.ListCertificatesResponse]: - r"""Return a callable for the list certificates method over gRPC. - - Lists - [Certificates][google.cloud.security.privateca.v1beta1.Certificate]. - - Returns: - Callable[[~.ListCertificatesRequest], - ~.ListCertificatesResponse]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if 'list_certificates' not in self._stubs: - self._stubs['list_certificates'] = self.grpc_channel.unary_unary( - '/google.cloud.security.privateca.v1beta1.CertificateAuthorityService/ListCertificates', - request_serializer=service.ListCertificatesRequest.serialize, - response_deserializer=service.ListCertificatesResponse.deserialize, - ) - return self._stubs['list_certificates'] - - @property - def revoke_certificate(self) -> Callable[ - [service.RevokeCertificateRequest], - resources.Certificate]: - r"""Return a callable for the revoke certificate method over gRPC. - - Revoke a - [Certificate][google.cloud.security.privateca.v1beta1.Certificate]. - - Returns: - Callable[[~.RevokeCertificateRequest], - ~.Certificate]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if 'revoke_certificate' not in self._stubs: - self._stubs['revoke_certificate'] = self.grpc_channel.unary_unary( - '/google.cloud.security.privateca.v1beta1.CertificateAuthorityService/RevokeCertificate', - request_serializer=service.RevokeCertificateRequest.serialize, - response_deserializer=resources.Certificate.deserialize, - ) - return self._stubs['revoke_certificate'] - - @property - def update_certificate(self) -> Callable[ - [service.UpdateCertificateRequest], - resources.Certificate]: - r"""Return a callable for the update certificate method over gRPC. - - Update a - [Certificate][google.cloud.security.privateca.v1beta1.Certificate]. - Currently, the only field you can update is the - [labels][google.cloud.security.privateca.v1beta1.Certificate.labels] - field. - - Returns: - Callable[[~.UpdateCertificateRequest], - ~.Certificate]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if 'update_certificate' not in self._stubs: - self._stubs['update_certificate'] = self.grpc_channel.unary_unary( - '/google.cloud.security.privateca.v1beta1.CertificateAuthorityService/UpdateCertificate', - request_serializer=service.UpdateCertificateRequest.serialize, - response_deserializer=resources.Certificate.deserialize, - ) - return self._stubs['update_certificate'] - - @property - def activate_certificate_authority(self) -> Callable[ - [service.ActivateCertificateAuthorityRequest], - operations_pb2.Operation]: - r"""Return a callable for the activate certificate authority method over gRPC. - - Activate a - [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority] - that is in state - [PENDING_ACTIVATION][google.cloud.security.privateca.v1beta1.CertificateAuthority.State.PENDING_ACTIVATION] - and is of type - [SUBORDINATE][google.cloud.security.privateca.v1beta1.CertificateAuthority.Type.SUBORDINATE]. - After the parent Certificate Authority signs a certificate - signing request from - [FetchCertificateAuthorityCsr][google.cloud.security.privateca.v1beta1.CertificateAuthorityService.FetchCertificateAuthorityCsr], - this method can complete the activation process. - - Returns: - Callable[[~.ActivateCertificateAuthorityRequest], - ~.Operation]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if 'activate_certificate_authority' not in self._stubs: - self._stubs['activate_certificate_authority'] = self.grpc_channel.unary_unary( - '/google.cloud.security.privateca.v1beta1.CertificateAuthorityService/ActivateCertificateAuthority', - request_serializer=service.ActivateCertificateAuthorityRequest.serialize, - response_deserializer=operations_pb2.Operation.FromString, - ) - return self._stubs['activate_certificate_authority'] - - @property - def create_certificate_authority(self) -> Callable[ - [service.CreateCertificateAuthorityRequest], - operations_pb2.Operation]: - r"""Return a callable for the create certificate authority method over gRPC. - - Create a new - [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority] - in a given Project and Location. - - Returns: - Callable[[~.CreateCertificateAuthorityRequest], - ~.Operation]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if 'create_certificate_authority' not in self._stubs: - 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_pb2.Operation.FromString, - ) - return self._stubs['create_certificate_authority'] - - @property - def disable_certificate_authority(self) -> Callable[ - [service.DisableCertificateAuthorityRequest], - operations_pb2.Operation]: - r"""Return a callable for the disable certificate authority method over gRPC. - - Disable a - [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority]. - - Returns: - Callable[[~.DisableCertificateAuthorityRequest], - ~.Operation]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if 'disable_certificate_authority' not in self._stubs: - self._stubs['disable_certificate_authority'] = self.grpc_channel.unary_unary( - '/google.cloud.security.privateca.v1beta1.CertificateAuthorityService/DisableCertificateAuthority', - request_serializer=service.DisableCertificateAuthorityRequest.serialize, - response_deserializer=operations_pb2.Operation.FromString, - ) - return self._stubs['disable_certificate_authority'] - - @property - def enable_certificate_authority(self) -> Callable[ - [service.EnableCertificateAuthorityRequest], - operations_pb2.Operation]: - r"""Return a callable for the enable certificate authority method over gRPC. - - Enable a - [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority]. - - Returns: - Callable[[~.EnableCertificateAuthorityRequest], - ~.Operation]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if 'enable_certificate_authority' not in self._stubs: - 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_pb2.Operation.FromString, - ) - return self._stubs['enable_certificate_authority'] - - @property - def fetch_certificate_authority_csr(self) -> Callable[ - [service.FetchCertificateAuthorityCsrRequest], - service.FetchCertificateAuthorityCsrResponse]: - r"""Return a callable for the fetch certificate authority - csr method over gRPC. - - Fetch a certificate signing request (CSR) from a - [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority] - that is in state - [PENDING_ACTIVATION][google.cloud.security.privateca.v1beta1.CertificateAuthority.State.PENDING_ACTIVATION] - and is of type - [SUBORDINATE][google.cloud.security.privateca.v1beta1.CertificateAuthority.Type.SUBORDINATE]. - The CSR must then be signed by the desired parent Certificate - Authority, which could be another - [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority] - resource, or could be an on-prem certificate authority. See also - [ActivateCertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthorityService.ActivateCertificateAuthority]. - - Returns: - Callable[[~.FetchCertificateAuthorityCsrRequest], - ~.FetchCertificateAuthorityCsrResponse]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if 'fetch_certificate_authority_csr' not in self._stubs: - self._stubs['fetch_certificate_authority_csr'] = self.grpc_channel.unary_unary( - '/google.cloud.security.privateca.v1beta1.CertificateAuthorityService/FetchCertificateAuthorityCsr', - request_serializer=service.FetchCertificateAuthorityCsrRequest.serialize, - response_deserializer=service.FetchCertificateAuthorityCsrResponse.deserialize, - ) - return self._stubs['fetch_certificate_authority_csr'] - - @property - def get_certificate_authority(self) -> Callable[ - [service.GetCertificateAuthorityRequest], - resources.CertificateAuthority]: - r"""Return a callable for the get certificate authority method over gRPC. - - Returns a - [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority]. - - Returns: - Callable[[~.GetCertificateAuthorityRequest], - ~.CertificateAuthority]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if 'get_certificate_authority' not in self._stubs: - self._stubs['get_certificate_authority'] = self.grpc_channel.unary_unary( - '/google.cloud.security.privateca.v1beta1.CertificateAuthorityService/GetCertificateAuthority', - request_serializer=service.GetCertificateAuthorityRequest.serialize, - response_deserializer=resources.CertificateAuthority.deserialize, - ) - return self._stubs['get_certificate_authority'] - - @property - def list_certificate_authorities(self) -> Callable[ - [service.ListCertificateAuthoritiesRequest], - service.ListCertificateAuthoritiesResponse]: - r"""Return a callable for the list certificate authorities method over gRPC. - - Lists - [CertificateAuthorities][google.cloud.security.privateca.v1beta1.CertificateAuthority]. - - Returns: - Callable[[~.ListCertificateAuthoritiesRequest], - ~.ListCertificateAuthoritiesResponse]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if 'list_certificate_authorities' not in self._stubs: - self._stubs['list_certificate_authorities'] = self.grpc_channel.unary_unary( - '/google.cloud.security.privateca.v1beta1.CertificateAuthorityService/ListCertificateAuthorities', - request_serializer=service.ListCertificateAuthoritiesRequest.serialize, - response_deserializer=service.ListCertificateAuthoritiesResponse.deserialize, - ) - return self._stubs['list_certificate_authorities'] - - @property - def restore_certificate_authority(self) -> Callable[ - [service.RestoreCertificateAuthorityRequest], - operations_pb2.Operation]: - r"""Return a callable for the restore certificate authority method over gRPC. - - Restore a - [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority] - that is scheduled for deletion. - - Returns: - Callable[[~.RestoreCertificateAuthorityRequest], - ~.Operation]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if 'restore_certificate_authority' not in self._stubs: - self._stubs['restore_certificate_authority'] = self.grpc_channel.unary_unary( - '/google.cloud.security.privateca.v1beta1.CertificateAuthorityService/RestoreCertificateAuthority', - request_serializer=service.RestoreCertificateAuthorityRequest.serialize, - response_deserializer=operations_pb2.Operation.FromString, - ) - return self._stubs['restore_certificate_authority'] - - @property - def schedule_delete_certificate_authority(self) -> Callable[ - [service.ScheduleDeleteCertificateAuthorityRequest], - operations_pb2.Operation]: - r"""Return a callable for the schedule delete certificate - authority method over gRPC. - - Schedule a - [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority] - for deletion. - - Returns: - Callable[[~.ScheduleDeleteCertificateAuthorityRequest], - ~.Operation]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if 'schedule_delete_certificate_authority' not in self._stubs: - self._stubs['schedule_delete_certificate_authority'] = self.grpc_channel.unary_unary( - '/google.cloud.security.privateca.v1beta1.CertificateAuthorityService/ScheduleDeleteCertificateAuthority', - request_serializer=service.ScheduleDeleteCertificateAuthorityRequest.serialize, - response_deserializer=operations_pb2.Operation.FromString, - ) - return self._stubs['schedule_delete_certificate_authority'] - - @property - def update_certificate_authority(self) -> Callable[ - [service.UpdateCertificateAuthorityRequest], - operations_pb2.Operation]: - r"""Return a callable for the update certificate authority method over gRPC. - - Update a - [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority]. - - Returns: - Callable[[~.UpdateCertificateAuthorityRequest], - ~.Operation]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if 'update_certificate_authority' not in self._stubs: - 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_pb2.Operation.FromString, - ) - return self._stubs['update_certificate_authority'] - - @property - def get_certificate_revocation_list(self) -> Callable[ - [service.GetCertificateRevocationListRequest], - resources.CertificateRevocationList]: - r"""Return a callable for the get certificate revocation - list method over gRPC. - - Returns a - [CertificateRevocationList][google.cloud.security.privateca.v1beta1.CertificateRevocationList]. - - Returns: - Callable[[~.GetCertificateRevocationListRequest], - ~.CertificateRevocationList]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if 'get_certificate_revocation_list' not in self._stubs: - self._stubs['get_certificate_revocation_list'] = self.grpc_channel.unary_unary( - '/google.cloud.security.privateca.v1beta1.CertificateAuthorityService/GetCertificateRevocationList', - request_serializer=service.GetCertificateRevocationListRequest.serialize, - response_deserializer=resources.CertificateRevocationList.deserialize, - ) - return self._stubs['get_certificate_revocation_list'] - - @property - def list_certificate_revocation_lists(self) -> Callable[ - [service.ListCertificateRevocationListsRequest], - service.ListCertificateRevocationListsResponse]: - r"""Return a callable for the list certificate revocation - lists method over gRPC. - - Lists - [CertificateRevocationLists][google.cloud.security.privateca.v1beta1.CertificateRevocationList]. - - Returns: - Callable[[~.ListCertificateRevocationListsRequest], - ~.ListCertificateRevocationListsResponse]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if 'list_certificate_revocation_lists' not in self._stubs: - self._stubs['list_certificate_revocation_lists'] = self.grpc_channel.unary_unary( - '/google.cloud.security.privateca.v1beta1.CertificateAuthorityService/ListCertificateRevocationLists', - request_serializer=service.ListCertificateRevocationListsRequest.serialize, - response_deserializer=service.ListCertificateRevocationListsResponse.deserialize, - ) - return self._stubs['list_certificate_revocation_lists'] - - @property - def update_certificate_revocation_list(self) -> Callable[ - [service.UpdateCertificateRevocationListRequest], - operations_pb2.Operation]: - r"""Return a callable for the update certificate revocation - list method over gRPC. - - Update a - [CertificateRevocationList][google.cloud.security.privateca.v1beta1.CertificateRevocationList]. - - Returns: - Callable[[~.UpdateCertificateRevocationListRequest], - ~.Operation]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if 'update_certificate_revocation_list' not in self._stubs: - self._stubs['update_certificate_revocation_list'] = self.grpc_channel.unary_unary( - '/google.cloud.security.privateca.v1beta1.CertificateAuthorityService/UpdateCertificateRevocationList', - request_serializer=service.UpdateCertificateRevocationListRequest.serialize, - response_deserializer=operations_pb2.Operation.FromString, - ) - return self._stubs['update_certificate_revocation_list'] - - @property - def get_reusable_config(self) -> Callable[ - [service.GetReusableConfigRequest], - resources.ReusableConfig]: - r"""Return a callable for the get reusable config method over gRPC. - - Returns a - [ReusableConfig][google.cloud.security.privateca.v1beta1.ReusableConfig]. - - Returns: - Callable[[~.GetReusableConfigRequest], - ~.ReusableConfig]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if 'get_reusable_config' not in self._stubs: - self._stubs['get_reusable_config'] = self.grpc_channel.unary_unary( - '/google.cloud.security.privateca.v1beta1.CertificateAuthorityService/GetReusableConfig', - request_serializer=service.GetReusableConfigRequest.serialize, - response_deserializer=resources.ReusableConfig.deserialize, - ) - return self._stubs['get_reusable_config'] - - @property - def list_reusable_configs(self) -> Callable[ - [service.ListReusableConfigsRequest], - service.ListReusableConfigsResponse]: - r"""Return a callable for the list reusable configs method over gRPC. - - Lists - [ReusableConfigs][google.cloud.security.privateca.v1beta1.ReusableConfig]. - - Returns: - Callable[[~.ListReusableConfigsRequest], - ~.ListReusableConfigsResponse]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if 'list_reusable_configs' not in self._stubs: - self._stubs['list_reusable_configs'] = self.grpc_channel.unary_unary( - '/google.cloud.security.privateca.v1beta1.CertificateAuthorityService/ListReusableConfigs', - request_serializer=service.ListReusableConfigsRequest.serialize, - response_deserializer=service.ListReusableConfigsResponse.deserialize, - ) - return self._stubs['list_reusable_configs'] - - def close(self): - self.grpc_channel.close() - - @property - def kind(self) -> str: - return "grpc" - - -__all__ = ( - 'CertificateAuthorityServiceGrpcTransport', -) diff --git a/owl-bot-staging/v1beta1/google/cloud/security/privateca_v1beta1/services/certificate_authority_service/transports/grpc_asyncio.py b/owl-bot-staging/v1beta1/google/cloud/security/privateca_v1beta1/services/certificate_authority_service/transports/grpc_asyncio.py deleted file mode 100644 index 521538c..0000000 --- a/owl-bot-staging/v1beta1/google/cloud/security/privateca_v1beta1/services/certificate_authority_service/transports/grpc_asyncio.py +++ /dev/null @@ -1,829 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -import warnings -from typing import Awaitable, Callable, Dict, Optional, Sequence, Tuple, Union - -from google.api_core import gapic_v1 -from google.api_core import grpc_helpers_async -from google.api_core import operations_v1 -from google.auth import credentials as ga_credentials # type: ignore -from google.auth.transport.grpc import SslCredentials # type: ignore - -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 # type: ignore -from .base import CertificateAuthorityServiceTransport, DEFAULT_CLIENT_INFO -from .grpc import CertificateAuthorityServiceGrpcTransport - - -class CertificateAuthorityServiceGrpcAsyncIOTransport(CertificateAuthorityServiceTransport): - """gRPC AsyncIO backend transport for CertificateAuthorityService. - - [Certificate Authority - Service][google.cloud.security.privateca.v1beta1.CertificateAuthorityService] - manages private certificate authorities and issued certificates. - - This class defines the same methods as the primary client, so the - primary client can load the underlying transport implementation - and call it. - - It sends protocol buffers over the wire using gRPC (which is built on - top of HTTP/2); the ``grpcio`` package must be installed. - """ - - _grpc_channel: aio.Channel - _stubs: Dict[str, Callable] = {} - - @classmethod - def create_channel(cls, - host: str = 'privateca.googleapis.com', - credentials: Optional[ga_credentials.Credentials] = None, - credentials_file: Optional[str] = None, - scopes: Optional[Sequence[str]] = None, - quota_project_id: Optional[str] = None, - **kwargs) -> aio.Channel: - """Create and return a gRPC AsyncIO channel object. - Args: - host (Optional[str]): The host for the channel to use. - credentials (Optional[~.Credentials]): The - authorization credentials to attach to requests. These - credentials identify this application to the service. If - none are specified, the client will attempt to ascertain - the credentials from the environment. - credentials_file (Optional[str]): A file with credentials that can - be loaded with :func:`google.auth.load_credentials_from_file`. - This argument is ignored if ``channel`` is provided. - scopes (Optional[Sequence[str]]): A optional list of scopes needed for this - service. These are only used when credentials are not specified and - are passed to :func:`google.auth.default`. - quota_project_id (Optional[str]): An optional project to use for billing - and quota. - kwargs (Optional[dict]): Keyword arguments, which are passed to the - channel creation. - Returns: - aio.Channel: A gRPC AsyncIO channel object. - """ - - return grpc_helpers_async.create_channel( - host, - credentials=credentials, - credentials_file=credentials_file, - quota_project_id=quota_project_id, - default_scopes=cls.AUTH_SCOPES, - scopes=scopes, - default_host=cls.DEFAULT_HOST, - **kwargs - ) - - def __init__(self, *, - host: str = 'privateca.googleapis.com', - credentials: Optional[ga_credentials.Credentials] = None, - credentials_file: Optional[str] = None, - scopes: Optional[Sequence[str]] = None, - channel: Optional[aio.Channel] = None, - api_mtls_endpoint: Optional[str] = None, - client_cert_source: Optional[Callable[[], Tuple[bytes, bytes]]] = None, - ssl_channel_credentials: Optional[grpc.ChannelCredentials] = None, - client_cert_source_for_mtls: Optional[Callable[[], Tuple[bytes, bytes]]] = None, - quota_project_id: Optional[str] = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - always_use_jwt_access: Optional[bool] = False, - api_audience: Optional[str] = None, - ) -> None: - """Instantiate the transport. - - Args: - 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 - are specified, the client will attempt to ascertain the - credentials from the environment. - This argument is ignored if ``channel`` is provided. - credentials_file (Optional[str]): A file with credentials that can - be loaded with :func:`google.auth.load_credentials_from_file`. - This argument is ignored if ``channel`` is provided. - scopes (Optional[Sequence[str]]): A optional list of scopes needed for this - service. These are only used when credentials are not specified and - are passed to :func:`google.auth.default`. - channel (Optional[aio.Channel]): A ``Channel`` instance through - which to make calls. - api_mtls_endpoint (Optional[str]): Deprecated. The mutual TLS endpoint. - If provided, it overrides the ``host`` argument and tries to create - a mutual TLS channel with client SSL credentials from - ``client_cert_source`` or application default SSL credentials. - client_cert_source (Optional[Callable[[], Tuple[bytes, bytes]]]): - Deprecated. A callback to provide client SSL certificate bytes and - private key bytes, both in PEM format. It is ignored if - ``api_mtls_endpoint`` is None. - ssl_channel_credentials (grpc.ChannelCredentials): SSL credentials - for the grpc channel. It is ignored if ``channel`` is provided. - client_cert_source_for_mtls (Optional[Callable[[], Tuple[bytes, bytes]]]): - A callback to provide client certificate bytes and private key bytes, - both in PEM format. It is used to configure a mutual TLS channel. It is - ignored if ``channel`` or ``ssl_channel_credentials`` is provided. - quota_project_id (Optional[str]): An optional project to use for billing - and quota. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - always_use_jwt_access (Optional[bool]): Whether self signed JWT should - be used for service account credentials. - - Raises: - google.auth.exceptions.MutualTlsChannelError: If mutual TLS transport - creation failed for any reason. - google.api_core.exceptions.DuplicateCredentialArgs: If both ``credentials`` - and ``credentials_file`` are passed. - """ - self._grpc_channel = None - self._ssl_channel_credentials = ssl_channel_credentials - self._stubs: Dict[str, Callable] = {} - self._operations_client: Optional[operations_v1.OperationsAsyncClient] = None - - if api_mtls_endpoint: - warnings.warn("api_mtls_endpoint is deprecated", DeprecationWarning) - if client_cert_source: - warnings.warn("client_cert_source is deprecated", DeprecationWarning) - - if channel: - # Ignore credentials if a channel was passed. - credentials = False - # 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 - - # Create SSL credentials with client_cert_source or application - # default SSL credentials. - if client_cert_source: - cert, key = client_cert_source() - self._ssl_channel_credentials = grpc.ssl_channel_credentials( - certificate_chain=cert, private_key=key - ) - else: - self._ssl_channel_credentials = SslCredentials().ssl_credentials - - else: - if client_cert_source_for_mtls and not ssl_channel_credentials: - cert, key = client_cert_source_for_mtls() - self._ssl_channel_credentials = grpc.ssl_channel_credentials( - certificate_chain=cert, private_key=key - ) - - # The base transport sets the host, credentials and scopes - super().__init__( - host=host, - credentials=credentials, - credentials_file=credentials_file, - scopes=scopes, - quota_project_id=quota_project_id, - client_info=client_info, - always_use_jwt_access=always_use_jwt_access, - api_audience=api_audience, - ) - - if not self._grpc_channel: - self._grpc_channel = type(self).create_channel( - self._host, - # use the credentials which are saved - credentials=self._credentials, - # Set ``credentials_file`` to ``None`` here as - # the credentials that we saved earlier should be used. - credentials_file=None, - scopes=self._scopes, - ssl_credentials=self._ssl_channel_credentials, - quota_project_id=quota_project_id, - options=[ - ("grpc.max_send_message_length", -1), - ("grpc.max_receive_message_length", -1), - ], - ) - - # Wrap messages. This must be done after self._grpc_channel exists - self._prep_wrapped_messages(client_info) - - @property - def grpc_channel(self) -> aio.Channel: - """Create the channel designed to connect to this service. - - This property caches on the instance; repeated calls return - the same channel. - """ - # Return the channel from cache. - return self._grpc_channel - - @property - def operations_client(self) -> operations_v1.OperationsAsyncClient: - """Create the client designed to process long-running operations. - - This property caches on the instance; repeated calls return the same - client. - """ - # Quick check: Only create a new client if we do not already have one. - if self._operations_client is None: - self._operations_client = operations_v1.OperationsAsyncClient( - self.grpc_channel - ) - - # Return the client from cache. - return self._operations_client - - @property - def create_certificate(self) -> Callable[ - [service.CreateCertificateRequest], - Awaitable[resources.Certificate]]: - r"""Return a callable for the create certificate method over gRPC. - - Create a new - [Certificate][google.cloud.security.privateca.v1beta1.Certificate] - in a given Project, Location from a particular - [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority]. - - Returns: - Callable[[~.CreateCertificateRequest], - Awaitable[~.Certificate]]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if 'create_certificate' not in self._stubs: - self._stubs['create_certificate'] = self.grpc_channel.unary_unary( - '/google.cloud.security.privateca.v1beta1.CertificateAuthorityService/CreateCertificate', - request_serializer=service.CreateCertificateRequest.serialize, - response_deserializer=resources.Certificate.deserialize, - ) - return self._stubs['create_certificate'] - - @property - def get_certificate(self) -> Callable[ - [service.GetCertificateRequest], - Awaitable[resources.Certificate]]: - r"""Return a callable for the get certificate method over gRPC. - - Returns a - [Certificate][google.cloud.security.privateca.v1beta1.Certificate]. - - Returns: - Callable[[~.GetCertificateRequest], - Awaitable[~.Certificate]]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if 'get_certificate' not in self._stubs: - self._stubs['get_certificate'] = self.grpc_channel.unary_unary( - '/google.cloud.security.privateca.v1beta1.CertificateAuthorityService/GetCertificate', - request_serializer=service.GetCertificateRequest.serialize, - response_deserializer=resources.Certificate.deserialize, - ) - return self._stubs['get_certificate'] - - @property - def list_certificates(self) -> Callable[ - [service.ListCertificatesRequest], - Awaitable[service.ListCertificatesResponse]]: - r"""Return a callable for the list certificates method over gRPC. - - Lists - [Certificates][google.cloud.security.privateca.v1beta1.Certificate]. - - Returns: - Callable[[~.ListCertificatesRequest], - Awaitable[~.ListCertificatesResponse]]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if 'list_certificates' not in self._stubs: - self._stubs['list_certificates'] = self.grpc_channel.unary_unary( - '/google.cloud.security.privateca.v1beta1.CertificateAuthorityService/ListCertificates', - request_serializer=service.ListCertificatesRequest.serialize, - response_deserializer=service.ListCertificatesResponse.deserialize, - ) - return self._stubs['list_certificates'] - - @property - def revoke_certificate(self) -> Callable[ - [service.RevokeCertificateRequest], - Awaitable[resources.Certificate]]: - r"""Return a callable for the revoke certificate method over gRPC. - - Revoke a - [Certificate][google.cloud.security.privateca.v1beta1.Certificate]. - - Returns: - Callable[[~.RevokeCertificateRequest], - Awaitable[~.Certificate]]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if 'revoke_certificate' not in self._stubs: - self._stubs['revoke_certificate'] = self.grpc_channel.unary_unary( - '/google.cloud.security.privateca.v1beta1.CertificateAuthorityService/RevokeCertificate', - request_serializer=service.RevokeCertificateRequest.serialize, - response_deserializer=resources.Certificate.deserialize, - ) - return self._stubs['revoke_certificate'] - - @property - def update_certificate(self) -> Callable[ - [service.UpdateCertificateRequest], - Awaitable[resources.Certificate]]: - r"""Return a callable for the update certificate method over gRPC. - - Update a - [Certificate][google.cloud.security.privateca.v1beta1.Certificate]. - Currently, the only field you can update is the - [labels][google.cloud.security.privateca.v1beta1.Certificate.labels] - field. - - Returns: - Callable[[~.UpdateCertificateRequest], - Awaitable[~.Certificate]]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if 'update_certificate' not in self._stubs: - self._stubs['update_certificate'] = self.grpc_channel.unary_unary( - '/google.cloud.security.privateca.v1beta1.CertificateAuthorityService/UpdateCertificate', - request_serializer=service.UpdateCertificateRequest.serialize, - response_deserializer=resources.Certificate.deserialize, - ) - return self._stubs['update_certificate'] - - @property - def activate_certificate_authority(self) -> Callable[ - [service.ActivateCertificateAuthorityRequest], - Awaitable[operations_pb2.Operation]]: - r"""Return a callable for the activate certificate authority method over gRPC. - - Activate a - [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority] - that is in state - [PENDING_ACTIVATION][google.cloud.security.privateca.v1beta1.CertificateAuthority.State.PENDING_ACTIVATION] - and is of type - [SUBORDINATE][google.cloud.security.privateca.v1beta1.CertificateAuthority.Type.SUBORDINATE]. - After the parent Certificate Authority signs a certificate - signing request from - [FetchCertificateAuthorityCsr][google.cloud.security.privateca.v1beta1.CertificateAuthorityService.FetchCertificateAuthorityCsr], - this method can complete the activation process. - - Returns: - Callable[[~.ActivateCertificateAuthorityRequest], - Awaitable[~.Operation]]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if 'activate_certificate_authority' not in self._stubs: - self._stubs['activate_certificate_authority'] = self.grpc_channel.unary_unary( - '/google.cloud.security.privateca.v1beta1.CertificateAuthorityService/ActivateCertificateAuthority', - request_serializer=service.ActivateCertificateAuthorityRequest.serialize, - response_deserializer=operations_pb2.Operation.FromString, - ) - return self._stubs['activate_certificate_authority'] - - @property - def create_certificate_authority(self) -> Callable[ - [service.CreateCertificateAuthorityRequest], - Awaitable[operations_pb2.Operation]]: - r"""Return a callable for the create certificate authority method over gRPC. - - Create a new - [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority] - in a given Project and Location. - - Returns: - Callable[[~.CreateCertificateAuthorityRequest], - Awaitable[~.Operation]]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if 'create_certificate_authority' not in self._stubs: - 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_pb2.Operation.FromString, - ) - return self._stubs['create_certificate_authority'] - - @property - def disable_certificate_authority(self) -> Callable[ - [service.DisableCertificateAuthorityRequest], - Awaitable[operations_pb2.Operation]]: - r"""Return a callable for the disable certificate authority method over gRPC. - - Disable a - [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority]. - - Returns: - Callable[[~.DisableCertificateAuthorityRequest], - Awaitable[~.Operation]]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if 'disable_certificate_authority' not in self._stubs: - self._stubs['disable_certificate_authority'] = self.grpc_channel.unary_unary( - '/google.cloud.security.privateca.v1beta1.CertificateAuthorityService/DisableCertificateAuthority', - request_serializer=service.DisableCertificateAuthorityRequest.serialize, - response_deserializer=operations_pb2.Operation.FromString, - ) - return self._stubs['disable_certificate_authority'] - - @property - def enable_certificate_authority(self) -> Callable[ - [service.EnableCertificateAuthorityRequest], - Awaitable[operations_pb2.Operation]]: - r"""Return a callable for the enable certificate authority method over gRPC. - - Enable a - [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority]. - - Returns: - Callable[[~.EnableCertificateAuthorityRequest], - Awaitable[~.Operation]]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if 'enable_certificate_authority' not in self._stubs: - 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_pb2.Operation.FromString, - ) - return self._stubs['enable_certificate_authority'] - - @property - def fetch_certificate_authority_csr(self) -> Callable[ - [service.FetchCertificateAuthorityCsrRequest], - Awaitable[service.FetchCertificateAuthorityCsrResponse]]: - r"""Return a callable for the fetch certificate authority - csr method over gRPC. - - Fetch a certificate signing request (CSR) from a - [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority] - that is in state - [PENDING_ACTIVATION][google.cloud.security.privateca.v1beta1.CertificateAuthority.State.PENDING_ACTIVATION] - and is of type - [SUBORDINATE][google.cloud.security.privateca.v1beta1.CertificateAuthority.Type.SUBORDINATE]. - The CSR must then be signed by the desired parent Certificate - Authority, which could be another - [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority] - resource, or could be an on-prem certificate authority. See also - [ActivateCertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthorityService.ActivateCertificateAuthority]. - - Returns: - Callable[[~.FetchCertificateAuthorityCsrRequest], - Awaitable[~.FetchCertificateAuthorityCsrResponse]]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if 'fetch_certificate_authority_csr' not in self._stubs: - self._stubs['fetch_certificate_authority_csr'] = self.grpc_channel.unary_unary( - '/google.cloud.security.privateca.v1beta1.CertificateAuthorityService/FetchCertificateAuthorityCsr', - request_serializer=service.FetchCertificateAuthorityCsrRequest.serialize, - response_deserializer=service.FetchCertificateAuthorityCsrResponse.deserialize, - ) - return self._stubs['fetch_certificate_authority_csr'] - - @property - def get_certificate_authority(self) -> Callable[ - [service.GetCertificateAuthorityRequest], - Awaitable[resources.CertificateAuthority]]: - r"""Return a callable for the get certificate authority method over gRPC. - - Returns a - [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority]. - - Returns: - Callable[[~.GetCertificateAuthorityRequest], - Awaitable[~.CertificateAuthority]]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if 'get_certificate_authority' not in self._stubs: - self._stubs['get_certificate_authority'] = self.grpc_channel.unary_unary( - '/google.cloud.security.privateca.v1beta1.CertificateAuthorityService/GetCertificateAuthority', - request_serializer=service.GetCertificateAuthorityRequest.serialize, - response_deserializer=resources.CertificateAuthority.deserialize, - ) - return self._stubs['get_certificate_authority'] - - @property - def list_certificate_authorities(self) -> Callable[ - [service.ListCertificateAuthoritiesRequest], - Awaitable[service.ListCertificateAuthoritiesResponse]]: - r"""Return a callable for the list certificate authorities method over gRPC. - - Lists - [CertificateAuthorities][google.cloud.security.privateca.v1beta1.CertificateAuthority]. - - Returns: - Callable[[~.ListCertificateAuthoritiesRequest], - Awaitable[~.ListCertificateAuthoritiesResponse]]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if 'list_certificate_authorities' not in self._stubs: - self._stubs['list_certificate_authorities'] = self.grpc_channel.unary_unary( - '/google.cloud.security.privateca.v1beta1.CertificateAuthorityService/ListCertificateAuthorities', - request_serializer=service.ListCertificateAuthoritiesRequest.serialize, - response_deserializer=service.ListCertificateAuthoritiesResponse.deserialize, - ) - return self._stubs['list_certificate_authorities'] - - @property - def restore_certificate_authority(self) -> Callable[ - [service.RestoreCertificateAuthorityRequest], - Awaitable[operations_pb2.Operation]]: - r"""Return a callable for the restore certificate authority method over gRPC. - - Restore a - [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority] - that is scheduled for deletion. - - Returns: - Callable[[~.RestoreCertificateAuthorityRequest], - Awaitable[~.Operation]]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if 'restore_certificate_authority' not in self._stubs: - self._stubs['restore_certificate_authority'] = self.grpc_channel.unary_unary( - '/google.cloud.security.privateca.v1beta1.CertificateAuthorityService/RestoreCertificateAuthority', - request_serializer=service.RestoreCertificateAuthorityRequest.serialize, - response_deserializer=operations_pb2.Operation.FromString, - ) - return self._stubs['restore_certificate_authority'] - - @property - def schedule_delete_certificate_authority(self) -> Callable[ - [service.ScheduleDeleteCertificateAuthorityRequest], - Awaitable[operations_pb2.Operation]]: - r"""Return a callable for the schedule delete certificate - authority method over gRPC. - - Schedule a - [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority] - for deletion. - - Returns: - Callable[[~.ScheduleDeleteCertificateAuthorityRequest], - Awaitable[~.Operation]]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if 'schedule_delete_certificate_authority' not in self._stubs: - self._stubs['schedule_delete_certificate_authority'] = self.grpc_channel.unary_unary( - '/google.cloud.security.privateca.v1beta1.CertificateAuthorityService/ScheduleDeleteCertificateAuthority', - request_serializer=service.ScheduleDeleteCertificateAuthorityRequest.serialize, - response_deserializer=operations_pb2.Operation.FromString, - ) - return self._stubs['schedule_delete_certificate_authority'] - - @property - def update_certificate_authority(self) -> Callable[ - [service.UpdateCertificateAuthorityRequest], - Awaitable[operations_pb2.Operation]]: - r"""Return a callable for the update certificate authority method over gRPC. - - Update a - [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority]. - - Returns: - Callable[[~.UpdateCertificateAuthorityRequest], - Awaitable[~.Operation]]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if 'update_certificate_authority' not in self._stubs: - 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_pb2.Operation.FromString, - ) - return self._stubs['update_certificate_authority'] - - @property - def get_certificate_revocation_list(self) -> Callable[ - [service.GetCertificateRevocationListRequest], - Awaitable[resources.CertificateRevocationList]]: - r"""Return a callable for the get certificate revocation - list method over gRPC. - - Returns a - [CertificateRevocationList][google.cloud.security.privateca.v1beta1.CertificateRevocationList]. - - Returns: - Callable[[~.GetCertificateRevocationListRequest], - Awaitable[~.CertificateRevocationList]]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if 'get_certificate_revocation_list' not in self._stubs: - self._stubs['get_certificate_revocation_list'] = self.grpc_channel.unary_unary( - '/google.cloud.security.privateca.v1beta1.CertificateAuthorityService/GetCertificateRevocationList', - request_serializer=service.GetCertificateRevocationListRequest.serialize, - response_deserializer=resources.CertificateRevocationList.deserialize, - ) - return self._stubs['get_certificate_revocation_list'] - - @property - def list_certificate_revocation_lists(self) -> Callable[ - [service.ListCertificateRevocationListsRequest], - Awaitable[service.ListCertificateRevocationListsResponse]]: - r"""Return a callable for the list certificate revocation - lists method over gRPC. - - Lists - [CertificateRevocationLists][google.cloud.security.privateca.v1beta1.CertificateRevocationList]. - - Returns: - Callable[[~.ListCertificateRevocationListsRequest], - Awaitable[~.ListCertificateRevocationListsResponse]]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if 'list_certificate_revocation_lists' not in self._stubs: - self._stubs['list_certificate_revocation_lists'] = self.grpc_channel.unary_unary( - '/google.cloud.security.privateca.v1beta1.CertificateAuthorityService/ListCertificateRevocationLists', - request_serializer=service.ListCertificateRevocationListsRequest.serialize, - response_deserializer=service.ListCertificateRevocationListsResponse.deserialize, - ) - return self._stubs['list_certificate_revocation_lists'] - - @property - def update_certificate_revocation_list(self) -> Callable[ - [service.UpdateCertificateRevocationListRequest], - Awaitable[operations_pb2.Operation]]: - r"""Return a callable for the update certificate revocation - list method over gRPC. - - Update a - [CertificateRevocationList][google.cloud.security.privateca.v1beta1.CertificateRevocationList]. - - Returns: - Callable[[~.UpdateCertificateRevocationListRequest], - Awaitable[~.Operation]]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if 'update_certificate_revocation_list' not in self._stubs: - self._stubs['update_certificate_revocation_list'] = self.grpc_channel.unary_unary( - '/google.cloud.security.privateca.v1beta1.CertificateAuthorityService/UpdateCertificateRevocationList', - request_serializer=service.UpdateCertificateRevocationListRequest.serialize, - response_deserializer=operations_pb2.Operation.FromString, - ) - return self._stubs['update_certificate_revocation_list'] - - @property - def get_reusable_config(self) -> Callable[ - [service.GetReusableConfigRequest], - Awaitable[resources.ReusableConfig]]: - r"""Return a callable for the get reusable config method over gRPC. - - Returns a - [ReusableConfig][google.cloud.security.privateca.v1beta1.ReusableConfig]. - - Returns: - Callable[[~.GetReusableConfigRequest], - Awaitable[~.ReusableConfig]]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if 'get_reusable_config' not in self._stubs: - self._stubs['get_reusable_config'] = self.grpc_channel.unary_unary( - '/google.cloud.security.privateca.v1beta1.CertificateAuthorityService/GetReusableConfig', - request_serializer=service.GetReusableConfigRequest.serialize, - response_deserializer=resources.ReusableConfig.deserialize, - ) - return self._stubs['get_reusable_config'] - - @property - def list_reusable_configs(self) -> Callable[ - [service.ListReusableConfigsRequest], - Awaitable[service.ListReusableConfigsResponse]]: - r"""Return a callable for the list reusable configs method over gRPC. - - Lists - [ReusableConfigs][google.cloud.security.privateca.v1beta1.ReusableConfig]. - - Returns: - Callable[[~.ListReusableConfigsRequest], - Awaitable[~.ListReusableConfigsResponse]]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if 'list_reusable_configs' not in self._stubs: - self._stubs['list_reusable_configs'] = self.grpc_channel.unary_unary( - '/google.cloud.security.privateca.v1beta1.CertificateAuthorityService/ListReusableConfigs', - request_serializer=service.ListReusableConfigsRequest.serialize, - response_deserializer=service.ListReusableConfigsResponse.deserialize, - ) - return self._stubs['list_reusable_configs'] - - def close(self): - return self.grpc_channel.close() - - -__all__ = ( - 'CertificateAuthorityServiceGrpcAsyncIOTransport', -) diff --git a/owl-bot-staging/v1beta1/google/cloud/security/privateca_v1beta1/types/__init__.py b/owl-bot-staging/v1beta1/google/cloud/security/privateca_v1beta1/types/__init__.py deleted file mode 100644 index f12211a..0000000 --- a/owl-bot-staging/v1beta1/google/cloud/security/privateca_v1beta1/types/__init__.py +++ /dev/null @@ -1,106 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -from .resources import ( - Certificate, - CertificateAuthority, - CertificateConfig, - CertificateDescription, - CertificateRevocationList, - KeyUsage, - ObjectId, - PublicKey, - ReusableConfig, - ReusableConfigValues, - ReusableConfigWrapper, - Subject, - SubjectAltNames, - SubordinateConfig, - X509Extension, - RevocationReason, -) -from .service import ( - ActivateCertificateAuthorityRequest, - CreateCertificateAuthorityRequest, - CreateCertificateRequest, - DisableCertificateAuthorityRequest, - EnableCertificateAuthorityRequest, - FetchCertificateAuthorityCsrRequest, - FetchCertificateAuthorityCsrResponse, - GetCertificateAuthorityRequest, - GetCertificateRequest, - GetCertificateRevocationListRequest, - GetReusableConfigRequest, - ListCertificateAuthoritiesRequest, - ListCertificateAuthoritiesResponse, - ListCertificateRevocationListsRequest, - ListCertificateRevocationListsResponse, - ListCertificatesRequest, - ListCertificatesResponse, - ListReusableConfigsRequest, - ListReusableConfigsResponse, - OperationMetadata, - RestoreCertificateAuthorityRequest, - RevokeCertificateRequest, - ScheduleDeleteCertificateAuthorityRequest, - UpdateCertificateAuthorityRequest, - UpdateCertificateRequest, - UpdateCertificateRevocationListRequest, -) - -__all__ = ( - 'Certificate', - 'CertificateAuthority', - 'CertificateConfig', - 'CertificateDescription', - 'CertificateRevocationList', - 'KeyUsage', - 'ObjectId', - 'PublicKey', - 'ReusableConfig', - 'ReusableConfigValues', - 'ReusableConfigWrapper', - 'Subject', - 'SubjectAltNames', - 'SubordinateConfig', - 'X509Extension', - 'RevocationReason', - 'ActivateCertificateAuthorityRequest', - 'CreateCertificateAuthorityRequest', - 'CreateCertificateRequest', - 'DisableCertificateAuthorityRequest', - 'EnableCertificateAuthorityRequest', - 'FetchCertificateAuthorityCsrRequest', - 'FetchCertificateAuthorityCsrResponse', - 'GetCertificateAuthorityRequest', - 'GetCertificateRequest', - 'GetCertificateRevocationListRequest', - 'GetReusableConfigRequest', - 'ListCertificateAuthoritiesRequest', - 'ListCertificateAuthoritiesResponse', - 'ListCertificateRevocationListsRequest', - 'ListCertificateRevocationListsResponse', - 'ListCertificatesRequest', - 'ListCertificatesResponse', - 'ListReusableConfigsRequest', - 'ListReusableConfigsResponse', - 'OperationMetadata', - 'RestoreCertificateAuthorityRequest', - 'RevokeCertificateRequest', - 'ScheduleDeleteCertificateAuthorityRequest', - 'UpdateCertificateAuthorityRequest', - 'UpdateCertificateRequest', - 'UpdateCertificateRevocationListRequest', -) diff --git a/owl-bot-staging/v1beta1/google/cloud/security/privateca_v1beta1/types/resources.py b/owl-bot-staging/v1beta1/google/cloud/security/privateca_v1beta1/types/resources.py deleted file mode 100644 index f314a6c..0000000 --- a/owl-bot-staging/v1beta1/google/cloud/security/privateca_v1beta1/types/resources.py +++ /dev/null @@ -1,1861 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -from typing import MutableMapping, MutableSequence - -import proto # 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( - package='google.cloud.security.privateca.v1beta1', - manifest={ - 'RevocationReason', - 'CertificateAuthority', - 'CertificateRevocationList', - 'Certificate', - 'ReusableConfig', - 'ReusableConfigValues', - 'ReusableConfigWrapper', - 'SubordinateConfig', - 'PublicKey', - 'CertificateConfig', - 'CertificateDescription', - 'ObjectId', - 'X509Extension', - 'KeyUsage', - 'Subject', - 'SubjectAltNames', - }, -) - - -class RevocationReason(proto.Enum): - r"""A - [RevocationReason][google.cloud.security.privateca.v1beta1.RevocationReason] - indicates whether a - [Certificate][google.cloud.security.privateca.v1beta1.Certificate] - has been revoked, and the reason for revocation. These correspond to - standard revocation reasons from RFC 5280. Note that the enum labels - and values in this definition are not the same ASN.1 values defined - in RFC 5280. These values will be translated to the correct ASN.1 - values when a CRL is created. - - Values: - REVOCATION_REASON_UNSPECIFIED (0): - Default unspecified value. This value does indicate that a - [Certificate][google.cloud.security.privateca.v1beta1.Certificate] - has been revoked, but that a reason has not been recorded. - KEY_COMPROMISE (1): - Key material for this - [Certificate][google.cloud.security.privateca.v1beta1.Certificate] - may have leaked. - CERTIFICATE_AUTHORITY_COMPROMISE (2): - The key material for a certificate authority - in the issuing path may have leaked. - AFFILIATION_CHANGED (3): - The subject or other attributes in this - [Certificate][google.cloud.security.privateca.v1beta1.Certificate] - have changed. - SUPERSEDED (4): - This - [Certificate][google.cloud.security.privateca.v1beta1.Certificate] - has been superseded. - CESSATION_OF_OPERATION (5): - This - [Certificate][google.cloud.security.privateca.v1beta1.Certificate] - or entities in the issuing path have ceased to operate. - CERTIFICATE_HOLD (6): - This - [Certificate][google.cloud.security.privateca.v1beta1.Certificate] - should not be considered valid, it is expected that it may - become valid in the future. - PRIVILEGE_WITHDRAWN (7): - This - [Certificate][google.cloud.security.privateca.v1beta1.Certificate] - no longer has permission to assert the listed attributes. - ATTRIBUTE_AUTHORITY_COMPROMISE (8): - The authority which determines appropriate attributes for a - [Certificate][google.cloud.security.privateca.v1beta1.Certificate] - may have been compromised. - """ - REVOCATION_REASON_UNSPECIFIED = 0 - KEY_COMPROMISE = 1 - CERTIFICATE_AUTHORITY_COMPROMISE = 2 - AFFILIATION_CHANGED = 3 - SUPERSEDED = 4 - CESSATION_OF_OPERATION = 5 - CERTIFICATE_HOLD = 6 - PRIVILEGE_WITHDRAWN = 7 - ATTRIBUTE_AUTHORITY_COMPROMISE = 8 - - -class CertificateAuthority(proto.Message): - r"""A - [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority] - represents an individual Certificate Authority. A - [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority] - can be used to create - [Certificates][google.cloud.security.privateca.v1beta1.Certificate]. - - Attributes: - name (str): - Output only. The resource name for this - [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority] - in the format - ``projects/*/locations/*/certificateAuthorities/*``. - type_ (google.cloud.security.privateca_v1beta1.types.CertificateAuthority.Type): - Required. Immutable. The - [Type][google.cloud.security.privateca.v1beta1.CertificateAuthority.Type] - of this - [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority]. - tier (google.cloud.security.privateca_v1beta1.types.CertificateAuthority.Tier): - Required. Immutable. The - [Tier][google.cloud.security.privateca.v1beta1.CertificateAuthority.Tier] - of this - [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority]. - config (google.cloud.security.privateca_v1beta1.types.CertificateConfig): - Required. Immutable. The config used to - create a self-signed X.509 certificate or CSR. - lifetime (google.protobuf.duration_pb2.Duration): - Required. The desired lifetime of the CA certificate. Used - to create the "not_before_time" and "not_after_time" fields - inside an X.509 certificate. - key_spec (google.cloud.security.privateca_v1beta1.types.CertificateAuthority.KeyVersionSpec): - Required. Immutable. Used when issuing certificates for this - [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority]. - If this - [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority] - is a self-signed CertificateAuthority, this key is also used - to sign the self-signed CA certificate. Otherwise, it is - used to sign a CSR. - certificate_policy (google.cloud.security.privateca_v1beta1.types.CertificateAuthority.CertificateAuthorityPolicy): - Optional. The - [CertificateAuthorityPolicy][google.cloud.security.privateca.v1beta1.CertificateAuthority.CertificateAuthorityPolicy] - to enforce when issuing - [Certificates][google.cloud.security.privateca.v1beta1.Certificate] - from this - [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority]. - issuing_options (google.cloud.security.privateca_v1beta1.types.CertificateAuthority.IssuingOptions): - Optional. The - [IssuingOptions][google.cloud.security.privateca.v1beta1.CertificateAuthority.IssuingOptions] - to follow when issuing - [Certificates][google.cloud.security.privateca.v1beta1.Certificate] - from this - [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority]. - subordinate_config (google.cloud.security.privateca_v1beta1.types.SubordinateConfig): - Optional. If this is a subordinate - [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority], - this field will be set with the subordinate configuration, - which describes its issuers. This may be updated, but this - [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority] - must continue to validate. - state (google.cloud.security.privateca_v1beta1.types.CertificateAuthority.State): - Output only. The - [State][google.cloud.security.privateca.v1beta1.CertificateAuthority.State] - for this - [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority]. - pem_ca_certificates (MutableSequence[str]): - Output only. This - [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority]'s - certificate chain, including the current - [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority]'s - certificate. Ordered such that the root issuer is the final - element (consistent with RFC 5246). For a self-signed CA, - this will only list the current - [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority]'s - certificate. - ca_certificate_descriptions (MutableSequence[google.cloud.security.privateca_v1beta1.types.CertificateDescription]): - Output only. A structured description of this - [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority]'s - CA certificate and its issuers. Ordered as self-to-root. - gcs_bucket (str): - Immutable. The name of a Cloud Storage bucket where this - [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority] - will publish content, such as the CA certificate and CRLs. - This must be a bucket name, without any prefixes (such as - ``gs://``) or suffixes (such as ``.googleapis.com``). For - example, to use a bucket named ``my-bucket``, you would - simply specify ``my-bucket``. If not specified, a managed - bucket will be created. - access_urls (google.cloud.security.privateca_v1beta1.types.CertificateAuthority.AccessUrls): - Output only. URLs for accessing content - published by this CA, such as the CA certificate - and CRLs. - create_time (google.protobuf.timestamp_pb2.Timestamp): - Output only. The time at which this - [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority] - was created. - update_time (google.protobuf.timestamp_pb2.Timestamp): - Output only. The time at which this - [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority] - was updated. - delete_time (google.protobuf.timestamp_pb2.Timestamp): - Output only. The time at which this - [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority] - will be deleted, if scheduled for deletion. - labels (MutableMapping[str, str]): - Optional. Labels with user-defined metadata. - """ - class Type(proto.Enum): - r"""The type of a - [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority], - indicating its issuing chain. - - Values: - TYPE_UNSPECIFIED (0): - Not specified. - SELF_SIGNED (1): - Self-signed CA. - SUBORDINATE (2): - Subordinate CA. Could be issued by a Private CA - [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority] - or an unmanaged CA. - """ - TYPE_UNSPECIFIED = 0 - SELF_SIGNED = 1 - SUBORDINATE = 2 - - class Tier(proto.Enum): - r"""The tier of a - [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority], - indicating its supported functionality and/or billing SKU. - - Values: - TIER_UNSPECIFIED (0): - Not specified. - ENTERPRISE (1): - Enterprise tier. - DEVOPS (2): - DevOps tier. - """ - TIER_UNSPECIFIED = 0 - ENTERPRISE = 1 - DEVOPS = 2 - - class State(proto.Enum): - r"""The state of a - [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority], - indicating if it can be used. - - Values: - STATE_UNSPECIFIED (0): - Not specified. - ENABLED (1): - Certificates can be issued from this CA. CRLs - will be generated for this CA. - DISABLED (2): - Certificates cannot be issued from this CA. - CRLs will still be generated. - PENDING_ACTIVATION (3): - Certificates cannot be issued from this CA. - CRLs will not be generated. - PENDING_DELETION (4): - Certificates cannot be issued from this CA. - CRLs will not be generated. - """ - STATE_UNSPECIFIED = 0 - ENABLED = 1 - DISABLED = 2 - PENDING_ACTIVATION = 3 - PENDING_DELETION = 4 - - class SignHashAlgorithm(proto.Enum): - r"""The algorithm of a Cloud KMS CryptoKeyVersion of a - [CryptoKey][google.cloud.kms.v1.CryptoKey] with the - [CryptoKeyPurpose][google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose] - value ``ASYMMETRIC_SIGN``. These values correspond to the - [CryptoKeyVersionAlgorithm][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionAlgorithm] - values. For RSA signing algorithms, the PSS algorithms should be - preferred, use PKCS1 algorithms if required for compatibility. For - further recommandations, see - https://cloud.google.com/kms/docs/algorithms#algorithm_recommendations. - - Values: - SIGN_HASH_ALGORITHM_UNSPECIFIED (0): - Not specified. - RSA_PSS_2048_SHA256 (1): - maps to CryptoKeyVersionAlgorithm.RSA_SIGN_PSS_2048_SHA256 - RSA_PSS_3072_SHA256 (2): - maps to CryptoKeyVersionAlgorithm. RSA_SIGN_PSS_3072_SHA256 - RSA_PSS_4096_SHA256 (3): - maps to CryptoKeyVersionAlgorithm.RSA_SIGN_PSS_4096_SHA256 - RSA_PKCS1_2048_SHA256 (6): - maps to CryptoKeyVersionAlgorithm.RSA_SIGN_PKCS1_2048_SHA256 - RSA_PKCS1_3072_SHA256 (7): - maps to CryptoKeyVersionAlgorithm.RSA_SIGN_PKCS1_3072_SHA256 - RSA_PKCS1_4096_SHA256 (8): - maps to CryptoKeyVersionAlgorithm.RSA_SIGN_PKCS1_4096_SHA256 - EC_P256_SHA256 (4): - maps to CryptoKeyVersionAlgorithm.EC_SIGN_P256_SHA256 - EC_P384_SHA384 (5): - maps to CryptoKeyVersionAlgorithm.EC_SIGN_P384_SHA384 - """ - SIGN_HASH_ALGORITHM_UNSPECIFIED = 0 - RSA_PSS_2048_SHA256 = 1 - RSA_PSS_3072_SHA256 = 2 - RSA_PSS_4096_SHA256 = 3 - RSA_PKCS1_2048_SHA256 = 6 - RSA_PKCS1_3072_SHA256 = 7 - RSA_PKCS1_4096_SHA256 = 8 - EC_P256_SHA256 = 4 - EC_P384_SHA384 = 5 - - class IssuingOptions(proto.Message): - r"""Options that affect all certificates issued by a - [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority]. - - Attributes: - include_ca_cert_url (bool): - Required. When true, includes a URL to the - issuing CA certificate in the "authority - information access" X.509 extension. - include_crl_access_url (bool): - Required. When true, includes a URL to the CRL corresponding - to certificates issued from a - [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority]. - CRLs will expire 7 days from their creation. However, we - will rebuild daily. CRLs are also rebuilt shortly after a - certificate is revoked. - """ - - include_ca_cert_url: bool = proto.Field( - proto.BOOL, - number=1, - ) - include_crl_access_url: bool = proto.Field( - proto.BOOL, - number=2, - ) - - class CertificateAuthorityPolicy(proto.Message): - r"""The issuing policy for a - [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority]. - [Certificates][google.cloud.security.privateca.v1beta1.Certificate] - will not be successfully issued from this - [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority] - if they violate the policy. - - This message has `oneof`_ fields (mutually exclusive fields). - For each oneof, at most one member field can be set at the same time. - Setting any member of the oneof automatically clears all other - members. - - .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields - - Attributes: - allowed_config_list (google.cloud.security.privateca_v1beta1.types.CertificateAuthority.CertificateAuthorityPolicy.AllowedConfigList): - Optional. All - [Certificates][google.cloud.security.privateca.v1beta1.Certificate] - issued by the - [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority] - must match at least one listed - [ReusableConfigWrapper][google.cloud.security.privateca.v1beta1.ReusableConfigWrapper] - in the list. - - This field is a member of `oneof`_ ``config_policy``. - overwrite_config_values (google.cloud.security.privateca_v1beta1.types.ReusableConfigWrapper): - Optional. All - [Certificates][google.cloud.security.privateca.v1beta1.Certificate] - issued by the - [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority] - will use the provided configuration values, overwriting any - requested configuration values. - - This field is a member of `oneof`_ ``config_policy``. - allowed_locations_and_organizations (MutableSequence[google.cloud.security.privateca_v1beta1.types.Subject]): - Optional. If any - [Subject][google.cloud.security.privateca.v1beta1.Subject] - is specified here, then all - [Certificates][google.cloud.security.privateca.v1beta1.Certificate] - issued by the - [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority] - must match at least one listed - [Subject][google.cloud.security.privateca.v1beta1.Subject]. - If a - [Subject][google.cloud.security.privateca.v1beta1.Subject] - has an empty field, any value will be allowed for that - field. - allowed_common_names (MutableSequence[str]): - Optional. If any value is specified here, then all - [Certificates][google.cloud.security.privateca.v1beta1.Certificate] - issued by the - [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority] - must match at least one listed value. If no value is - specified, all values will be allowed for this fied. Glob - patterns are also supported. - allowed_sans (google.cloud.security.privateca_v1beta1.types.CertificateAuthority.CertificateAuthorityPolicy.AllowedSubjectAltNames): - Optional. If a - [AllowedSubjectAltNames][google.cloud.security.privateca.v1beta1.CertificateAuthority.CertificateAuthorityPolicy.AllowedSubjectAltNames] - is specified here, then all - [Certificates][google.cloud.security.privateca.v1beta1.Certificate] - issued by the - [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority] - must match - [AllowedSubjectAltNames][google.cloud.security.privateca.v1beta1.CertificateAuthority.CertificateAuthorityPolicy.AllowedSubjectAltNames]. - If no value or an empty value is specified, any value will - be allowed for the - [SubjectAltNames][google.cloud.security.privateca.v1beta1.SubjectAltNames] - field. - maximum_lifetime (google.protobuf.duration_pb2.Duration): - Optional. The maximum lifetime allowed by the - [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority]. - Note that if the any part if the issuing chain expires - before a - [Certificate][google.cloud.security.privateca.v1beta1.Certificate]'s - requested maximum_lifetime, the effective lifetime will be - explicitly truncated. - allowed_issuance_modes (google.cloud.security.privateca_v1beta1.types.CertificateAuthority.CertificateAuthorityPolicy.IssuanceModes): - Optional. If specified, then only methods allowed in the - [IssuanceModes][google.cloud.security.privateca.v1beta1.CertificateAuthority.CertificateAuthorityPolicy.IssuanceModes] - may be used to issue - [Certificates][google.cloud.security.privateca.v1beta1.Certificate]. - """ - - class AllowedConfigList(proto.Message): - r""" - - Attributes: - allowed_config_values (MutableSequence[google.cloud.security.privateca_v1beta1.types.ReusableConfigWrapper]): - Required. All - [Certificates][google.cloud.security.privateca.v1beta1.Certificate] - issued by the - [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority] - must match at least one listed - [ReusableConfigWrapper][google.cloud.security.privateca.v1beta1.ReusableConfigWrapper]. - If a - [ReusableConfigWrapper][google.cloud.security.privateca.v1beta1.ReusableConfigWrapper] - has an empty field, any value will be allowed for that - field. - """ - - allowed_config_values: MutableSequence['ReusableConfigWrapper'] = proto.RepeatedField( - proto.MESSAGE, - number=1, - message='ReusableConfigWrapper', - ) - - class AllowedSubjectAltNames(proto.Message): - r"""[AllowedSubjectAltNames][google.cloud.security.privateca.v1beta1.CertificateAuthority.CertificateAuthorityPolicy.AllowedSubjectAltNames] - specifies the allowed values for - [SubjectAltNames][google.cloud.security.privateca.v1beta1.SubjectAltNames] - by the - [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority] - when issuing - [Certificates][google.cloud.security.privateca.v1beta1.Certificate]. - - Attributes: - allowed_dns_names (MutableSequence[str]): - Optional. Contains valid, fully-qualified host names. Glob - patterns are also supported. To allow an explicit wildcard - certificate, escape with backlash (i.e. ``\*``). E.g. for - globbed entries: ``*bar.com`` will allow ``foo.bar.com``, - but not ``*.bar.com``, unless the - [allow_globbing_dns_wildcards][google.cloud.security.privateca.v1beta1.CertificateAuthority.CertificateAuthorityPolicy.AllowedSubjectAltNames.allow_globbing_dns_wildcards] - field is set. E.g. for wildcard entries: ``\*.bar.com`` will - allow ``*.bar.com``, but not ``foo.bar.com``. - allowed_uris (MutableSequence[str]): - Optional. Contains valid RFC 3986 URIs. Glob patterns are - also supported. To match across path seperators (i.e. '/') - use the double star glob pattern (i.e. '**'). - allowed_email_addresses (MutableSequence[str]): - Optional. Contains valid RFC 2822 E-mail - addresses. Glob patterns are also supported. - allowed_ips (MutableSequence[str]): - Optional. Contains valid 32-bit IPv4 - addresses and subnet ranges or RFC 4291 IPv6 - addresses and subnet ranges. Subnet ranges are - specified using the '/' notation (e.g. - 10.0.0.0/8, 2001:700:300:1800::/64). Glob - patterns are supported only for ip address - entries (i.e. not for subnet ranges). - allow_globbing_dns_wildcards (bool): - Optional. Specifies if glob patterns used for - [allowed_dns_names][google.cloud.security.privateca.v1beta1.CertificateAuthority.CertificateAuthorityPolicy.AllowedSubjectAltNames.allowed_dns_names] - allows wildcard certificates. - allow_custom_sans (bool): - Optional. Specifies if to allow custom - X509Extension values. - """ - - allowed_dns_names: MutableSequence[str] = proto.RepeatedField( - proto.STRING, - number=1, - ) - allowed_uris: MutableSequence[str] = proto.RepeatedField( - proto.STRING, - number=2, - ) - allowed_email_addresses: MutableSequence[str] = proto.RepeatedField( - proto.STRING, - number=3, - ) - allowed_ips: MutableSequence[str] = proto.RepeatedField( - proto.STRING, - number=4, - ) - allow_globbing_dns_wildcards: bool = proto.Field( - proto.BOOL, - number=5, - ) - allow_custom_sans: bool = proto.Field( - proto.BOOL, - number=6, - ) - - class IssuanceModes(proto.Message): - r"""[IssuanceModes][google.cloud.security.privateca.v1beta1.CertificateAuthority.CertificateAuthorityPolicy.IssuanceModes] - specifies the allowed ways in which - [Certificates][google.cloud.security.privateca.v1beta1.Certificate] - may be requested from this - [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority]. - - Attributes: - allow_csr_based_issuance (bool): - Required. When true, allows callers to create - [Certificates][google.cloud.security.privateca.v1beta1.Certificate] - by specifying a CSR. - allow_config_based_issuance (bool): - Required. When true, allows callers to create - [Certificates][google.cloud.security.privateca.v1beta1.Certificate] - by specifying a - [CertificateConfig][google.cloud.security.privateca.v1beta1.CertificateConfig]. - """ - - allow_csr_based_issuance: bool = proto.Field( - proto.BOOL, - number=1, - ) - allow_config_based_issuance: bool = proto.Field( - proto.BOOL, - number=2, - ) - - allowed_config_list: 'CertificateAuthority.CertificateAuthorityPolicy.AllowedConfigList' = proto.Field( - proto.MESSAGE, - number=1, - oneof='config_policy', - message='CertificateAuthority.CertificateAuthorityPolicy.AllowedConfigList', - ) - overwrite_config_values: 'ReusableConfigWrapper' = proto.Field( - proto.MESSAGE, - number=2, - oneof='config_policy', - message='ReusableConfigWrapper', - ) - allowed_locations_and_organizations: MutableSequence['Subject'] = proto.RepeatedField( - proto.MESSAGE, - number=3, - message='Subject', - ) - allowed_common_names: MutableSequence[str] = proto.RepeatedField( - proto.STRING, - number=4, - ) - allowed_sans: 'CertificateAuthority.CertificateAuthorityPolicy.AllowedSubjectAltNames' = proto.Field( - proto.MESSAGE, - number=5, - message='CertificateAuthority.CertificateAuthorityPolicy.AllowedSubjectAltNames', - ) - maximum_lifetime: duration_pb2.Duration = proto.Field( - proto.MESSAGE, - number=6, - message=duration_pb2.Duration, - ) - allowed_issuance_modes: 'CertificateAuthority.CertificateAuthorityPolicy.IssuanceModes' = proto.Field( - proto.MESSAGE, - number=8, - message='CertificateAuthority.CertificateAuthorityPolicy.IssuanceModes', - ) - - class AccessUrls(proto.Message): - r"""URLs where a - [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority] - will publish content. - - Attributes: - ca_certificate_access_url (str): - The URL where this - [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority]'s - CA certificate is published. This will only be set for CAs - that have been activated. - crl_access_url (str): - The URL where this - [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority]'s - CRLs are published. This will only be set for CAs that have - been activated. - """ - - ca_certificate_access_url: str = proto.Field( - proto.STRING, - number=1, - ) - crl_access_url: str = proto.Field( - proto.STRING, - number=2, - ) - - class KeyVersionSpec(proto.Message): - r"""A Cloud KMS key configuration that a - [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority] - will use. - - This message has `oneof`_ fields (mutually exclusive fields). - For each oneof, at most one member field can be set at the same time. - Setting any member of the oneof automatically clears all other - members. - - .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields - - Attributes: - cloud_kms_key_version (str): - Required. The resource name for an existing Cloud KMS - CryptoKeyVersion in the format - ``projects/*/locations/*/keyRings/*/cryptoKeys/*/cryptoKeyVersions/*``. - This option enables full flexibility in the key's - capabilities and properties. - - This field is a member of `oneof`_ ``KeyVersion``. - algorithm (google.cloud.security.privateca_v1beta1.types.CertificateAuthority.SignHashAlgorithm): - Required. The algorithm to use for creating a managed Cloud - KMS key for a for a simplified experience. All managed keys - will be have their - [ProtectionLevel][google.cloud.kms.v1.ProtectionLevel] as - ``HSM``. - - This field is a member of `oneof`_ ``KeyVersion``. - """ - - cloud_kms_key_version: str = proto.Field( - proto.STRING, - number=1, - oneof='KeyVersion', - ) - algorithm: 'CertificateAuthority.SignHashAlgorithm' = proto.Field( - proto.ENUM, - number=2, - oneof='KeyVersion', - enum='CertificateAuthority.SignHashAlgorithm', - ) - - name: str = proto.Field( - proto.STRING, - number=1, - ) - type_: Type = proto.Field( - proto.ENUM, - number=2, - enum=Type, - ) - tier: Tier = proto.Field( - proto.ENUM, - number=3, - enum=Tier, - ) - config: 'CertificateConfig' = proto.Field( - proto.MESSAGE, - number=4, - message='CertificateConfig', - ) - lifetime: duration_pb2.Duration = proto.Field( - proto.MESSAGE, - number=5, - message=duration_pb2.Duration, - ) - key_spec: KeyVersionSpec = proto.Field( - proto.MESSAGE, - number=6, - message=KeyVersionSpec, - ) - certificate_policy: CertificateAuthorityPolicy = proto.Field( - proto.MESSAGE, - number=7, - message=CertificateAuthorityPolicy, - ) - issuing_options: IssuingOptions = proto.Field( - proto.MESSAGE, - number=8, - message=IssuingOptions, - ) - subordinate_config: 'SubordinateConfig' = proto.Field( - proto.MESSAGE, - number=19, - message='SubordinateConfig', - ) - state: State = proto.Field( - proto.ENUM, - number=10, - enum=State, - ) - pem_ca_certificates: MutableSequence[str] = proto.RepeatedField( - proto.STRING, - number=9, - ) - ca_certificate_descriptions: MutableSequence['CertificateDescription'] = proto.RepeatedField( - proto.MESSAGE, - number=12, - message='CertificateDescription', - ) - gcs_bucket: str = proto.Field( - proto.STRING, - number=13, - ) - access_urls: AccessUrls = proto.Field( - proto.MESSAGE, - number=14, - message=AccessUrls, - ) - create_time: timestamp_pb2.Timestamp = proto.Field( - proto.MESSAGE, - number=15, - message=timestamp_pb2.Timestamp, - ) - update_time: timestamp_pb2.Timestamp = proto.Field( - proto.MESSAGE, - number=16, - message=timestamp_pb2.Timestamp, - ) - delete_time: timestamp_pb2.Timestamp = proto.Field( - proto.MESSAGE, - number=17, - message=timestamp_pb2.Timestamp, - ) - labels: MutableMapping[str, str] = proto.MapField( - proto.STRING, - proto.STRING, - number=18, - ) - - -class CertificateRevocationList(proto.Message): - r"""A - [CertificateRevocationList][google.cloud.security.privateca.v1beta1.CertificateRevocationList] - corresponds to a signed X.509 certificate Revocation List (CRL). A - CRL contains the serial numbers of certificates that should no - longer be trusted. - - Attributes: - name (str): - Output only. The resource path for this - [CertificateRevocationList][google.cloud.security.privateca.v1beta1.CertificateRevocationList] - in the format - ``projects/*/locations/*/certificateAuthorities/*/ certificateRevocationLists/*``. - sequence_number (int): - Output only. The CRL sequence number that appears in - pem_crl. - revoked_certificates (MutableSequence[google.cloud.security.privateca_v1beta1.types.CertificateRevocationList.RevokedCertificate]): - Output only. The revoked serial numbers that appear in - pem_crl. - pem_crl (str): - Output only. The PEM-encoded X.509 CRL. - access_url (str): - Output only. The location where 'pem_crl' can be accessed. - state (google.cloud.security.privateca_v1beta1.types.CertificateRevocationList.State): - Output only. The - [State][google.cloud.security.privateca.v1beta1.CertificateRevocationList.State] - for this - [CertificateRevocationList][google.cloud.security.privateca.v1beta1.CertificateRevocationList]. - create_time (google.protobuf.timestamp_pb2.Timestamp): - Output only. The time at which this - [CertificateRevocationList][google.cloud.security.privateca.v1beta1.CertificateRevocationList] - was created. - update_time (google.protobuf.timestamp_pb2.Timestamp): - Output only. The time at which this - [CertificateRevocationList][google.cloud.security.privateca.v1beta1.CertificateRevocationList] - was updated. - labels (MutableMapping[str, str]): - Optional. Labels with user-defined metadata. - """ - class State(proto.Enum): - r"""The state of a - [CertificateRevocationList][google.cloud.security.privateca.v1beta1.CertificateRevocationList], - indicating if it is current. - - Values: - STATE_UNSPECIFIED (0): - Not specified. - ACTIVE (1): - The - [CertificateRevocationList][google.cloud.security.privateca.v1beta1.CertificateRevocationList] - is up to date. - SUPERSEDED (2): - The - [CertificateRevocationList][google.cloud.security.privateca.v1beta1.CertificateRevocationList] - is no longer current. - """ - STATE_UNSPECIFIED = 0 - ACTIVE = 1 - SUPERSEDED = 2 - - class RevokedCertificate(proto.Message): - r"""Describes a revoked - [Certificate][google.cloud.security.privateca.v1beta1.Certificate]. - - Attributes: - certificate (str): - The resource path for the - [Certificate][google.cloud.security.privateca.v1beta1.Certificate] - in the format - ``projects/*/locations/*/certificateAuthorities/*/certificates/*``. - hex_serial_number (str): - The serial number of the - [Certificate][google.cloud.security.privateca.v1beta1.Certificate]. - revocation_reason (google.cloud.security.privateca_v1beta1.types.RevocationReason): - The reason the - [Certificate][google.cloud.security.privateca.v1beta1.Certificate] - was revoked. - """ - - certificate: str = proto.Field( - proto.STRING, - number=1, - ) - hex_serial_number: str = proto.Field( - proto.STRING, - number=2, - ) - revocation_reason: 'RevocationReason' = proto.Field( - proto.ENUM, - number=3, - enum='RevocationReason', - ) - - name: str = proto.Field( - proto.STRING, - number=1, - ) - sequence_number: int = proto.Field( - proto.INT64, - number=2, - ) - revoked_certificates: MutableSequence[RevokedCertificate] = proto.RepeatedField( - proto.MESSAGE, - number=3, - message=RevokedCertificate, - ) - pem_crl: str = proto.Field( - proto.STRING, - number=4, - ) - access_url: str = proto.Field( - proto.STRING, - number=5, - ) - state: State = proto.Field( - proto.ENUM, - number=6, - enum=State, - ) - create_time: timestamp_pb2.Timestamp = proto.Field( - proto.MESSAGE, - number=7, - message=timestamp_pb2.Timestamp, - ) - update_time: timestamp_pb2.Timestamp = proto.Field( - proto.MESSAGE, - number=8, - message=timestamp_pb2.Timestamp, - ) - labels: MutableMapping[str, str] = proto.MapField( - proto.STRING, - proto.STRING, - number=9, - ) - - -class Certificate(proto.Message): - r"""A [Certificate][google.cloud.security.privateca.v1beta1.Certificate] - corresponds to a signed X.509 certificate issued by a - [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority]. - - This message has `oneof`_ fields (mutually exclusive fields). - For each oneof, at most one member field can be set at the same time. - Setting any member of the oneof automatically clears all other - members. - - .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields - - Attributes: - name (str): - Output only. The resource path for this - [Certificate][google.cloud.security.privateca.v1beta1.Certificate] - in the format - ``projects/*/locations/*/certificateAuthorities/*/certificates/*``. - pem_csr (str): - Immutable. A pem-encoded X.509 certificate - signing request (CSR). - - This field is a member of `oneof`_ ``certificate_config``. - config (google.cloud.security.privateca_v1beta1.types.CertificateConfig): - Immutable. A description of the certificate - and key that does not require X.509 or ASN.1. - - This field is a member of `oneof`_ ``certificate_config``. - lifetime (google.protobuf.duration_pb2.Duration): - Required. Immutable. The desired lifetime of a certificate. - Used to create the "not_before_time" and "not_after_time" - fields inside an X.509 certificate. Note that the lifetime - may be truncated if it would extend past the life of any - certificate authority in the issuing chain. - revocation_details (google.cloud.security.privateca_v1beta1.types.Certificate.RevocationDetails): - Output only. Details regarding the revocation of this - [Certificate][google.cloud.security.privateca.v1beta1.Certificate]. - This - [Certificate][google.cloud.security.privateca.v1beta1.Certificate] - is considered revoked if and only if this field is present. - pem_certificate (str): - Output only. The pem-encoded, signed X.509 - certificate. - certificate_description (google.cloud.security.privateca_v1beta1.types.CertificateDescription): - Output only. A structured description of the - issued X.509 certificate. - pem_certificate_chain (MutableSequence[str]): - Output only. The chain that may be used to - verify the X.509 certificate. Expected to be in - issuer-to-root order according to RFC 5246. - create_time (google.protobuf.timestamp_pb2.Timestamp): - Output only. The time at which this - [Certificate][google.cloud.security.privateca.v1beta1.Certificate] - was created. - update_time (google.protobuf.timestamp_pb2.Timestamp): - Output only. The time at which this - [Certificate][google.cloud.security.privateca.v1beta1.Certificate] - was updated. - labels (MutableMapping[str, str]): - Optional. Labels with user-defined metadata. - """ - - class RevocationDetails(proto.Message): - r"""Describes fields that are relavent to the revocation of a - [Certificate][google.cloud.security.privateca.v1beta1.Certificate]. - - Attributes: - revocation_state (google.cloud.security.privateca_v1beta1.types.RevocationReason): - Indicates why a - [Certificate][google.cloud.security.privateca.v1beta1.Certificate] - was revoked. - revocation_time (google.protobuf.timestamp_pb2.Timestamp): - The time at which this - [Certificate][google.cloud.security.privateca.v1beta1.Certificate] - was revoked. - """ - - revocation_state: 'RevocationReason' = proto.Field( - proto.ENUM, - number=1, - enum='RevocationReason', - ) - revocation_time: timestamp_pb2.Timestamp = proto.Field( - proto.MESSAGE, - number=2, - message=timestamp_pb2.Timestamp, - ) - - name: str = proto.Field( - proto.STRING, - number=1, - ) - pem_csr: str = proto.Field( - proto.STRING, - number=2, - oneof='certificate_config', - ) - config: 'CertificateConfig' = proto.Field( - proto.MESSAGE, - number=3, - oneof='certificate_config', - message='CertificateConfig', - ) - lifetime: duration_pb2.Duration = proto.Field( - proto.MESSAGE, - number=4, - message=duration_pb2.Duration, - ) - revocation_details: RevocationDetails = proto.Field( - proto.MESSAGE, - number=5, - message=RevocationDetails, - ) - pem_certificate: str = proto.Field( - proto.STRING, - number=6, - ) - certificate_description: 'CertificateDescription' = proto.Field( - proto.MESSAGE, - number=7, - message='CertificateDescription', - ) - pem_certificate_chain: MutableSequence[str] = proto.RepeatedField( - proto.STRING, - number=8, - ) - create_time: timestamp_pb2.Timestamp = proto.Field( - proto.MESSAGE, - number=9, - message=timestamp_pb2.Timestamp, - ) - update_time: timestamp_pb2.Timestamp = proto.Field( - proto.MESSAGE, - number=10, - message=timestamp_pb2.Timestamp, - ) - labels: MutableMapping[str, str] = proto.MapField( - proto.STRING, - proto.STRING, - number=11, - ) - - -class ReusableConfig(proto.Message): - r"""A - [ReusableConfig][google.cloud.security.privateca.v1beta1.ReusableConfig] - refers to a managed - [ReusableConfigValues][google.cloud.security.privateca.v1beta1.ReusableConfigValues]. - Those, in turn, are used to describe certain fields of an X.509 - certificate, such as the key usage fields, fields specific to CA - certificates, certificate policy extensions and custom extensions. - - Attributes: - name (str): - Output only. The resource path for this - [ReusableConfig][google.cloud.security.privateca.v1beta1.ReusableConfig] - in the format ``projects/*/locations/*/reusableConfigs/*``. - values (google.cloud.security.privateca_v1beta1.types.ReusableConfigValues): - Required. The config values. - description (str): - Optional. A human-readable description of - scenarios these ReusableConfigValues may be - compatible with. - create_time (google.protobuf.timestamp_pb2.Timestamp): - Output only. The time at which this - [ReusableConfig][google.cloud.security.privateca.v1beta1.ReusableConfig] - was created. - update_time (google.protobuf.timestamp_pb2.Timestamp): - Output only. The time at which this - [ReusableConfig][google.cloud.security.privateca.v1beta1.ReusableConfig] - was updated. - labels (MutableMapping[str, str]): - Optional. Labels with user-defined metadata. - """ - - name: str = proto.Field( - proto.STRING, - number=1, - ) - values: 'ReusableConfigValues' = proto.Field( - proto.MESSAGE, - number=2, - message='ReusableConfigValues', - ) - description: str = proto.Field( - proto.STRING, - number=3, - ) - create_time: timestamp_pb2.Timestamp = proto.Field( - proto.MESSAGE, - number=4, - message=timestamp_pb2.Timestamp, - ) - update_time: timestamp_pb2.Timestamp = proto.Field( - proto.MESSAGE, - number=5, - message=timestamp_pb2.Timestamp, - ) - labels: MutableMapping[str, str] = proto.MapField( - proto.STRING, - proto.STRING, - number=6, - ) - - -class ReusableConfigValues(proto.Message): - r"""A - [ReusableConfigValues][google.cloud.security.privateca.v1beta1.ReusableConfigValues] - is used to describe certain fields of an X.509 certificate, such as - the key usage fields, fields specific to CA certificates, - certificate policy extensions and custom extensions. - - Attributes: - key_usage (google.cloud.security.privateca_v1beta1.types.KeyUsage): - Optional. Indicates the intended use for keys - that correspond to a certificate. - ca_options (google.cloud.security.privateca_v1beta1.types.ReusableConfigValues.CaOptions): - Optional. Describes options in this - [ReusableConfigValues][google.cloud.security.privateca.v1beta1.ReusableConfigValues] - that are relevant in a CA certificate. - policy_ids (MutableSequence[google.cloud.security.privateca_v1beta1.types.ObjectId]): - Optional. Describes the X.509 certificate - policy object identifiers, per - https://tools.ietf.org/html/rfc5280#section-4.2.1.4. - aia_ocsp_servers (MutableSequence[str]): - Optional. Describes Online Certificate Status - Protocol (OCSP) endpoint addresses that appear - in the "Authority Information Access" extension - in the certificate. - additional_extensions (MutableSequence[google.cloud.security.privateca_v1beta1.types.X509Extension]): - Optional. Describes custom X.509 extensions. - """ - - 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, - which is a boolean value. When this value is - missing, the extension will be omitted from the - CA certificate. - max_issuer_path_length (google.protobuf.wrappers_pb2.Int32Value): - Optional. Refers to the path length - restriction X.509 extension. For a CA - certificate, this value describes the depth of - subordinate CA certificates that are allowed. - If this value is less than 0, the request will - fail. If this value is missing, the max path - length will be omitted from the CA certificate. - """ - - is_ca: wrappers_pb2.BoolValue = proto.Field( - proto.MESSAGE, - number=1, - message=wrappers_pb2.BoolValue, - ) - max_issuer_path_length: wrappers_pb2.Int32Value = proto.Field( - proto.MESSAGE, - number=2, - message=wrappers_pb2.Int32Value, - ) - - key_usage: 'KeyUsage' = proto.Field( - proto.MESSAGE, - number=1, - message='KeyUsage', - ) - ca_options: CaOptions = proto.Field( - proto.MESSAGE, - number=2, - message=CaOptions, - ) - policy_ids: MutableSequence['ObjectId'] = proto.RepeatedField( - proto.MESSAGE, - number=3, - message='ObjectId', - ) - aia_ocsp_servers: MutableSequence[str] = proto.RepeatedField( - proto.STRING, - number=4, - ) - additional_extensions: MutableSequence['X509Extension'] = proto.RepeatedField( - proto.MESSAGE, - number=5, - message='X509Extension', - ) - - -class ReusableConfigWrapper(proto.Message): - r"""A - [ReusableConfigWrapper][google.cloud.security.privateca.v1beta1.ReusableConfigWrapper] - describes values that may assist in creating an X.509 certificate, - or a reference to a pre-defined set of values. - - This message has `oneof`_ fields (mutually exclusive fields). - For each oneof, at most one member field can be set at the same time. - Setting any member of the oneof automatically clears all other - members. - - .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields - - Attributes: - reusable_config (str): - Required. A resource path to a - [ReusableConfig][google.cloud.security.privateca.v1beta1.ReusableConfig] - in the format ``projects/*/locations/*/reusableConfigs/*``. - - This field is a member of `oneof`_ ``config_values``. - reusable_config_values (google.cloud.security.privateca_v1beta1.types.ReusableConfigValues): - Required. A user-specified inline - [ReusableConfigValues][google.cloud.security.privateca.v1beta1.ReusableConfigValues]. - - This field is a member of `oneof`_ ``config_values``. - """ - - reusable_config: str = proto.Field( - proto.STRING, - number=1, - oneof='config_values', - ) - reusable_config_values: 'ReusableConfigValues' = proto.Field( - proto.MESSAGE, - number=2, - oneof='config_values', - message='ReusableConfigValues', - ) - - -class SubordinateConfig(proto.Message): - r"""Describes a subordinate CA's issuers. This is either a resource path - to a known issuing - [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority], - or a PEM issuer certificate chain. - - This message has `oneof`_ fields (mutually exclusive fields). - For each oneof, at most one member field can be set at the same time. - Setting any member of the oneof automatically clears all other - members. - - .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields - - Attributes: - certificate_authority (str): - Required. This can refer to a - [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority] - in the same project that was used to create a subordinate - [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority]. - This field is used for information and usability purposes - only. The resource name is in the format - ``projects/*/locations/*/certificateAuthorities/*``. - - This field is a member of `oneof`_ ``subordinate_config``. - pem_issuer_chain (google.cloud.security.privateca_v1beta1.types.SubordinateConfig.SubordinateConfigChain): - Required. Contains the PEM certificate chain for the issuers - of this - [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority], - but not pem certificate for this CA itself. - - This field is a member of `oneof`_ ``subordinate_config``. - """ - - class SubordinateConfigChain(proto.Message): - r"""This message describes a subordinate CA's issuer certificate - chain. This wrapper exists for compatibility reasons. - - Attributes: - pem_certificates (MutableSequence[str]): - Required. Expected to be in leaf-to-root - order according to RFC 5246. - """ - - pem_certificates: MutableSequence[str] = proto.RepeatedField( - proto.STRING, - number=1, - ) - - certificate_authority: str = proto.Field( - proto.STRING, - number=1, - oneof='subordinate_config', - ) - pem_issuer_chain: SubordinateConfigChain = proto.Field( - proto.MESSAGE, - number=2, - oneof='subordinate_config', - message=SubordinateConfigChain, - ) - - -class PublicKey(proto.Message): - r"""A [PublicKey][google.cloud.security.privateca.v1beta1.PublicKey] - describes a public key. - - Attributes: - type_ (google.cloud.security.privateca_v1beta1.types.PublicKey.KeyType): - Required. The type of public key. - key (bytes): - Required. A public key. Padding and encoding - varies by 'KeyType' and is described along with - the KeyType values. - """ - class KeyType(proto.Enum): - r"""Types of public keys that are supported. At a minimum, we support - RSA and ECDSA, for the key sizes or curves listed: - https://cloud.google.com/kms/docs/algorithms#asymmetric_signing_algorithms - - Values: - KEY_TYPE_UNSPECIFIED (0): - Default unspecified value. - PEM_RSA_KEY (1): - A PEM-encoded PKCS#1/RFC 3447 RSAPrivateKey - structure. - PEM_EC_KEY (2): - A PEM-encoded compressed NIST - P-256/secp256r1/prime256v1 or P-384 key. - """ - KEY_TYPE_UNSPECIFIED = 0 - PEM_RSA_KEY = 1 - PEM_EC_KEY = 2 - - type_: KeyType = proto.Field( - proto.ENUM, - number=1, - enum=KeyType, - ) - key: bytes = proto.Field( - proto.BYTES, - number=2, - ) - - -class CertificateConfig(proto.Message): - r"""A - [CertificateConfig][google.cloud.security.privateca.v1beta1.CertificateConfig] - describes an X.509 certificate or CSR that is to be created, as an - alternative to using ASN.1. - - Attributes: - subject_config (google.cloud.security.privateca_v1beta1.types.CertificateConfig.SubjectConfig): - Required. Specifies some of the values in a - certificate that are related to the subject. - reusable_config (google.cloud.security.privateca_v1beta1.types.ReusableConfigWrapper): - Required. Describes how some of the technical - fields in a certificate should be populated. - public_key (google.cloud.security.privateca_v1beta1.types.PublicKey): - Optional. The public key that corresponds to this config. - This is, for example, used when issuing - [Certificates][google.cloud.security.privateca.v1beta1.Certificate], - but not when creating a self-signed - [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority] - or - [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority] - CSR. - """ - - class SubjectConfig(proto.Message): - r"""These values are used to create the distinguished name and - subject alternative name fields in an X.509 certificate. - - Attributes: - subject (google.cloud.security.privateca_v1beta1.types.Subject): - Required. Contains distinguished name fields - such as the location and organization. - common_name (str): - Optional. The "common name" of the - distinguished name. - subject_alt_name (google.cloud.security.privateca_v1beta1.types.SubjectAltNames): - Optional. The subject alternative name - fields. - """ - - subject: 'Subject' = proto.Field( - proto.MESSAGE, - number=1, - message='Subject', - ) - common_name: str = proto.Field( - proto.STRING, - number=2, - ) - subject_alt_name: 'SubjectAltNames' = proto.Field( - proto.MESSAGE, - number=3, - message='SubjectAltNames', - ) - - subject_config: SubjectConfig = proto.Field( - proto.MESSAGE, - number=1, - message=SubjectConfig, - ) - reusable_config: 'ReusableConfigWrapper' = proto.Field( - proto.MESSAGE, - number=2, - message='ReusableConfigWrapper', - ) - public_key: 'PublicKey' = proto.Field( - proto.MESSAGE, - number=3, - message='PublicKey', - ) - - -class CertificateDescription(proto.Message): - r"""A - [CertificateDescription][google.cloud.security.privateca.v1beta1.CertificateDescription] - describes an X.509 certificate or CSR that has been issued, as an - alternative to using ASN.1 / X.509. - - Attributes: - subject_description (google.cloud.security.privateca_v1beta1.types.CertificateDescription.SubjectDescription): - Describes some of the values in a certificate - that are related to the subject and lifetime. - config_values (google.cloud.security.privateca_v1beta1.types.ReusableConfigValues): - Describes some of the technical fields in a - certificate. - public_key (google.cloud.security.privateca_v1beta1.types.PublicKey): - The public key that corresponds to an issued - certificate. - subject_key_id (google.cloud.security.privateca_v1beta1.types.CertificateDescription.KeyId): - Provides a means of identifiying certificates - that contain a particular public key, per - https://tools.ietf.org/html/rfc5280#section-4.2.1.2. - authority_key_id (google.cloud.security.privateca_v1beta1.types.CertificateDescription.KeyId): - Identifies the subject_key_id of the parent certificate, per - https://tools.ietf.org/html/rfc5280#section-4.2.1.1 - crl_distribution_points (MutableSequence[str]): - Describes a list of locations to obtain CRL - information, i.e. the DistributionPoint.fullName - described by - https://tools.ietf.org/html/rfc5280#section-4.2.1.13 - aia_issuing_certificate_urls (MutableSequence[str]): - Describes lists of issuer CA certificate URLs - that appear in the "Authority Information - Access" extension in the certificate. - cert_fingerprint (google.cloud.security.privateca_v1beta1.types.CertificateDescription.CertificateFingerprint): - The hash of the x.509 certificate. - """ - - class SubjectDescription(proto.Message): - r"""These values describe fields in an issued X.509 certificate - such as the distinguished name, subject alternative names, - serial number, and lifetime. - - Attributes: - subject (google.cloud.security.privateca_v1beta1.types.Subject): - Contains distinguished name fields such as - the location and organization. - common_name (str): - The "common name" of the distinguished name. - subject_alt_name (google.cloud.security.privateca_v1beta1.types.SubjectAltNames): - The subject alternative name fields. - hex_serial_number (str): - The serial number encoded in lowercase - hexadecimal. - lifetime (google.protobuf.duration_pb2.Duration): - For convenience, the actual lifetime of an issued - certificate. Corresponds to 'not_after_time' - - 'not_before_time'. - not_before_time (google.protobuf.timestamp_pb2.Timestamp): - The time at which the certificate becomes - valid. - not_after_time (google.protobuf.timestamp_pb2.Timestamp): - The time at which the certificate expires. - """ - - subject: 'Subject' = proto.Field( - proto.MESSAGE, - number=1, - message='Subject', - ) - common_name: str = proto.Field( - proto.STRING, - number=2, - ) - subject_alt_name: 'SubjectAltNames' = proto.Field( - proto.MESSAGE, - number=3, - message='SubjectAltNames', - ) - hex_serial_number: str = proto.Field( - proto.STRING, - number=4, - ) - lifetime: duration_pb2.Duration = proto.Field( - proto.MESSAGE, - number=5, - message=duration_pb2.Duration, - ) - not_before_time: timestamp_pb2.Timestamp = proto.Field( - proto.MESSAGE, - number=6, - message=timestamp_pb2.Timestamp, - ) - not_after_time: timestamp_pb2.Timestamp = proto.Field( - proto.MESSAGE, - number=7, - message=timestamp_pb2.Timestamp, - ) - - class KeyId(proto.Message): - r"""A KeyId identifies a specific public key, usually by hashing - the public key. - - Attributes: - key_id (str): - Optional. The value of this KeyId encoded in - lowercase hexadecimal. This is most likely the - 160 bit SHA-1 hash of the public key. - """ - - key_id: str = 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: str = proto.Field( - proto.STRING, - number=1, - ) - - subject_description: SubjectDescription = proto.Field( - proto.MESSAGE, - number=1, - message=SubjectDescription, - ) - config_values: 'ReusableConfigValues' = proto.Field( - proto.MESSAGE, - number=2, - message='ReusableConfigValues', - ) - public_key: 'PublicKey' = proto.Field( - proto.MESSAGE, - number=3, - message='PublicKey', - ) - subject_key_id: KeyId = proto.Field( - proto.MESSAGE, - number=4, - message=KeyId, - ) - authority_key_id: KeyId = proto.Field( - proto.MESSAGE, - number=5, - message=KeyId, - ) - crl_distribution_points: MutableSequence[str] = proto.RepeatedField( - proto.STRING, - number=6, - ) - aia_issuing_certificate_urls: MutableSequence[str] = proto.RepeatedField( - proto.STRING, - number=7, - ) - cert_fingerprint: CertificateFingerprint = proto.Field( - proto.MESSAGE, - number=8, - message=CertificateFingerprint, - ) - - -class ObjectId(proto.Message): - r"""An [ObjectId][google.cloud.security.privateca.v1beta1.ObjectId] - specifies an object identifier (OID). These provide context and - describe types in ASN.1 messages. - - Attributes: - object_id_path (MutableSequence[int]): - Required. The parts of an OID path. The most - significant parts of the path come first. - """ - - object_id_path: MutableSequence[int] = proto.RepeatedField( - proto.INT32, - number=1, - ) - - -class X509Extension(proto.Message): - r"""An - [X509Extension][google.cloud.security.privateca.v1beta1.X509Extension] - specifies an X.509 extension, which may be used in different parts - of X.509 objects like certificates, CSRs, and CRLs. - - Attributes: - object_id (google.cloud.security.privateca_v1beta1.types.ObjectId): - Required. The OID for this X.509 extension. - critical (bool): - Required. Indicates whether or not this - extension is critical (i.e., if the client does - not know how to handle this extension, the - client should consider this to be an error). - value (bytes): - Required. The value of this X.509 extension. - """ - - object_id: 'ObjectId' = proto.Field( - proto.MESSAGE, - number=1, - message='ObjectId', - ) - critical: bool = proto.Field( - proto.BOOL, - number=2, - ) - value: bytes = proto.Field( - proto.BYTES, - number=3, - ) - - -class KeyUsage(proto.Message): - r"""A [KeyUsage][google.cloud.security.privateca.v1beta1.KeyUsage] - describes key usage values that may appear in an X.509 certificate. - - Attributes: - base_key_usage (google.cloud.security.privateca_v1beta1.types.KeyUsage.KeyUsageOptions): - Describes high-level ways in which a key may - be used. - extended_key_usage (google.cloud.security.privateca_v1beta1.types.KeyUsage.ExtendedKeyUsageOptions): - Detailed scenarios in which a key may be - used. - unknown_extended_key_usages (MutableSequence[google.cloud.security.privateca_v1beta1.types.ObjectId]): - Used to describe extended key usages that are not listed in - the - [KeyUsage.ExtendedKeyUsageOptions][google.cloud.security.privateca.v1beta1.KeyUsage.ExtendedKeyUsageOptions] - message. - """ - - class KeyUsageOptions(proto.Message): - r"""[KeyUsage.KeyUsageOptions][google.cloud.security.privateca.v1beta1.KeyUsage.KeyUsageOptions] - corresponds to the key usage values described in - https://tools.ietf.org/html/rfc5280#section-4.2.1.3. - - Attributes: - digital_signature (bool): - The key may be used for digital signatures. - content_commitment (bool): - The key may be used for cryptographic - commitments. Note that this may also be referred - to as "non-repudiation". - key_encipherment (bool): - The key may be used to encipher other keys. - data_encipherment (bool): - The key may be used to encipher data. - key_agreement (bool): - The key may be used in a key agreement - protocol. - cert_sign (bool): - The key may be used to sign certificates. - crl_sign (bool): - The key may be used sign certificate - revocation lists. - encipher_only (bool): - The key may be used to encipher only. - decipher_only (bool): - The key may be used to decipher only. - """ - - digital_signature: bool = proto.Field( - proto.BOOL, - number=1, - ) - content_commitment: bool = proto.Field( - proto.BOOL, - number=2, - ) - key_encipherment: bool = proto.Field( - proto.BOOL, - number=3, - ) - data_encipherment: bool = proto.Field( - proto.BOOL, - number=4, - ) - key_agreement: bool = proto.Field( - proto.BOOL, - number=5, - ) - cert_sign: bool = proto.Field( - proto.BOOL, - number=6, - ) - crl_sign: bool = proto.Field( - proto.BOOL, - number=7, - ) - encipher_only: bool = proto.Field( - proto.BOOL, - number=8, - ) - decipher_only: bool = proto.Field( - proto.BOOL, - number=9, - ) - - class ExtendedKeyUsageOptions(proto.Message): - r"""[KeyUsage.ExtendedKeyUsageOptions][google.cloud.security.privateca.v1beta1.KeyUsage.ExtendedKeyUsageOptions] - has fields that correspond to certain common OIDs that could be - specified as an extended key usage value. - - Attributes: - server_auth (bool): - Corresponds to OID 1.3.6.1.5.5.7.3.1. - Officially described as "TLS WWW server - authentication", though regularly used for - non-WWW TLS. - client_auth (bool): - Corresponds to OID 1.3.6.1.5.5.7.3.2. - Officially described as "TLS WWW client - authentication", though regularly used for - non-WWW TLS. - code_signing (bool): - Corresponds to OID 1.3.6.1.5.5.7.3.3. - Officially described as "Signing of downloadable - executable code client authentication". - email_protection (bool): - Corresponds to OID 1.3.6.1.5.5.7.3.4. - Officially described as "Email protection". - time_stamping (bool): - Corresponds to OID 1.3.6.1.5.5.7.3.8. - Officially described as "Binding the hash of an - object to a time". - ocsp_signing (bool): - Corresponds to OID 1.3.6.1.5.5.7.3.9. - Officially described as "Signing OCSP - responses". - """ - - server_auth: bool = proto.Field( - proto.BOOL, - number=1, - ) - client_auth: bool = proto.Field( - proto.BOOL, - number=2, - ) - code_signing: bool = proto.Field( - proto.BOOL, - number=3, - ) - email_protection: bool = proto.Field( - proto.BOOL, - number=4, - ) - time_stamping: bool = proto.Field( - proto.BOOL, - number=5, - ) - ocsp_signing: bool = proto.Field( - proto.BOOL, - number=6, - ) - - base_key_usage: KeyUsageOptions = proto.Field( - proto.MESSAGE, - number=1, - message=KeyUsageOptions, - ) - extended_key_usage: ExtendedKeyUsageOptions = proto.Field( - proto.MESSAGE, - number=2, - message=ExtendedKeyUsageOptions, - ) - unknown_extended_key_usages: MutableSequence['ObjectId'] = proto.RepeatedField( - proto.MESSAGE, - number=3, - message='ObjectId', - ) - - -class Subject(proto.Message): - r"""[Subject][google.cloud.security.privateca.v1beta1.Subject] describes - parts of a distinguished name that, in turn, describes the subject - of the certificate. - - Attributes: - country_code (str): - The country code of the subject. - organization (str): - The organization of the subject. - organizational_unit (str): - The organizational_unit of the subject. - locality (str): - The locality or city of the subject. - province (str): - The province, territory, or regional state of - the subject. - street_address (str): - The street address of the subject. - postal_code (str): - The postal code of the subject. - """ - - country_code: str = proto.Field( - proto.STRING, - number=1, - ) - organization: str = proto.Field( - proto.STRING, - number=2, - ) - organizational_unit: str = proto.Field( - proto.STRING, - number=3, - ) - locality: str = proto.Field( - proto.STRING, - number=4, - ) - province: str = proto.Field( - proto.STRING, - number=5, - ) - street_address: str = proto.Field( - proto.STRING, - number=6, - ) - postal_code: str = proto.Field( - proto.STRING, - number=7, - ) - - -class SubjectAltNames(proto.Message): - r"""[SubjectAltNames][google.cloud.security.privateca.v1beta1.SubjectAltNames] - corresponds to a more modern way of listing what the asserted - identity is in a certificate (i.e., compared to the "common name" in - the distinguished name). - - Attributes: - dns_names (MutableSequence[str]): - Contains only valid, fully-qualified host - names. - uris (MutableSequence[str]): - Contains only valid RFC 3986 URIs. - email_addresses (MutableSequence[str]): - Contains only valid RFC 2822 E-mail - addresses. - ip_addresses (MutableSequence[str]): - Contains only valid 32-bit IPv4 addresses or - RFC 4291 IPv6 addresses. - custom_sans (MutableSequence[google.cloud.security.privateca_v1beta1.types.X509Extension]): - Contains additional subject alternative name - values. - """ - - dns_names: MutableSequence[str] = proto.RepeatedField( - proto.STRING, - number=1, - ) - uris: MutableSequence[str] = proto.RepeatedField( - proto.STRING, - number=2, - ) - email_addresses: MutableSequence[str] = proto.RepeatedField( - proto.STRING, - number=3, - ) - ip_addresses: MutableSequence[str] = proto.RepeatedField( - proto.STRING, - number=4, - ) - custom_sans: MutableSequence['X509Extension'] = proto.RepeatedField( - proto.MESSAGE, - number=5, - message='X509Extension', - ) - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/owl-bot-staging/v1beta1/google/cloud/security/privateca_v1beta1/types/service.py b/owl-bot-staging/v1beta1/google/cloud/security/privateca_v1beta1/types/service.py deleted file mode 100644 index 4c505a9..0000000 --- a/owl-bot-staging/v1beta1/google/cloud/security/privateca_v1beta1/types/service.py +++ /dev/null @@ -1,1124 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -from typing import MutableMapping, MutableSequence - -import proto # type: ignore - -from google.cloud.security.privateca_v1beta1.types import resources -from google.protobuf import field_mask_pb2 # type: ignore -from google.protobuf import timestamp_pb2 # type: ignore - - -__protobuf__ = proto.module( - package='google.cloud.security.privateca.v1beta1', - manifest={ - 'CreateCertificateRequest', - 'GetCertificateRequest', - 'ListCertificatesRequest', - 'ListCertificatesResponse', - 'RevokeCertificateRequest', - 'UpdateCertificateRequest', - 'ActivateCertificateAuthorityRequest', - 'CreateCertificateAuthorityRequest', - 'DisableCertificateAuthorityRequest', - 'EnableCertificateAuthorityRequest', - 'FetchCertificateAuthorityCsrRequest', - 'FetchCertificateAuthorityCsrResponse', - 'GetCertificateAuthorityRequest', - 'ListCertificateAuthoritiesRequest', - 'ListCertificateAuthoritiesResponse', - 'RestoreCertificateAuthorityRequest', - 'ScheduleDeleteCertificateAuthorityRequest', - 'UpdateCertificateAuthorityRequest', - 'GetCertificateRevocationListRequest', - 'ListCertificateRevocationListsRequest', - 'ListCertificateRevocationListsResponse', - 'UpdateCertificateRevocationListRequest', - 'GetReusableConfigRequest', - 'ListReusableConfigsRequest', - 'ListReusableConfigsResponse', - 'OperationMetadata', - }, -) - - -class CreateCertificateRequest(proto.Message): - r"""Request message for - [CertificateAuthorityService.CreateCertificate][google.cloud.security.privateca.v1beta1.CertificateAuthorityService.CreateCertificate]. - - Attributes: - parent (str): - Required. The resource name of the location and - [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority] - associated with the - [Certificate][google.cloud.security.privateca.v1beta1.Certificate], - in the format - ``projects/*/locations/*/certificateAuthorities/*``. - certificate_id (str): - Optional. It must be unique within a location and match the - regular expression ``[a-zA-Z0-9_-]{1,63}``. This field is - required when using a - [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority] - in the Enterprise - [CertificateAuthority.Tier][google.cloud.security.privateca.v1beta1.CertificateAuthority.Tier], - but is optional and its value is ignored otherwise. - certificate (google.cloud.security.privateca_v1beta1.types.Certificate): - Required. A - [Certificate][google.cloud.security.privateca.v1beta1.Certificate] - with initial field values. - request_id (str): - Optional. An ID to identify requests. Specify - a unique request ID so that if you must retry - your request, the server will know to ignore the - request if it has already been completed. The - server will guarantee that for at least 60 - minutes since the first request. - - For example, consider a situation where you make - an initial request and t he request times out. - If you make the request again with the same - request ID, the server can check if original - operation with the same request ID was received, - and if so, will ignore the second request. This - prevents clients from accidentally creating - duplicate commitments. - The request ID must be a valid UUID with the - exception that zero UUID is not supported - (00000000-0000-0000-0000-000000000000). - """ - - parent: str = proto.Field( - proto.STRING, - number=1, - ) - certificate_id: str = proto.Field( - proto.STRING, - number=2, - ) - certificate: resources.Certificate = proto.Field( - proto.MESSAGE, - number=3, - message=resources.Certificate, - ) - request_id: str = proto.Field( - proto.STRING, - number=4, - ) - - -class GetCertificateRequest(proto.Message): - r"""Request message for - [CertificateAuthorityService.GetCertificate][google.cloud.security.privateca.v1beta1.CertificateAuthorityService.GetCertificate]. - - Attributes: - name (str): - Required. The - [name][google.cloud.security.privateca.v1beta1.Certificate.name] - of the - [Certificate][google.cloud.security.privateca.v1beta1.Certificate] - to get. - """ - - name: str = proto.Field( - proto.STRING, - number=1, - ) - - -class ListCertificatesRequest(proto.Message): - r"""Request message for - [CertificateAuthorityService.ListCertificates][google.cloud.security.privateca.v1beta1.CertificateAuthorityService.ListCertificates]. - - Attributes: - parent (str): - Required. The resource name of the location associated with - the - [Certificates][google.cloud.security.privateca.v1beta1.Certificate], - in the format - ``projects/*/locations/*/certificateauthorities/*``. - page_size (int): - Optional. Limit on the number of - [Certificates][google.cloud.security.privateca.v1beta1.Certificate] - to include in the response. Further - [Certificates][google.cloud.security.privateca.v1beta1.Certificate] - can subsequently be obtained by including the - [ListCertificatesResponse.next_page_token][google.cloud.security.privateca.v1beta1.ListCertificatesResponse.next_page_token] - in a subsequent request. If unspecified, the server will - pick an appropriate default. - page_token (str): - Optional. Pagination token, returned earlier via - [ListCertificatesResponse.next_page_token][google.cloud.security.privateca.v1beta1.ListCertificatesResponse.next_page_token]. - filter (str): - Optional. Only include resources that match the filter in - the response. For details on supported filters and syntax, - see `Certificates Filtering - documentation `__. - order_by (str): - Optional. Specify how the results should be sorted. For - details on supported fields and syntax, see `Certificates - Sorting - documentation `__. - """ - - parent: str = proto.Field( - proto.STRING, - number=1, - ) - page_size: int = proto.Field( - proto.INT32, - number=2, - ) - page_token: str = proto.Field( - proto.STRING, - number=3, - ) - filter: str = proto.Field( - proto.STRING, - number=4, - ) - order_by: str = proto.Field( - proto.STRING, - number=5, - ) - - -class ListCertificatesResponse(proto.Message): - r"""Response message for - [CertificateAuthorityService.ListCertificates][google.cloud.security.privateca.v1beta1.CertificateAuthorityService.ListCertificates]. - - Attributes: - certificates (MutableSequence[google.cloud.security.privateca_v1beta1.types.Certificate]): - The list of - [Certificates][google.cloud.security.privateca.v1beta1.Certificate]. - next_page_token (str): - A token to retrieve next page of results. Pass this value in - [ListCertificatesRequest.next_page_token][] to retrieve the - next page of results. - unreachable (MutableSequence[str]): - A list of locations (e.g. "us-west1") that - could not be reached. - """ - - @property - def raw_page(self): - return self - - certificates: MutableSequence[resources.Certificate] = proto.RepeatedField( - proto.MESSAGE, - number=1, - message=resources.Certificate, - ) - next_page_token: str = proto.Field( - proto.STRING, - number=2, - ) - unreachable: MutableSequence[str] = proto.RepeatedField( - proto.STRING, - number=3, - ) - - -class RevokeCertificateRequest(proto.Message): - r"""Request message for - [CertificateAuthorityService.RevokeCertificate][google.cloud.security.privateca.v1beta1.CertificateAuthorityService.RevokeCertificate]. - - Attributes: - name (str): - Required. The resource name for this - [Certificate][google.cloud.security.privateca.v1beta1.Certificate] - in the format - ``projects/*/locations/*/certificateAuthorities/*/certificates/*``. - reason (google.cloud.security.privateca_v1beta1.types.RevocationReason): - Required. The - [RevocationReason][google.cloud.security.privateca.v1beta1.RevocationReason] - for revoking this certificate. - request_id (str): - Optional. An ID to identify requests. Specify - a unique request ID so that if you must retry - your request, the server will know to ignore the - request if it has already been completed. The - server will guarantee that for at least 60 - minutes since the first request. - - For example, consider a situation where you make - an initial request and t he request times out. - If you make the request again with the same - request ID, the server can check if original - operation with the same request ID was received, - and if so, will ignore the second request. This - prevents clients from accidentally creating - duplicate commitments. - The request ID must be a valid UUID with the - exception that zero UUID is not supported - (00000000-0000-0000-0000-000000000000). - """ - - name: str = proto.Field( - proto.STRING, - number=1, - ) - reason: resources.RevocationReason = proto.Field( - proto.ENUM, - number=2, - enum=resources.RevocationReason, - ) - request_id: str = proto.Field( - proto.STRING, - number=3, - ) - - -class UpdateCertificateRequest(proto.Message): - r"""Request message for - [CertificateAuthorityService.UpdateCertificate][google.cloud.security.privateca.v1beta1.CertificateAuthorityService.UpdateCertificate]. - - Attributes: - certificate (google.cloud.security.privateca_v1beta1.types.Certificate): - Required. - [Certificate][google.cloud.security.privateca.v1beta1.Certificate] - with updated values. - update_mask (google.protobuf.field_mask_pb2.FieldMask): - Required. A list of fields to be updated in - this request. - request_id (str): - Optional. An ID to identify requests. Specify - a unique request ID so that if you must retry - your request, the server will know to ignore the - request if it has already been completed. The - server will guarantee that for at least 60 - minutes since the first request. - - For example, consider a situation where you make - an initial request and t he request times out. - If you make the request again with the same - request ID, the server can check if original - operation with the same request ID was received, - and if so, will ignore the second request. This - prevents clients from accidentally creating - duplicate commitments. - The request ID must be a valid UUID with the - exception that zero UUID is not supported - (00000000-0000-0000-0000-000000000000). - """ - - certificate: resources.Certificate = proto.Field( - proto.MESSAGE, - number=1, - message=resources.Certificate, - ) - update_mask: field_mask_pb2.FieldMask = proto.Field( - proto.MESSAGE, - number=2, - message=field_mask_pb2.FieldMask, - ) - request_id: str = proto.Field( - proto.STRING, - number=3, - ) - - -class ActivateCertificateAuthorityRequest(proto.Message): - r"""Request message for - [CertificateAuthorityService.ActivateCertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthorityService.ActivateCertificateAuthority]. - - Attributes: - name (str): - Required. The resource name for this - [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority] - in the format - ``projects/*/locations/*/certificateAuthorities/*``. - pem_ca_certificate (str): - Required. The signed CA certificate issued from - [FetchCertificateAuthorityCsrResponse.pem_csr][google.cloud.security.privateca.v1beta1.FetchCertificateAuthorityCsrResponse.pem_csr]. - subordinate_config (google.cloud.security.privateca_v1beta1.types.SubordinateConfig): - Required. Must include information about the issuer of - 'pem_ca_certificate', and any further issuers until the - self-signed CA. - request_id (str): - Optional. An ID to identify requests. Specify - a unique request ID so that if you must retry - your request, the server will know to ignore the - request if it has already been completed. The - server will guarantee that for at least 60 - minutes since the first request. - - For example, consider a situation where you make - an initial request and t he request times out. - If you make the request again with the same - request ID, the server can check if original - operation with the same request ID was received, - and if so, will ignore the second request. This - prevents clients from accidentally creating - duplicate commitments. - The request ID must be a valid UUID with the - exception that zero UUID is not supported - (00000000-0000-0000-0000-000000000000). - """ - - name: str = proto.Field( - proto.STRING, - number=1, - ) - pem_ca_certificate: str = proto.Field( - proto.STRING, - number=2, - ) - subordinate_config: resources.SubordinateConfig = proto.Field( - proto.MESSAGE, - number=3, - message=resources.SubordinateConfig, - ) - request_id: str = proto.Field( - proto.STRING, - number=4, - ) - - -class CreateCertificateAuthorityRequest(proto.Message): - r"""Request message for - [CertificateAuthorityService.CreateCertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthorityService.CreateCertificateAuthority]. - - Attributes: - parent (str): - Required. The resource name of the location associated with - the - [CertificateAuthorities][google.cloud.security.privateca.v1beta1.CertificateAuthority], - in the format ``projects/*/locations/*``. - certificate_authority_id (str): - Required. It must be unique within a location and match the - regular expression ``[a-zA-Z0-9_-]{1,63}`` - certificate_authority (google.cloud.security.privateca_v1beta1.types.CertificateAuthority): - Required. A - [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority] - with initial field values. - request_id (str): - Optional. An ID to identify requests. Specify - a unique request ID so that if you must retry - your request, the server will know to ignore the - request if it has already been completed. The - server will guarantee that for at least 60 - minutes since the first request. - - For example, consider a situation where you make - an initial request and t he request times out. - If you make the request again with the same - request ID, the server can check if original - operation with the same request ID was received, - and if so, will ignore the second request. This - prevents clients from accidentally creating - duplicate commitments. - The request ID must be a valid UUID with the - exception that zero UUID is not supported - (00000000-0000-0000-0000-000000000000). - """ - - parent: str = proto.Field( - proto.STRING, - number=1, - ) - certificate_authority_id: str = proto.Field( - proto.STRING, - number=2, - ) - certificate_authority: resources.CertificateAuthority = proto.Field( - proto.MESSAGE, - number=3, - message=resources.CertificateAuthority, - ) - request_id: str = proto.Field( - proto.STRING, - number=4, - ) - - -class DisableCertificateAuthorityRequest(proto.Message): - r"""Request message for - [CertificateAuthorityService.DisableCertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthorityService.DisableCertificateAuthority]. - - Attributes: - name (str): - Required. The resource name for this - [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority] - in the format - ``projects/*/locations/*/certificateAuthorities/*``. - request_id (str): - Optional. An ID to identify requests. Specify - a unique request ID so that if you must retry - your request, the server will know to ignore the - request if it has already been completed. The - server will guarantee that for at least 60 - minutes since the first request. - - For example, consider a situation where you make - an initial request and t he request times out. - If you make the request again with the same - request ID, the server can check if original - operation with the same request ID was received, - and if so, will ignore the second request. This - prevents clients from accidentally creating - duplicate commitments. - The request ID must be a valid UUID with the - exception that zero UUID is not supported - (00000000-0000-0000-0000-000000000000). - """ - - name: str = proto.Field( - proto.STRING, - number=1, - ) - request_id: str = proto.Field( - proto.STRING, - number=2, - ) - - -class EnableCertificateAuthorityRequest(proto.Message): - r"""Request message for - [CertificateAuthorityService.EnableCertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthorityService.EnableCertificateAuthority]. - - Attributes: - name (str): - Required. The resource name for this - [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority] - in the format - ``projects/*/locations/*/certificateAuthorities/*``. - request_id (str): - Optional. An ID to identify requests. Specify - a unique request ID so that if you must retry - your request, the server will know to ignore the - request if it has already been completed. The - server will guarantee that for at least 60 - minutes since the first request. - - For example, consider a situation where you make - an initial request and t he request times out. - If you make the request again with the same - request ID, the server can check if original - operation with the same request ID was received, - and if so, will ignore the second request. This - prevents clients from accidentally creating - duplicate commitments. - The request ID must be a valid UUID with the - exception that zero UUID is not supported - (00000000-0000-0000-0000-000000000000). - """ - - name: str = proto.Field( - proto.STRING, - number=1, - ) - request_id: str = proto.Field( - proto.STRING, - number=2, - ) - - -class FetchCertificateAuthorityCsrRequest(proto.Message): - r"""Request message for - [CertificateAuthorityService.FetchCertificateAuthorityCsr][google.cloud.security.privateca.v1beta1.CertificateAuthorityService.FetchCertificateAuthorityCsr]. - - Attributes: - name (str): - Required. The resource name for this - [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority] - in the format - ``projects/*/locations/*/certificateAuthorities/*``. - """ - - name: str = proto.Field( - proto.STRING, - number=1, - ) - - -class FetchCertificateAuthorityCsrResponse(proto.Message): - r"""Response message for - [CertificateAuthorityService.FetchCertificateAuthorityCsr][google.cloud.security.privateca.v1beta1.CertificateAuthorityService.FetchCertificateAuthorityCsr]. - - Attributes: - pem_csr (str): - Output only. The PEM-encoded signed - certificate signing request (CSR). - """ - - pem_csr: str = proto.Field( - proto.STRING, - number=1, - ) - - -class GetCertificateAuthorityRequest(proto.Message): - r"""Request message for - [CertificateAuthorityService.GetCertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthorityService.GetCertificateAuthority]. - - Attributes: - name (str): - Required. The - [name][google.cloud.security.privateca.v1beta1.CertificateAuthority.name] - of the - [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority] - to get. - """ - - name: str = proto.Field( - proto.STRING, - number=1, - ) - - -class ListCertificateAuthoritiesRequest(proto.Message): - r"""Request message for - [CertificateAuthorityService.ListCertificateAuthorities][google.cloud.security.privateca.v1beta1.CertificateAuthorityService.ListCertificateAuthorities]. - - Attributes: - parent (str): - Required. The resource name of the location associated with - the - [CertificateAuthorities][google.cloud.security.privateca.v1beta1.CertificateAuthority], - in the format ``projects/*/locations/*``. - page_size (int): - Optional. Limit on the number of - [CertificateAuthorities][google.cloud.security.privateca.v1beta1.CertificateAuthority] - to include in the response. Further - [CertificateAuthorities][google.cloud.security.privateca.v1beta1.CertificateAuthority] - can subsequently be obtained by including the - [ListCertificateAuthoritiesResponse.next_page_token][google.cloud.security.privateca.v1beta1.ListCertificateAuthoritiesResponse.next_page_token] - in a subsequent request. If unspecified, the server will - pick an appropriate default. - page_token (str): - Optional. Pagination token, returned earlier via - [ListCertificateAuthoritiesResponse.next_page_token][google.cloud.security.privateca.v1beta1.ListCertificateAuthoritiesResponse.next_page_token]. - filter (str): - Optional. Only include resources that match - the filter in the response. - order_by (str): - Optional. Specify how the results should be - sorted. - """ - - parent: str = proto.Field( - proto.STRING, - number=1, - ) - page_size: int = proto.Field( - proto.INT32, - number=2, - ) - page_token: str = proto.Field( - proto.STRING, - number=3, - ) - filter: str = proto.Field( - proto.STRING, - number=4, - ) - order_by: str = proto.Field( - proto.STRING, - number=5, - ) - - -class ListCertificateAuthoritiesResponse(proto.Message): - r"""Response message for - [CertificateAuthorityService.ListCertificateAuthorities][google.cloud.security.privateca.v1beta1.CertificateAuthorityService.ListCertificateAuthorities]. - - Attributes: - certificate_authorities (MutableSequence[google.cloud.security.privateca_v1beta1.types.CertificateAuthority]): - The list of - [CertificateAuthorities][google.cloud.security.privateca.v1beta1.CertificateAuthority]. - next_page_token (str): - A token to retrieve next page of results. Pass this value in - [ListCertificateAuthoritiesRequest.next_page_token][] to - retrieve the next page of results. - unreachable (MutableSequence[str]): - A list of locations (e.g. "us-west1") that - could not be reached. - """ - - @property - def raw_page(self): - return self - - certificate_authorities: MutableSequence[resources.CertificateAuthority] = proto.RepeatedField( - proto.MESSAGE, - number=1, - message=resources.CertificateAuthority, - ) - next_page_token: str = proto.Field( - proto.STRING, - number=2, - ) - unreachable: MutableSequence[str] = proto.RepeatedField( - proto.STRING, - number=3, - ) - - -class RestoreCertificateAuthorityRequest(proto.Message): - r"""Request message for - [CertificateAuthorityService.RestoreCertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthorityService.RestoreCertificateAuthority]. - - Attributes: - name (str): - Required. The resource name for this - [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority] - in the format - ``projects/*/locations/*/certificateAuthorities/*``. - request_id (str): - Optional. An ID to identify requests. Specify - a unique request ID so that if you must retry - your request, the server will know to ignore the - request if it has already been completed. The - server will guarantee that for at least 60 - minutes since the first request. - - For example, consider a situation where you make - an initial request and t he request times out. - If you make the request again with the same - request ID, the server can check if original - operation with the same request ID was received, - and if so, will ignore the second request. This - prevents clients from accidentally creating - duplicate commitments. - The request ID must be a valid UUID with the - exception that zero UUID is not supported - (00000000-0000-0000-0000-000000000000). - """ - - name: str = proto.Field( - proto.STRING, - number=1, - ) - request_id: str = proto.Field( - proto.STRING, - number=2, - ) - - -class ScheduleDeleteCertificateAuthorityRequest(proto.Message): - r"""Request message for - [CertificateAuthorityService.ScheduleDeleteCertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthorityService.ScheduleDeleteCertificateAuthority]. - - Attributes: - name (str): - Required. The resource name for this - [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority] - in the format - ``projects/*/locations/*/certificateAuthorities/*``. - request_id (str): - Optional. An ID to identify requests. Specify - a unique request ID so that if you must retry - your request, the server will know to ignore the - request if it has already been completed. The - server will guarantee that for at least 60 - minutes since the first request. - - For example, consider a situation where you make - an initial request and t he request times out. - If you make the request again with the same - request ID, the server can check if original - operation with the same request ID was received, - and if so, will ignore the second request. This - prevents clients from accidentally creating - duplicate commitments. - The request ID must be a valid UUID with the - exception that zero UUID is not supported - (00000000-0000-0000-0000-000000000000). - """ - - name: str = proto.Field( - proto.STRING, - number=1, - ) - request_id: str = proto.Field( - proto.STRING, - number=2, - ) - - -class UpdateCertificateAuthorityRequest(proto.Message): - r"""Request message for - [CertificateAuthorityService.UpdateCertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthorityService.UpdateCertificateAuthority]. - - Attributes: - certificate_authority (google.cloud.security.privateca_v1beta1.types.CertificateAuthority): - Required. - [CertificateAuthority][google.cloud.security.privateca.v1beta1.CertificateAuthority] - with updated values. - update_mask (google.protobuf.field_mask_pb2.FieldMask): - Required. A list of fields to be updated in - this request. - request_id (str): - Optional. An ID to identify requests. Specify - a unique request ID so that if you must retry - your request, the server will know to ignore the - request if it has already been completed. The - server will guarantee that for at least 60 - minutes since the first request. - - For example, consider a situation where you make - an initial request and t he request times out. - If you make the request again with the same - request ID, the server can check if original - operation with the same request ID was received, - and if so, will ignore the second request. This - prevents clients from accidentally creating - duplicate commitments. - The request ID must be a valid UUID with the - exception that zero UUID is not supported - (00000000-0000-0000-0000-000000000000). - """ - - certificate_authority: resources.CertificateAuthority = proto.Field( - proto.MESSAGE, - number=1, - message=resources.CertificateAuthority, - ) - update_mask: field_mask_pb2.FieldMask = proto.Field( - proto.MESSAGE, - number=2, - message=field_mask_pb2.FieldMask, - ) - request_id: str = proto.Field( - proto.STRING, - number=3, - ) - - -class GetCertificateRevocationListRequest(proto.Message): - r"""Request message for - [CertificateAuthorityService.GetCertificateRevocationList][google.cloud.security.privateca.v1beta1.CertificateAuthorityService.GetCertificateRevocationList]. - - Attributes: - name (str): - Required. The - [name][google.cloud.security.privateca.v1beta1.CertificateRevocationList.name] - of the - [CertificateRevocationList][google.cloud.security.privateca.v1beta1.CertificateRevocationList] - to get. - """ - - name: str = proto.Field( - proto.STRING, - number=1, - ) - - -class ListCertificateRevocationListsRequest(proto.Message): - r"""Request message for - [CertificateAuthorityService.ListCertificateRevocationLists][google.cloud.security.privateca.v1beta1.CertificateAuthorityService.ListCertificateRevocationLists]. - - Attributes: - parent (str): - Required. The resource name of the location associated with - the - [CertificateRevocationLists][google.cloud.security.privateca.v1beta1.CertificateRevocationList], - in the format - ``projects/*/locations/*/certificateauthorities/*``. - page_size (int): - Optional. Limit on the number of - [CertificateRevocationLists][google.cloud.security.privateca.v1beta1.CertificateRevocationList] - to include in the response. Further - [CertificateRevocationLists][google.cloud.security.privateca.v1beta1.CertificateRevocationList] - can subsequently be obtained by including the - [ListCertificateRevocationListsResponse.next_page_token][google.cloud.security.privateca.v1beta1.ListCertificateRevocationListsResponse.next_page_token] - in a subsequent request. If unspecified, the server will - pick an appropriate default. - page_token (str): - Optional. Pagination token, returned earlier via - [ListCertificateRevocationListsResponse.next_page_token][google.cloud.security.privateca.v1beta1.ListCertificateRevocationListsResponse.next_page_token]. - filter (str): - Optional. Only include resources that match - the filter in the response. - order_by (str): - Optional. Specify how the results should be - sorted. - """ - - parent: str = proto.Field( - proto.STRING, - number=1, - ) - page_size: int = proto.Field( - proto.INT32, - number=2, - ) - page_token: str = proto.Field( - proto.STRING, - number=3, - ) - filter: str = proto.Field( - proto.STRING, - number=4, - ) - order_by: str = proto.Field( - proto.STRING, - number=5, - ) - - -class ListCertificateRevocationListsResponse(proto.Message): - r"""Response message for - [CertificateAuthorityService.ListCertificateRevocationLists][google.cloud.security.privateca.v1beta1.CertificateAuthorityService.ListCertificateRevocationLists]. - - Attributes: - certificate_revocation_lists (MutableSequence[google.cloud.security.privateca_v1beta1.types.CertificateRevocationList]): - The list of - [CertificateRevocationLists][google.cloud.security.privateca.v1beta1.CertificateRevocationList]. - next_page_token (str): - A token to retrieve next page of results. Pass this value in - [ListCertificateRevocationListsRequest.next_page_token][] to - retrieve the next page of results. - unreachable (MutableSequence[str]): - A list of locations (e.g. "us-west1") that - could not be reached. - """ - - @property - def raw_page(self): - return self - - certificate_revocation_lists: MutableSequence[resources.CertificateRevocationList] = proto.RepeatedField( - proto.MESSAGE, - number=1, - message=resources.CertificateRevocationList, - ) - next_page_token: str = proto.Field( - proto.STRING, - number=2, - ) - unreachable: MutableSequence[str] = proto.RepeatedField( - proto.STRING, - number=3, - ) - - -class UpdateCertificateRevocationListRequest(proto.Message): - r"""Request message for - [CertificateAuthorityService.UpdateCertificateRevocationList][google.cloud.security.privateca.v1beta1.CertificateAuthorityService.UpdateCertificateRevocationList]. - - Attributes: - certificate_revocation_list (google.cloud.security.privateca_v1beta1.types.CertificateRevocationList): - Required. - [CertificateRevocationList][google.cloud.security.privateca.v1beta1.CertificateRevocationList] - with updated values. - update_mask (google.protobuf.field_mask_pb2.FieldMask): - Required. A list of fields to be updated in - this request. - request_id (str): - Optional. An ID to identify requests. Specify - a unique request ID so that if you must retry - your request, the server will know to ignore the - request if it has already been completed. The - server will guarantee that for at least 60 - minutes since the first request. - - For example, consider a situation where you make - an initial request and t he request times out. - If you make the request again with the same - request ID, the server can check if original - operation with the same request ID was received, - and if so, will ignore the second request. This - prevents clients from accidentally creating - duplicate commitments. - The request ID must be a valid UUID with the - exception that zero UUID is not supported - (00000000-0000-0000-0000-000000000000). - """ - - certificate_revocation_list: resources.CertificateRevocationList = proto.Field( - proto.MESSAGE, - number=1, - message=resources.CertificateRevocationList, - ) - update_mask: field_mask_pb2.FieldMask = proto.Field( - proto.MESSAGE, - number=2, - message=field_mask_pb2.FieldMask, - ) - request_id: str = proto.Field( - proto.STRING, - number=3, - ) - - -class GetReusableConfigRequest(proto.Message): - r"""Request message for - [CertificateAuthorityService.GetReusableConfig][google.cloud.security.privateca.v1beta1.CertificateAuthorityService.GetReusableConfig]. - - Attributes: - name (str): - Required. The [name][ReusableConfigs.name] of the - [ReusableConfigs][] to get. - """ - - name: str = proto.Field( - proto.STRING, - number=1, - ) - - -class ListReusableConfigsRequest(proto.Message): - r"""Request message for - [CertificateAuthorityService.ListReusableConfigs][google.cloud.security.privateca.v1beta1.CertificateAuthorityService.ListReusableConfigs]. - - Attributes: - parent (str): - Required. The resource name of the location associated with - the - [ReusableConfigs][google.cloud.security.privateca.v1beta1.ReusableConfig], - in the format ``projects/*/locations/*``. - page_size (int): - Optional. Limit on the number of - [ReusableConfigs][google.cloud.security.privateca.v1beta1.ReusableConfig] - to include in the response. Further - [ReusableConfigs][google.cloud.security.privateca.v1beta1.ReusableConfig] - can subsequently be obtained by including the - [ListReusableConfigsResponse.next_page_token][google.cloud.security.privateca.v1beta1.ListReusableConfigsResponse.next_page_token] - in a subsequent request. If unspecified, the server will - pick an appropriate default. - page_token (str): - Optional. Pagination token, returned earlier via - [ListReusableConfigsResponse.next_page_token][google.cloud.security.privateca.v1beta1.ListReusableConfigsResponse.next_page_token]. - filter (str): - Optional. Only include resources that match - the filter in the response. - order_by (str): - Optional. Specify how the results should be - sorted. - """ - - parent: str = proto.Field( - proto.STRING, - number=1, - ) - page_size: int = proto.Field( - proto.INT32, - number=2, - ) - page_token: str = proto.Field( - proto.STRING, - number=3, - ) - filter: str = proto.Field( - proto.STRING, - number=4, - ) - order_by: str = proto.Field( - proto.STRING, - number=5, - ) - - -class ListReusableConfigsResponse(proto.Message): - r"""Response message for - [CertificateAuthorityService.ListReusableConfigs][google.cloud.security.privateca.v1beta1.CertificateAuthorityService.ListReusableConfigs]. - - Attributes: - reusable_configs (MutableSequence[google.cloud.security.privateca_v1beta1.types.ReusableConfig]): - The list of - [ReusableConfigs][google.cloud.security.privateca.v1beta1.ReusableConfig]. - next_page_token (str): - A token to retrieve next page of results. Pass this value in - [ListReusableConfigsRequest.next_page_token][] to retrieve - the next page of results. - unreachable (MutableSequence[str]): - A list of locations (e.g. "us-west1") that - could not be reached. - """ - - @property - def raw_page(self): - return self - - reusable_configs: MutableSequence[resources.ReusableConfig] = proto.RepeatedField( - proto.MESSAGE, - number=1, - message=resources.ReusableConfig, - ) - next_page_token: str = proto.Field( - proto.STRING, - number=2, - ) - unreachable: MutableSequence[str] = 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 - created. - end_time (google.protobuf.timestamp_pb2.Timestamp): - Output only. The time the operation finished - running. - target (str): - Output only. Server-defined resource path for - the target of the operation. - verb (str): - Output only. Name of the verb executed by the - operation. - status_message (str): - Output only. Human-readable status of the - operation, if any. - requested_cancellation (bool): - Output only. Identifies whether the user has requested - cancellation of the operation. Operations that have - successfully been cancelled have [Operation.error][] value - with a [google.rpc.Status.code][google.rpc.Status.code] of - 1, corresponding to ``Code.CANCELLED``. - api_version (str): - Output only. API version used to start the - operation. - """ - - create_time: timestamp_pb2.Timestamp = proto.Field( - proto.MESSAGE, - number=1, - message=timestamp_pb2.Timestamp, - ) - end_time: timestamp_pb2.Timestamp = proto.Field( - proto.MESSAGE, - number=2, - message=timestamp_pb2.Timestamp, - ) - target: str = proto.Field( - proto.STRING, - number=3, - ) - verb: str = proto.Field( - proto.STRING, - number=4, - ) - status_message: str = proto.Field( - proto.STRING, - number=5, - ) - requested_cancellation: bool = proto.Field( - proto.BOOL, - number=6, - ) - api_version: str = proto.Field( - proto.STRING, - number=7, - ) - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/owl-bot-staging/v1beta1/mypy.ini b/owl-bot-staging/v1beta1/mypy.ini deleted file mode 100644 index 574c5ae..0000000 --- a/owl-bot-staging/v1beta1/mypy.ini +++ /dev/null @@ -1,3 +0,0 @@ -[mypy] -python_version = 3.7 -namespace_packages = True diff --git a/owl-bot-staging/v1beta1/noxfile.py b/owl-bot-staging/v1beta1/noxfile.py deleted file mode 100644 index dbd43a2..0000000 --- a/owl-bot-staging/v1beta1/noxfile.py +++ /dev/null @@ -1,184 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -import os -import pathlib -import shutil -import subprocess -import sys - - -import nox # type: ignore - -ALL_PYTHON = [ - "3.7", - "3.8", - "3.9", - "3.10", - "3.11", -] - -CURRENT_DIRECTORY = pathlib.Path(__file__).parent.absolute() - -LOWER_BOUND_CONSTRAINTS_FILE = CURRENT_DIRECTORY / "constraints.txt" -PACKAGE_NAME = subprocess.check_output([sys.executable, "setup.py", "--name"], encoding="utf-8") - -BLACK_VERSION = "black==22.3.0" -BLACK_PATHS = ["docs", "google", "tests", "samples", "noxfile.py", "setup.py"] -DEFAULT_PYTHON_VERSION = "3.11" - -nox.sessions = [ - "unit", - "cover", - "mypy", - "check_lower_bounds" - # exclude update_lower_bounds from default - "docs", - "blacken", - "lint", - "lint_setup_py", -] - -@nox.session(python=ALL_PYTHON) -def unit(session): - """Run the unit test suite.""" - - session.install('coverage', 'pytest', 'pytest-cov', 'pytest-asyncio', 'asyncmock; python_version < "3.8"') - session.install('-e', '.') - - session.run( - 'py.test', - '--quiet', - '--cov=google/cloud/security/privateca_v1beta1/', - '--cov=tests/', - '--cov-config=.coveragerc', - '--cov-report=term', - '--cov-report=html', - os.path.join('tests', 'unit', ''.join(session.posargs)) - ) - - -@nox.session(python=DEFAULT_PYTHON_VERSION) -def cover(session): - """Run the final coverage report. - This outputs the coverage report aggregating coverage from the unit - test runs (not system test runs), and then erases coverage data. - """ - session.install("coverage", "pytest-cov") - session.run("coverage", "report", "--show-missing", "--fail-under=100") - - session.run("coverage", "erase") - - -@nox.session(python=ALL_PYTHON) -def mypy(session): - """Run the type checker.""" - session.install( - 'mypy', - 'types-requests', - 'types-protobuf' - ) - session.install('.') - session.run( - 'mypy', - '--explicit-package-bases', - 'google', - ) - - -@nox.session -def update_lower_bounds(session): - """Update lower bounds in constraints.txt to match setup.py""" - session.install('google-cloud-testutils') - session.install('.') - - session.run( - 'lower-bound-checker', - 'update', - '--package-name', - PACKAGE_NAME, - '--constraints-file', - str(LOWER_BOUND_CONSTRAINTS_FILE), - ) - - -@nox.session -def check_lower_bounds(session): - """Check lower bounds in setup.py are reflected in constraints file""" - session.install('google-cloud-testutils') - session.install('.') - - session.run( - 'lower-bound-checker', - 'check', - '--package-name', - PACKAGE_NAME, - '--constraints-file', - str(LOWER_BOUND_CONSTRAINTS_FILE), - ) - -@nox.session(python=DEFAULT_PYTHON_VERSION) -def docs(session): - """Build the docs for this library.""" - - session.install("-e", ".") - session.install("sphinx==4.0.1", "alabaster", "recommonmark") - - shutil.rmtree(os.path.join("docs", "_build"), ignore_errors=True) - session.run( - "sphinx-build", - "-W", # warnings as errors - "-T", # show full traceback on exception - "-N", # no colors - "-b", - "html", - "-d", - os.path.join("docs", "_build", "doctrees", ""), - os.path.join("docs", ""), - os.path.join("docs", "_build", "html", ""), - ) - - -@nox.session(python=DEFAULT_PYTHON_VERSION) -def lint(session): - """Run linters. - - Returns a failure if the linters find linting errors or sufficiently - serious code quality issues. - """ - session.install("flake8", BLACK_VERSION) - session.run( - "black", - "--check", - *BLACK_PATHS, - ) - session.run("flake8", "google", "tests", "samples") - - -@nox.session(python=DEFAULT_PYTHON_VERSION) -def blacken(session): - """Run black. Format code to uniform standard.""" - session.install(BLACK_VERSION) - session.run( - "black", - *BLACK_PATHS, - ) - - -@nox.session(python=DEFAULT_PYTHON_VERSION) -def lint_setup_py(session): - """Verify that setup.py is valid (including RST check).""" - session.install("docutils", "pygments") - session.run("python", "setup.py", "check", "--restructuredtext", "--strict") diff --git a/owl-bot-staging/v1beta1/samples/generated_samples/privateca_v1beta1_generated_certificate_authority_service_activate_certificate_authority_async.py b/owl-bot-staging/v1beta1/samples/generated_samples/privateca_v1beta1_generated_certificate_authority_service_activate_certificate_authority_async.py deleted file mode 100644 index 50aa8e5..0000000 --- a/owl-bot-staging/v1beta1/samples/generated_samples/privateca_v1beta1_generated_certificate_authority_service_activate_certificate_authority_async.py +++ /dev/null @@ -1,61 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for ActivateCertificateAuthority -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-private-ca - - -# [START privateca_v1beta1_generated_CertificateAuthorityService_ActivateCertificateAuthority_async] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud.security import privateca_v1beta1 - - -async def sample_activate_certificate_authority(): - # Create a client - client = privateca_v1beta1.CertificateAuthorityServiceAsyncClient() - - # Initialize request argument(s) - subordinate_config = privateca_v1beta1.SubordinateConfig() - subordinate_config.certificate_authority = "certificate_authority_value" - - request = privateca_v1beta1.ActivateCertificateAuthorityRequest( - name="name_value", - pem_ca_certificate="pem_ca_certificate_value", - subordinate_config=subordinate_config, - ) - - # Make the request - operation = client.activate_certificate_authority(request=request) - - print("Waiting for operation to complete...") - - response = (await operation).result() - - # Handle the response - print(response) - -# [END privateca_v1beta1_generated_CertificateAuthorityService_ActivateCertificateAuthority_async] diff --git a/owl-bot-staging/v1beta1/samples/generated_samples/privateca_v1beta1_generated_certificate_authority_service_activate_certificate_authority_sync.py b/owl-bot-staging/v1beta1/samples/generated_samples/privateca_v1beta1_generated_certificate_authority_service_activate_certificate_authority_sync.py deleted file mode 100644 index 14714cb..0000000 --- a/owl-bot-staging/v1beta1/samples/generated_samples/privateca_v1beta1_generated_certificate_authority_service_activate_certificate_authority_sync.py +++ /dev/null @@ -1,61 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for ActivateCertificateAuthority -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-private-ca - - -# [START privateca_v1beta1_generated_CertificateAuthorityService_ActivateCertificateAuthority_sync] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud.security import privateca_v1beta1 - - -def sample_activate_certificate_authority(): - # Create a client - client = privateca_v1beta1.CertificateAuthorityServiceClient() - - # Initialize request argument(s) - subordinate_config = privateca_v1beta1.SubordinateConfig() - subordinate_config.certificate_authority = "certificate_authority_value" - - request = privateca_v1beta1.ActivateCertificateAuthorityRequest( - name="name_value", - pem_ca_certificate="pem_ca_certificate_value", - subordinate_config=subordinate_config, - ) - - # Make the request - operation = client.activate_certificate_authority(request=request) - - print("Waiting for operation to complete...") - - response = operation.result() - - # Handle the response - print(response) - -# [END privateca_v1beta1_generated_CertificateAuthorityService_ActivateCertificateAuthority_sync] diff --git a/owl-bot-staging/v1beta1/samples/generated_samples/privateca_v1beta1_generated_certificate_authority_service_create_certificate_async.py b/owl-bot-staging/v1beta1/samples/generated_samples/privateca_v1beta1_generated_certificate_authority_service_create_certificate_async.py deleted file mode 100644 index 60a4177..0000000 --- a/owl-bot-staging/v1beta1/samples/generated_samples/privateca_v1beta1_generated_certificate_authority_service_create_certificate_async.py +++ /dev/null @@ -1,56 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for CreateCertificate -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-private-ca - - -# [START privateca_v1beta1_generated_CertificateAuthorityService_CreateCertificate_async] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud.security import privateca_v1beta1 - - -async def sample_create_certificate(): - # Create a client - client = privateca_v1beta1.CertificateAuthorityServiceAsyncClient() - - # Initialize request argument(s) - certificate = privateca_v1beta1.Certificate() - certificate.pem_csr = "pem_csr_value" - - request = privateca_v1beta1.CreateCertificateRequest( - parent="parent_value", - certificate=certificate, - ) - - # Make the request - response = await client.create_certificate(request=request) - - # Handle the response - print(response) - -# [END privateca_v1beta1_generated_CertificateAuthorityService_CreateCertificate_async] diff --git a/owl-bot-staging/v1beta1/samples/generated_samples/privateca_v1beta1_generated_certificate_authority_service_create_certificate_authority_async.py b/owl-bot-staging/v1beta1/samples/generated_samples/privateca_v1beta1_generated_certificate_authority_service_create_certificate_authority_async.py deleted file mode 100644 index 6bd5662..0000000 --- a/owl-bot-staging/v1beta1/samples/generated_samples/privateca_v1beta1_generated_certificate_authority_service_create_certificate_authority_async.py +++ /dev/null @@ -1,64 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for CreateCertificateAuthority -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-private-ca - - -# [START privateca_v1beta1_generated_CertificateAuthorityService_CreateCertificateAuthority_async] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud.security import privateca_v1beta1 - - -async def sample_create_certificate_authority(): - # Create a client - client = privateca_v1beta1.CertificateAuthorityServiceAsyncClient() - - # Initialize request argument(s) - certificate_authority = privateca_v1beta1.CertificateAuthority() - certificate_authority.type_ = "SUBORDINATE" - certificate_authority.tier = "DEVOPS" - certificate_authority.config.reusable_config.reusable_config = "reusable_config_value" - certificate_authority.key_spec.cloud_kms_key_version = "cloud_kms_key_version_value" - - request = privateca_v1beta1.CreateCertificateAuthorityRequest( - parent="parent_value", - certificate_authority_id="certificate_authority_id_value", - certificate_authority=certificate_authority, - ) - - # Make the request - operation = client.create_certificate_authority(request=request) - - print("Waiting for operation to complete...") - - response = (await operation).result() - - # Handle the response - print(response) - -# [END privateca_v1beta1_generated_CertificateAuthorityService_CreateCertificateAuthority_async] diff --git a/owl-bot-staging/v1beta1/samples/generated_samples/privateca_v1beta1_generated_certificate_authority_service_create_certificate_authority_sync.py b/owl-bot-staging/v1beta1/samples/generated_samples/privateca_v1beta1_generated_certificate_authority_service_create_certificate_authority_sync.py deleted file mode 100644 index e424a24..0000000 --- a/owl-bot-staging/v1beta1/samples/generated_samples/privateca_v1beta1_generated_certificate_authority_service_create_certificate_authority_sync.py +++ /dev/null @@ -1,64 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for CreateCertificateAuthority -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-private-ca - - -# [START privateca_v1beta1_generated_CertificateAuthorityService_CreateCertificateAuthority_sync] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud.security import privateca_v1beta1 - - -def sample_create_certificate_authority(): - # Create a client - client = privateca_v1beta1.CertificateAuthorityServiceClient() - - # Initialize request argument(s) - certificate_authority = privateca_v1beta1.CertificateAuthority() - certificate_authority.type_ = "SUBORDINATE" - certificate_authority.tier = "DEVOPS" - certificate_authority.config.reusable_config.reusable_config = "reusable_config_value" - certificate_authority.key_spec.cloud_kms_key_version = "cloud_kms_key_version_value" - - request = privateca_v1beta1.CreateCertificateAuthorityRequest( - parent="parent_value", - certificate_authority_id="certificate_authority_id_value", - certificate_authority=certificate_authority, - ) - - # Make the request - operation = client.create_certificate_authority(request=request) - - print("Waiting for operation to complete...") - - response = operation.result() - - # Handle the response - print(response) - -# [END privateca_v1beta1_generated_CertificateAuthorityService_CreateCertificateAuthority_sync] diff --git a/owl-bot-staging/v1beta1/samples/generated_samples/privateca_v1beta1_generated_certificate_authority_service_create_certificate_sync.py b/owl-bot-staging/v1beta1/samples/generated_samples/privateca_v1beta1_generated_certificate_authority_service_create_certificate_sync.py deleted file mode 100644 index 6c98333..0000000 --- a/owl-bot-staging/v1beta1/samples/generated_samples/privateca_v1beta1_generated_certificate_authority_service_create_certificate_sync.py +++ /dev/null @@ -1,56 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for CreateCertificate -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-private-ca - - -# [START privateca_v1beta1_generated_CertificateAuthorityService_CreateCertificate_sync] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud.security import privateca_v1beta1 - - -def sample_create_certificate(): - # Create a client - client = privateca_v1beta1.CertificateAuthorityServiceClient() - - # Initialize request argument(s) - certificate = privateca_v1beta1.Certificate() - certificate.pem_csr = "pem_csr_value" - - request = privateca_v1beta1.CreateCertificateRequest( - parent="parent_value", - certificate=certificate, - ) - - # Make the request - response = client.create_certificate(request=request) - - # Handle the response - print(response) - -# [END privateca_v1beta1_generated_CertificateAuthorityService_CreateCertificate_sync] diff --git a/owl-bot-staging/v1beta1/samples/generated_samples/privateca_v1beta1_generated_certificate_authority_service_disable_certificate_authority_async.py b/owl-bot-staging/v1beta1/samples/generated_samples/privateca_v1beta1_generated_certificate_authority_service_disable_certificate_authority_async.py deleted file mode 100644 index 82422e0..0000000 --- a/owl-bot-staging/v1beta1/samples/generated_samples/privateca_v1beta1_generated_certificate_authority_service_disable_certificate_authority_async.py +++ /dev/null @@ -1,56 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for DisableCertificateAuthority -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-private-ca - - -# [START privateca_v1beta1_generated_CertificateAuthorityService_DisableCertificateAuthority_async] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud.security import privateca_v1beta1 - - -async def sample_disable_certificate_authority(): - # Create a client - client = privateca_v1beta1.CertificateAuthorityServiceAsyncClient() - - # Initialize request argument(s) - request = privateca_v1beta1.DisableCertificateAuthorityRequest( - name="name_value", - ) - - # Make the request - operation = client.disable_certificate_authority(request=request) - - print("Waiting for operation to complete...") - - response = (await operation).result() - - # Handle the response - print(response) - -# [END privateca_v1beta1_generated_CertificateAuthorityService_DisableCertificateAuthority_async] diff --git a/owl-bot-staging/v1beta1/samples/generated_samples/privateca_v1beta1_generated_certificate_authority_service_disable_certificate_authority_sync.py b/owl-bot-staging/v1beta1/samples/generated_samples/privateca_v1beta1_generated_certificate_authority_service_disable_certificate_authority_sync.py deleted file mode 100644 index da11d68..0000000 --- a/owl-bot-staging/v1beta1/samples/generated_samples/privateca_v1beta1_generated_certificate_authority_service_disable_certificate_authority_sync.py +++ /dev/null @@ -1,56 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for DisableCertificateAuthority -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-private-ca - - -# [START privateca_v1beta1_generated_CertificateAuthorityService_DisableCertificateAuthority_sync] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud.security import privateca_v1beta1 - - -def sample_disable_certificate_authority(): - # Create a client - client = privateca_v1beta1.CertificateAuthorityServiceClient() - - # Initialize request argument(s) - request = privateca_v1beta1.DisableCertificateAuthorityRequest( - name="name_value", - ) - - # Make the request - operation = client.disable_certificate_authority(request=request) - - print("Waiting for operation to complete...") - - response = operation.result() - - # Handle the response - print(response) - -# [END privateca_v1beta1_generated_CertificateAuthorityService_DisableCertificateAuthority_sync] diff --git a/owl-bot-staging/v1beta1/samples/generated_samples/privateca_v1beta1_generated_certificate_authority_service_enable_certificate_authority_async.py b/owl-bot-staging/v1beta1/samples/generated_samples/privateca_v1beta1_generated_certificate_authority_service_enable_certificate_authority_async.py deleted file mode 100644 index 617d347..0000000 --- a/owl-bot-staging/v1beta1/samples/generated_samples/privateca_v1beta1_generated_certificate_authority_service_enable_certificate_authority_async.py +++ /dev/null @@ -1,56 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for EnableCertificateAuthority -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-private-ca - - -# [START privateca_v1beta1_generated_CertificateAuthorityService_EnableCertificateAuthority_async] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud.security import privateca_v1beta1 - - -async def sample_enable_certificate_authority(): - # Create a client - client = privateca_v1beta1.CertificateAuthorityServiceAsyncClient() - - # Initialize request argument(s) - request = privateca_v1beta1.EnableCertificateAuthorityRequest( - name="name_value", - ) - - # Make the request - operation = client.enable_certificate_authority(request=request) - - print("Waiting for operation to complete...") - - response = (await operation).result() - - # Handle the response - print(response) - -# [END privateca_v1beta1_generated_CertificateAuthorityService_EnableCertificateAuthority_async] diff --git a/owl-bot-staging/v1beta1/samples/generated_samples/privateca_v1beta1_generated_certificate_authority_service_enable_certificate_authority_sync.py b/owl-bot-staging/v1beta1/samples/generated_samples/privateca_v1beta1_generated_certificate_authority_service_enable_certificate_authority_sync.py deleted file mode 100644 index aee82e9..0000000 --- a/owl-bot-staging/v1beta1/samples/generated_samples/privateca_v1beta1_generated_certificate_authority_service_enable_certificate_authority_sync.py +++ /dev/null @@ -1,56 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for EnableCertificateAuthority -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-private-ca - - -# [START privateca_v1beta1_generated_CertificateAuthorityService_EnableCertificateAuthority_sync] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud.security import privateca_v1beta1 - - -def sample_enable_certificate_authority(): - # Create a client - client = privateca_v1beta1.CertificateAuthorityServiceClient() - - # Initialize request argument(s) - request = privateca_v1beta1.EnableCertificateAuthorityRequest( - name="name_value", - ) - - # Make the request - operation = client.enable_certificate_authority(request=request) - - print("Waiting for operation to complete...") - - response = operation.result() - - # Handle the response - print(response) - -# [END privateca_v1beta1_generated_CertificateAuthorityService_EnableCertificateAuthority_sync] diff --git a/owl-bot-staging/v1beta1/samples/generated_samples/privateca_v1beta1_generated_certificate_authority_service_fetch_certificate_authority_csr_async.py b/owl-bot-staging/v1beta1/samples/generated_samples/privateca_v1beta1_generated_certificate_authority_service_fetch_certificate_authority_csr_async.py deleted file mode 100644 index 01b0def..0000000 --- a/owl-bot-staging/v1beta1/samples/generated_samples/privateca_v1beta1_generated_certificate_authority_service_fetch_certificate_authority_csr_async.py +++ /dev/null @@ -1,52 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for FetchCertificateAuthorityCsr -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-private-ca - - -# [START privateca_v1beta1_generated_CertificateAuthorityService_FetchCertificateAuthorityCsr_async] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud.security import privateca_v1beta1 - - -async def sample_fetch_certificate_authority_csr(): - # Create a client - client = privateca_v1beta1.CertificateAuthorityServiceAsyncClient() - - # Initialize request argument(s) - request = privateca_v1beta1.FetchCertificateAuthorityCsrRequest( - name="name_value", - ) - - # Make the request - response = await client.fetch_certificate_authority_csr(request=request) - - # Handle the response - print(response) - -# [END privateca_v1beta1_generated_CertificateAuthorityService_FetchCertificateAuthorityCsr_async] diff --git a/owl-bot-staging/v1beta1/samples/generated_samples/privateca_v1beta1_generated_certificate_authority_service_fetch_certificate_authority_csr_sync.py b/owl-bot-staging/v1beta1/samples/generated_samples/privateca_v1beta1_generated_certificate_authority_service_fetch_certificate_authority_csr_sync.py deleted file mode 100644 index 02d884e..0000000 --- a/owl-bot-staging/v1beta1/samples/generated_samples/privateca_v1beta1_generated_certificate_authority_service_fetch_certificate_authority_csr_sync.py +++ /dev/null @@ -1,52 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for FetchCertificateAuthorityCsr -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-private-ca - - -# [START privateca_v1beta1_generated_CertificateAuthorityService_FetchCertificateAuthorityCsr_sync] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud.security import privateca_v1beta1 - - -def sample_fetch_certificate_authority_csr(): - # Create a client - client = privateca_v1beta1.CertificateAuthorityServiceClient() - - # Initialize request argument(s) - request = privateca_v1beta1.FetchCertificateAuthorityCsrRequest( - name="name_value", - ) - - # Make the request - response = client.fetch_certificate_authority_csr(request=request) - - # Handle the response - print(response) - -# [END privateca_v1beta1_generated_CertificateAuthorityService_FetchCertificateAuthorityCsr_sync] diff --git a/owl-bot-staging/v1beta1/samples/generated_samples/privateca_v1beta1_generated_certificate_authority_service_get_certificate_async.py b/owl-bot-staging/v1beta1/samples/generated_samples/privateca_v1beta1_generated_certificate_authority_service_get_certificate_async.py deleted file mode 100644 index 2bcb79e..0000000 --- a/owl-bot-staging/v1beta1/samples/generated_samples/privateca_v1beta1_generated_certificate_authority_service_get_certificate_async.py +++ /dev/null @@ -1,52 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for GetCertificate -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-private-ca - - -# [START privateca_v1beta1_generated_CertificateAuthorityService_GetCertificate_async] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud.security import privateca_v1beta1 - - -async def sample_get_certificate(): - # Create a client - client = privateca_v1beta1.CertificateAuthorityServiceAsyncClient() - - # Initialize request argument(s) - request = privateca_v1beta1.GetCertificateRequest( - name="name_value", - ) - - # Make the request - response = await client.get_certificate(request=request) - - # Handle the response - print(response) - -# [END privateca_v1beta1_generated_CertificateAuthorityService_GetCertificate_async] diff --git a/owl-bot-staging/v1beta1/samples/generated_samples/privateca_v1beta1_generated_certificate_authority_service_get_certificate_authority_async.py b/owl-bot-staging/v1beta1/samples/generated_samples/privateca_v1beta1_generated_certificate_authority_service_get_certificate_authority_async.py deleted file mode 100644 index 04d6313..0000000 --- a/owl-bot-staging/v1beta1/samples/generated_samples/privateca_v1beta1_generated_certificate_authority_service_get_certificate_authority_async.py +++ /dev/null @@ -1,52 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for GetCertificateAuthority -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-private-ca - - -# [START privateca_v1beta1_generated_CertificateAuthorityService_GetCertificateAuthority_async] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud.security import privateca_v1beta1 - - -async def sample_get_certificate_authority(): - # Create a client - client = privateca_v1beta1.CertificateAuthorityServiceAsyncClient() - - # Initialize request argument(s) - request = privateca_v1beta1.GetCertificateAuthorityRequest( - name="name_value", - ) - - # Make the request - response = await client.get_certificate_authority(request=request) - - # Handle the response - print(response) - -# [END privateca_v1beta1_generated_CertificateAuthorityService_GetCertificateAuthority_async] diff --git a/owl-bot-staging/v1beta1/samples/generated_samples/privateca_v1beta1_generated_certificate_authority_service_get_certificate_authority_sync.py b/owl-bot-staging/v1beta1/samples/generated_samples/privateca_v1beta1_generated_certificate_authority_service_get_certificate_authority_sync.py deleted file mode 100644 index a616a34..0000000 --- a/owl-bot-staging/v1beta1/samples/generated_samples/privateca_v1beta1_generated_certificate_authority_service_get_certificate_authority_sync.py +++ /dev/null @@ -1,52 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for GetCertificateAuthority -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-private-ca - - -# [START privateca_v1beta1_generated_CertificateAuthorityService_GetCertificateAuthority_sync] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud.security import privateca_v1beta1 - - -def sample_get_certificate_authority(): - # Create a client - client = privateca_v1beta1.CertificateAuthorityServiceClient() - - # Initialize request argument(s) - request = privateca_v1beta1.GetCertificateAuthorityRequest( - name="name_value", - ) - - # Make the request - response = client.get_certificate_authority(request=request) - - # Handle the response - print(response) - -# [END privateca_v1beta1_generated_CertificateAuthorityService_GetCertificateAuthority_sync] diff --git a/owl-bot-staging/v1beta1/samples/generated_samples/privateca_v1beta1_generated_certificate_authority_service_get_certificate_revocation_list_async.py b/owl-bot-staging/v1beta1/samples/generated_samples/privateca_v1beta1_generated_certificate_authority_service_get_certificate_revocation_list_async.py deleted file mode 100644 index 7d12c49..0000000 --- a/owl-bot-staging/v1beta1/samples/generated_samples/privateca_v1beta1_generated_certificate_authority_service_get_certificate_revocation_list_async.py +++ /dev/null @@ -1,52 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for GetCertificateRevocationList -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-private-ca - - -# [START privateca_v1beta1_generated_CertificateAuthorityService_GetCertificateRevocationList_async] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud.security import privateca_v1beta1 - - -async def sample_get_certificate_revocation_list(): - # Create a client - client = privateca_v1beta1.CertificateAuthorityServiceAsyncClient() - - # Initialize request argument(s) - request = privateca_v1beta1.GetCertificateRevocationListRequest( - name="name_value", - ) - - # Make the request - response = await client.get_certificate_revocation_list(request=request) - - # Handle the response - print(response) - -# [END privateca_v1beta1_generated_CertificateAuthorityService_GetCertificateRevocationList_async] diff --git a/owl-bot-staging/v1beta1/samples/generated_samples/privateca_v1beta1_generated_certificate_authority_service_get_certificate_revocation_list_sync.py b/owl-bot-staging/v1beta1/samples/generated_samples/privateca_v1beta1_generated_certificate_authority_service_get_certificate_revocation_list_sync.py deleted file mode 100644 index c640ef5..0000000 --- a/owl-bot-staging/v1beta1/samples/generated_samples/privateca_v1beta1_generated_certificate_authority_service_get_certificate_revocation_list_sync.py +++ /dev/null @@ -1,52 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for GetCertificateRevocationList -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-private-ca - - -# [START privateca_v1beta1_generated_CertificateAuthorityService_GetCertificateRevocationList_sync] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud.security import privateca_v1beta1 - - -def sample_get_certificate_revocation_list(): - # Create a client - client = privateca_v1beta1.CertificateAuthorityServiceClient() - - # Initialize request argument(s) - request = privateca_v1beta1.GetCertificateRevocationListRequest( - name="name_value", - ) - - # Make the request - response = client.get_certificate_revocation_list(request=request) - - # Handle the response - print(response) - -# [END privateca_v1beta1_generated_CertificateAuthorityService_GetCertificateRevocationList_sync] diff --git a/owl-bot-staging/v1beta1/samples/generated_samples/privateca_v1beta1_generated_certificate_authority_service_get_certificate_sync.py b/owl-bot-staging/v1beta1/samples/generated_samples/privateca_v1beta1_generated_certificate_authority_service_get_certificate_sync.py deleted file mode 100644 index 6605b3c..0000000 --- a/owl-bot-staging/v1beta1/samples/generated_samples/privateca_v1beta1_generated_certificate_authority_service_get_certificate_sync.py +++ /dev/null @@ -1,52 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for GetCertificate -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-private-ca - - -# [START privateca_v1beta1_generated_CertificateAuthorityService_GetCertificate_sync] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud.security import privateca_v1beta1 - - -def sample_get_certificate(): - # Create a client - client = privateca_v1beta1.CertificateAuthorityServiceClient() - - # Initialize request argument(s) - request = privateca_v1beta1.GetCertificateRequest( - name="name_value", - ) - - # Make the request - response = client.get_certificate(request=request) - - # Handle the response - print(response) - -# [END privateca_v1beta1_generated_CertificateAuthorityService_GetCertificate_sync] diff --git a/owl-bot-staging/v1beta1/samples/generated_samples/privateca_v1beta1_generated_certificate_authority_service_get_reusable_config_async.py b/owl-bot-staging/v1beta1/samples/generated_samples/privateca_v1beta1_generated_certificate_authority_service_get_reusable_config_async.py deleted file mode 100644 index 77b7c64..0000000 --- a/owl-bot-staging/v1beta1/samples/generated_samples/privateca_v1beta1_generated_certificate_authority_service_get_reusable_config_async.py +++ /dev/null @@ -1,52 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for GetReusableConfig -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-private-ca - - -# [START privateca_v1beta1_generated_CertificateAuthorityService_GetReusableConfig_async] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud.security import privateca_v1beta1 - - -async def sample_get_reusable_config(): - # Create a client - client = privateca_v1beta1.CertificateAuthorityServiceAsyncClient() - - # Initialize request argument(s) - request = privateca_v1beta1.GetReusableConfigRequest( - name="name_value", - ) - - # Make the request - response = await client.get_reusable_config(request=request) - - # Handle the response - print(response) - -# [END privateca_v1beta1_generated_CertificateAuthorityService_GetReusableConfig_async] diff --git a/owl-bot-staging/v1beta1/samples/generated_samples/privateca_v1beta1_generated_certificate_authority_service_get_reusable_config_sync.py b/owl-bot-staging/v1beta1/samples/generated_samples/privateca_v1beta1_generated_certificate_authority_service_get_reusable_config_sync.py deleted file mode 100644 index 07f9f83..0000000 --- a/owl-bot-staging/v1beta1/samples/generated_samples/privateca_v1beta1_generated_certificate_authority_service_get_reusable_config_sync.py +++ /dev/null @@ -1,52 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for GetReusableConfig -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-private-ca - - -# [START privateca_v1beta1_generated_CertificateAuthorityService_GetReusableConfig_sync] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud.security import privateca_v1beta1 - - -def sample_get_reusable_config(): - # Create a client - client = privateca_v1beta1.CertificateAuthorityServiceClient() - - # Initialize request argument(s) - request = privateca_v1beta1.GetReusableConfigRequest( - name="name_value", - ) - - # Make the request - response = client.get_reusable_config(request=request) - - # Handle the response - print(response) - -# [END privateca_v1beta1_generated_CertificateAuthorityService_GetReusableConfig_sync] diff --git a/owl-bot-staging/v1beta1/samples/generated_samples/privateca_v1beta1_generated_certificate_authority_service_list_certificate_authorities_async.py b/owl-bot-staging/v1beta1/samples/generated_samples/privateca_v1beta1_generated_certificate_authority_service_list_certificate_authorities_async.py deleted file mode 100644 index bdbfe91..0000000 --- a/owl-bot-staging/v1beta1/samples/generated_samples/privateca_v1beta1_generated_certificate_authority_service_list_certificate_authorities_async.py +++ /dev/null @@ -1,53 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for ListCertificateAuthorities -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-private-ca - - -# [START privateca_v1beta1_generated_CertificateAuthorityService_ListCertificateAuthorities_async] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud.security import privateca_v1beta1 - - -async def sample_list_certificate_authorities(): - # Create a client - client = privateca_v1beta1.CertificateAuthorityServiceAsyncClient() - - # Initialize request argument(s) - request = privateca_v1beta1.ListCertificateAuthoritiesRequest( - parent="parent_value", - ) - - # Make the request - page_result = client.list_certificate_authorities(request=request) - - # Handle the response - async for response in page_result: - print(response) - -# [END privateca_v1beta1_generated_CertificateAuthorityService_ListCertificateAuthorities_async] diff --git a/owl-bot-staging/v1beta1/samples/generated_samples/privateca_v1beta1_generated_certificate_authority_service_list_certificate_authorities_sync.py b/owl-bot-staging/v1beta1/samples/generated_samples/privateca_v1beta1_generated_certificate_authority_service_list_certificate_authorities_sync.py deleted file mode 100644 index be78a7e..0000000 --- a/owl-bot-staging/v1beta1/samples/generated_samples/privateca_v1beta1_generated_certificate_authority_service_list_certificate_authorities_sync.py +++ /dev/null @@ -1,53 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for ListCertificateAuthorities -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-private-ca - - -# [START privateca_v1beta1_generated_CertificateAuthorityService_ListCertificateAuthorities_sync] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud.security import privateca_v1beta1 - - -def sample_list_certificate_authorities(): - # Create a client - client = privateca_v1beta1.CertificateAuthorityServiceClient() - - # Initialize request argument(s) - request = privateca_v1beta1.ListCertificateAuthoritiesRequest( - parent="parent_value", - ) - - # Make the request - page_result = client.list_certificate_authorities(request=request) - - # Handle the response - for response in page_result: - print(response) - -# [END privateca_v1beta1_generated_CertificateAuthorityService_ListCertificateAuthorities_sync] diff --git a/owl-bot-staging/v1beta1/samples/generated_samples/privateca_v1beta1_generated_certificate_authority_service_list_certificate_revocation_lists_async.py b/owl-bot-staging/v1beta1/samples/generated_samples/privateca_v1beta1_generated_certificate_authority_service_list_certificate_revocation_lists_async.py deleted file mode 100644 index 7dcd2e0..0000000 --- a/owl-bot-staging/v1beta1/samples/generated_samples/privateca_v1beta1_generated_certificate_authority_service_list_certificate_revocation_lists_async.py +++ /dev/null @@ -1,53 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for ListCertificateRevocationLists -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-private-ca - - -# [START privateca_v1beta1_generated_CertificateAuthorityService_ListCertificateRevocationLists_async] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud.security import privateca_v1beta1 - - -async def sample_list_certificate_revocation_lists(): - # Create a client - client = privateca_v1beta1.CertificateAuthorityServiceAsyncClient() - - # Initialize request argument(s) - request = privateca_v1beta1.ListCertificateRevocationListsRequest( - parent="parent_value", - ) - - # Make the request - page_result = client.list_certificate_revocation_lists(request=request) - - # Handle the response - async for response in page_result: - print(response) - -# [END privateca_v1beta1_generated_CertificateAuthorityService_ListCertificateRevocationLists_async] diff --git a/owl-bot-staging/v1beta1/samples/generated_samples/privateca_v1beta1_generated_certificate_authority_service_list_certificate_revocation_lists_sync.py b/owl-bot-staging/v1beta1/samples/generated_samples/privateca_v1beta1_generated_certificate_authority_service_list_certificate_revocation_lists_sync.py deleted file mode 100644 index 5ad590f..0000000 --- a/owl-bot-staging/v1beta1/samples/generated_samples/privateca_v1beta1_generated_certificate_authority_service_list_certificate_revocation_lists_sync.py +++ /dev/null @@ -1,53 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for ListCertificateRevocationLists -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-private-ca - - -# [START privateca_v1beta1_generated_CertificateAuthorityService_ListCertificateRevocationLists_sync] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud.security import privateca_v1beta1 - - -def sample_list_certificate_revocation_lists(): - # Create a client - client = privateca_v1beta1.CertificateAuthorityServiceClient() - - # Initialize request argument(s) - request = privateca_v1beta1.ListCertificateRevocationListsRequest( - parent="parent_value", - ) - - # Make the request - page_result = client.list_certificate_revocation_lists(request=request) - - # Handle the response - for response in page_result: - print(response) - -# [END privateca_v1beta1_generated_CertificateAuthorityService_ListCertificateRevocationLists_sync] diff --git a/owl-bot-staging/v1beta1/samples/generated_samples/privateca_v1beta1_generated_certificate_authority_service_list_certificates_async.py b/owl-bot-staging/v1beta1/samples/generated_samples/privateca_v1beta1_generated_certificate_authority_service_list_certificates_async.py deleted file mode 100644 index 9f76954..0000000 --- a/owl-bot-staging/v1beta1/samples/generated_samples/privateca_v1beta1_generated_certificate_authority_service_list_certificates_async.py +++ /dev/null @@ -1,53 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for ListCertificates -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-private-ca - - -# [START privateca_v1beta1_generated_CertificateAuthorityService_ListCertificates_async] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud.security import privateca_v1beta1 - - -async def sample_list_certificates(): - # Create a client - client = privateca_v1beta1.CertificateAuthorityServiceAsyncClient() - - # Initialize request argument(s) - request = privateca_v1beta1.ListCertificatesRequest( - parent="parent_value", - ) - - # Make the request - page_result = client.list_certificates(request=request) - - # Handle the response - async for response in page_result: - print(response) - -# [END privateca_v1beta1_generated_CertificateAuthorityService_ListCertificates_async] diff --git a/owl-bot-staging/v1beta1/samples/generated_samples/privateca_v1beta1_generated_certificate_authority_service_list_certificates_sync.py b/owl-bot-staging/v1beta1/samples/generated_samples/privateca_v1beta1_generated_certificate_authority_service_list_certificates_sync.py deleted file mode 100644 index 36ef888..0000000 --- a/owl-bot-staging/v1beta1/samples/generated_samples/privateca_v1beta1_generated_certificate_authority_service_list_certificates_sync.py +++ /dev/null @@ -1,53 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for ListCertificates -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-private-ca - - -# [START privateca_v1beta1_generated_CertificateAuthorityService_ListCertificates_sync] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud.security import privateca_v1beta1 - - -def sample_list_certificates(): - # Create a client - client = privateca_v1beta1.CertificateAuthorityServiceClient() - - # Initialize request argument(s) - request = privateca_v1beta1.ListCertificatesRequest( - parent="parent_value", - ) - - # Make the request - page_result = client.list_certificates(request=request) - - # Handle the response - for response in page_result: - print(response) - -# [END privateca_v1beta1_generated_CertificateAuthorityService_ListCertificates_sync] diff --git a/owl-bot-staging/v1beta1/samples/generated_samples/privateca_v1beta1_generated_certificate_authority_service_list_reusable_configs_async.py b/owl-bot-staging/v1beta1/samples/generated_samples/privateca_v1beta1_generated_certificate_authority_service_list_reusable_configs_async.py deleted file mode 100644 index dc56521..0000000 --- a/owl-bot-staging/v1beta1/samples/generated_samples/privateca_v1beta1_generated_certificate_authority_service_list_reusable_configs_async.py +++ /dev/null @@ -1,53 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for ListReusableConfigs -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-private-ca - - -# [START privateca_v1beta1_generated_CertificateAuthorityService_ListReusableConfigs_async] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud.security import privateca_v1beta1 - - -async def sample_list_reusable_configs(): - # Create a client - client = privateca_v1beta1.CertificateAuthorityServiceAsyncClient() - - # Initialize request argument(s) - request = privateca_v1beta1.ListReusableConfigsRequest( - parent="parent_value", - ) - - # Make the request - page_result = client.list_reusable_configs(request=request) - - # Handle the response - async for response in page_result: - print(response) - -# [END privateca_v1beta1_generated_CertificateAuthorityService_ListReusableConfigs_async] diff --git a/owl-bot-staging/v1beta1/samples/generated_samples/privateca_v1beta1_generated_certificate_authority_service_list_reusable_configs_sync.py b/owl-bot-staging/v1beta1/samples/generated_samples/privateca_v1beta1_generated_certificate_authority_service_list_reusable_configs_sync.py deleted file mode 100644 index 07a1245..0000000 --- a/owl-bot-staging/v1beta1/samples/generated_samples/privateca_v1beta1_generated_certificate_authority_service_list_reusable_configs_sync.py +++ /dev/null @@ -1,53 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for ListReusableConfigs -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-private-ca - - -# [START privateca_v1beta1_generated_CertificateAuthorityService_ListReusableConfigs_sync] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud.security import privateca_v1beta1 - - -def sample_list_reusable_configs(): - # Create a client - client = privateca_v1beta1.CertificateAuthorityServiceClient() - - # Initialize request argument(s) - request = privateca_v1beta1.ListReusableConfigsRequest( - parent="parent_value", - ) - - # Make the request - page_result = client.list_reusable_configs(request=request) - - # Handle the response - for response in page_result: - print(response) - -# [END privateca_v1beta1_generated_CertificateAuthorityService_ListReusableConfigs_sync] diff --git a/owl-bot-staging/v1beta1/samples/generated_samples/privateca_v1beta1_generated_certificate_authority_service_restore_certificate_authority_async.py b/owl-bot-staging/v1beta1/samples/generated_samples/privateca_v1beta1_generated_certificate_authority_service_restore_certificate_authority_async.py deleted file mode 100644 index 8f27dfc..0000000 --- a/owl-bot-staging/v1beta1/samples/generated_samples/privateca_v1beta1_generated_certificate_authority_service_restore_certificate_authority_async.py +++ /dev/null @@ -1,56 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for RestoreCertificateAuthority -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-private-ca - - -# [START privateca_v1beta1_generated_CertificateAuthorityService_RestoreCertificateAuthority_async] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud.security import privateca_v1beta1 - - -async def sample_restore_certificate_authority(): - # Create a client - client = privateca_v1beta1.CertificateAuthorityServiceAsyncClient() - - # Initialize request argument(s) - request = privateca_v1beta1.RestoreCertificateAuthorityRequest( - name="name_value", - ) - - # Make the request - operation = client.restore_certificate_authority(request=request) - - print("Waiting for operation to complete...") - - response = (await operation).result() - - # Handle the response - print(response) - -# [END privateca_v1beta1_generated_CertificateAuthorityService_RestoreCertificateAuthority_async] diff --git a/owl-bot-staging/v1beta1/samples/generated_samples/privateca_v1beta1_generated_certificate_authority_service_restore_certificate_authority_sync.py b/owl-bot-staging/v1beta1/samples/generated_samples/privateca_v1beta1_generated_certificate_authority_service_restore_certificate_authority_sync.py deleted file mode 100644 index 71aab92..0000000 --- a/owl-bot-staging/v1beta1/samples/generated_samples/privateca_v1beta1_generated_certificate_authority_service_restore_certificate_authority_sync.py +++ /dev/null @@ -1,56 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for RestoreCertificateAuthority -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-private-ca - - -# [START privateca_v1beta1_generated_CertificateAuthorityService_RestoreCertificateAuthority_sync] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud.security import privateca_v1beta1 - - -def sample_restore_certificate_authority(): - # Create a client - client = privateca_v1beta1.CertificateAuthorityServiceClient() - - # Initialize request argument(s) - request = privateca_v1beta1.RestoreCertificateAuthorityRequest( - name="name_value", - ) - - # Make the request - operation = client.restore_certificate_authority(request=request) - - print("Waiting for operation to complete...") - - response = operation.result() - - # Handle the response - print(response) - -# [END privateca_v1beta1_generated_CertificateAuthorityService_RestoreCertificateAuthority_sync] diff --git a/owl-bot-staging/v1beta1/samples/generated_samples/privateca_v1beta1_generated_certificate_authority_service_revoke_certificate_async.py b/owl-bot-staging/v1beta1/samples/generated_samples/privateca_v1beta1_generated_certificate_authority_service_revoke_certificate_async.py deleted file mode 100644 index b909a8a..0000000 --- a/owl-bot-staging/v1beta1/samples/generated_samples/privateca_v1beta1_generated_certificate_authority_service_revoke_certificate_async.py +++ /dev/null @@ -1,53 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for RevokeCertificate -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-private-ca - - -# [START privateca_v1beta1_generated_CertificateAuthorityService_RevokeCertificate_async] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud.security import privateca_v1beta1 - - -async def sample_revoke_certificate(): - # Create a client - client = privateca_v1beta1.CertificateAuthorityServiceAsyncClient() - - # Initialize request argument(s) - request = privateca_v1beta1.RevokeCertificateRequest( - name="name_value", - reason="ATTRIBUTE_AUTHORITY_COMPROMISE", - ) - - # Make the request - response = await client.revoke_certificate(request=request) - - # Handle the response - print(response) - -# [END privateca_v1beta1_generated_CertificateAuthorityService_RevokeCertificate_async] diff --git a/owl-bot-staging/v1beta1/samples/generated_samples/privateca_v1beta1_generated_certificate_authority_service_revoke_certificate_sync.py b/owl-bot-staging/v1beta1/samples/generated_samples/privateca_v1beta1_generated_certificate_authority_service_revoke_certificate_sync.py deleted file mode 100644 index 45b4553..0000000 --- a/owl-bot-staging/v1beta1/samples/generated_samples/privateca_v1beta1_generated_certificate_authority_service_revoke_certificate_sync.py +++ /dev/null @@ -1,53 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for RevokeCertificate -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-private-ca - - -# [START privateca_v1beta1_generated_CertificateAuthorityService_RevokeCertificate_sync] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud.security import privateca_v1beta1 - - -def sample_revoke_certificate(): - # Create a client - client = privateca_v1beta1.CertificateAuthorityServiceClient() - - # Initialize request argument(s) - request = privateca_v1beta1.RevokeCertificateRequest( - name="name_value", - reason="ATTRIBUTE_AUTHORITY_COMPROMISE", - ) - - # Make the request - response = client.revoke_certificate(request=request) - - # Handle the response - print(response) - -# [END privateca_v1beta1_generated_CertificateAuthorityService_RevokeCertificate_sync] diff --git a/owl-bot-staging/v1beta1/samples/generated_samples/privateca_v1beta1_generated_certificate_authority_service_schedule_delete_certificate_authority_async.py b/owl-bot-staging/v1beta1/samples/generated_samples/privateca_v1beta1_generated_certificate_authority_service_schedule_delete_certificate_authority_async.py deleted file mode 100644 index e138cc8..0000000 --- a/owl-bot-staging/v1beta1/samples/generated_samples/privateca_v1beta1_generated_certificate_authority_service_schedule_delete_certificate_authority_async.py +++ /dev/null @@ -1,56 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for ScheduleDeleteCertificateAuthority -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-private-ca - - -# [START privateca_v1beta1_generated_CertificateAuthorityService_ScheduleDeleteCertificateAuthority_async] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud.security import privateca_v1beta1 - - -async def sample_schedule_delete_certificate_authority(): - # Create a client - client = privateca_v1beta1.CertificateAuthorityServiceAsyncClient() - - # Initialize request argument(s) - request = privateca_v1beta1.ScheduleDeleteCertificateAuthorityRequest( - name="name_value", - ) - - # Make the request - operation = client.schedule_delete_certificate_authority(request=request) - - print("Waiting for operation to complete...") - - response = (await operation).result() - - # Handle the response - print(response) - -# [END privateca_v1beta1_generated_CertificateAuthorityService_ScheduleDeleteCertificateAuthority_async] diff --git a/owl-bot-staging/v1beta1/samples/generated_samples/privateca_v1beta1_generated_certificate_authority_service_schedule_delete_certificate_authority_sync.py b/owl-bot-staging/v1beta1/samples/generated_samples/privateca_v1beta1_generated_certificate_authority_service_schedule_delete_certificate_authority_sync.py deleted file mode 100644 index 29389bc..0000000 --- a/owl-bot-staging/v1beta1/samples/generated_samples/privateca_v1beta1_generated_certificate_authority_service_schedule_delete_certificate_authority_sync.py +++ /dev/null @@ -1,56 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for ScheduleDeleteCertificateAuthority -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-private-ca - - -# [START privateca_v1beta1_generated_CertificateAuthorityService_ScheduleDeleteCertificateAuthority_sync] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud.security import privateca_v1beta1 - - -def sample_schedule_delete_certificate_authority(): - # Create a client - client = privateca_v1beta1.CertificateAuthorityServiceClient() - - # Initialize request argument(s) - request = privateca_v1beta1.ScheduleDeleteCertificateAuthorityRequest( - name="name_value", - ) - - # Make the request - operation = client.schedule_delete_certificate_authority(request=request) - - print("Waiting for operation to complete...") - - response = operation.result() - - # Handle the response - print(response) - -# [END privateca_v1beta1_generated_CertificateAuthorityService_ScheduleDeleteCertificateAuthority_sync] diff --git a/owl-bot-staging/v1beta1/samples/generated_samples/privateca_v1beta1_generated_certificate_authority_service_update_certificate_async.py b/owl-bot-staging/v1beta1/samples/generated_samples/privateca_v1beta1_generated_certificate_authority_service_update_certificate_async.py deleted file mode 100644 index 6a48c31..0000000 --- a/owl-bot-staging/v1beta1/samples/generated_samples/privateca_v1beta1_generated_certificate_authority_service_update_certificate_async.py +++ /dev/null @@ -1,55 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for UpdateCertificate -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-private-ca - - -# [START privateca_v1beta1_generated_CertificateAuthorityService_UpdateCertificate_async] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud.security import privateca_v1beta1 - - -async def sample_update_certificate(): - # Create a client - client = privateca_v1beta1.CertificateAuthorityServiceAsyncClient() - - # Initialize request argument(s) - certificate = privateca_v1beta1.Certificate() - certificate.pem_csr = "pem_csr_value" - - request = privateca_v1beta1.UpdateCertificateRequest( - certificate=certificate, - ) - - # Make the request - response = await client.update_certificate(request=request) - - # Handle the response - print(response) - -# [END privateca_v1beta1_generated_CertificateAuthorityService_UpdateCertificate_async] diff --git a/owl-bot-staging/v1beta1/samples/generated_samples/privateca_v1beta1_generated_certificate_authority_service_update_certificate_authority_async.py b/owl-bot-staging/v1beta1/samples/generated_samples/privateca_v1beta1_generated_certificate_authority_service_update_certificate_authority_async.py deleted file mode 100644 index 42ac5e4..0000000 --- a/owl-bot-staging/v1beta1/samples/generated_samples/privateca_v1beta1_generated_certificate_authority_service_update_certificate_authority_async.py +++ /dev/null @@ -1,62 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for UpdateCertificateAuthority -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-private-ca - - -# [START privateca_v1beta1_generated_CertificateAuthorityService_UpdateCertificateAuthority_async] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud.security import privateca_v1beta1 - - -async def sample_update_certificate_authority(): - # Create a client - client = privateca_v1beta1.CertificateAuthorityServiceAsyncClient() - - # Initialize request argument(s) - certificate_authority = privateca_v1beta1.CertificateAuthority() - certificate_authority.type_ = "SUBORDINATE" - certificate_authority.tier = "DEVOPS" - certificate_authority.config.reusable_config.reusable_config = "reusable_config_value" - certificate_authority.key_spec.cloud_kms_key_version = "cloud_kms_key_version_value" - - request = privateca_v1beta1.UpdateCertificateAuthorityRequest( - certificate_authority=certificate_authority, - ) - - # Make the request - operation = client.update_certificate_authority(request=request) - - print("Waiting for operation to complete...") - - response = (await operation).result() - - # Handle the response - print(response) - -# [END privateca_v1beta1_generated_CertificateAuthorityService_UpdateCertificateAuthority_async] diff --git a/owl-bot-staging/v1beta1/samples/generated_samples/privateca_v1beta1_generated_certificate_authority_service_update_certificate_authority_sync.py b/owl-bot-staging/v1beta1/samples/generated_samples/privateca_v1beta1_generated_certificate_authority_service_update_certificate_authority_sync.py deleted file mode 100644 index 8a65090..0000000 --- a/owl-bot-staging/v1beta1/samples/generated_samples/privateca_v1beta1_generated_certificate_authority_service_update_certificate_authority_sync.py +++ /dev/null @@ -1,62 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for UpdateCertificateAuthority -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-private-ca - - -# [START privateca_v1beta1_generated_CertificateAuthorityService_UpdateCertificateAuthority_sync] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud.security import privateca_v1beta1 - - -def sample_update_certificate_authority(): - # Create a client - client = privateca_v1beta1.CertificateAuthorityServiceClient() - - # Initialize request argument(s) - certificate_authority = privateca_v1beta1.CertificateAuthority() - certificate_authority.type_ = "SUBORDINATE" - certificate_authority.tier = "DEVOPS" - certificate_authority.config.reusable_config.reusable_config = "reusable_config_value" - certificate_authority.key_spec.cloud_kms_key_version = "cloud_kms_key_version_value" - - request = privateca_v1beta1.UpdateCertificateAuthorityRequest( - certificate_authority=certificate_authority, - ) - - # Make the request - operation = client.update_certificate_authority(request=request) - - print("Waiting for operation to complete...") - - response = operation.result() - - # Handle the response - print(response) - -# [END privateca_v1beta1_generated_CertificateAuthorityService_UpdateCertificateAuthority_sync] diff --git a/owl-bot-staging/v1beta1/samples/generated_samples/privateca_v1beta1_generated_certificate_authority_service_update_certificate_revocation_list_async.py b/owl-bot-staging/v1beta1/samples/generated_samples/privateca_v1beta1_generated_certificate_authority_service_update_certificate_revocation_list_async.py deleted file mode 100644 index a68f06a..0000000 --- a/owl-bot-staging/v1beta1/samples/generated_samples/privateca_v1beta1_generated_certificate_authority_service_update_certificate_revocation_list_async.py +++ /dev/null @@ -1,55 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for UpdateCertificateRevocationList -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-private-ca - - -# [START privateca_v1beta1_generated_CertificateAuthorityService_UpdateCertificateRevocationList_async] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud.security import privateca_v1beta1 - - -async def sample_update_certificate_revocation_list(): - # Create a client - client = privateca_v1beta1.CertificateAuthorityServiceAsyncClient() - - # Initialize request argument(s) - request = privateca_v1beta1.UpdateCertificateRevocationListRequest( - ) - - # Make the request - operation = client.update_certificate_revocation_list(request=request) - - print("Waiting for operation to complete...") - - response = (await operation).result() - - # Handle the response - print(response) - -# [END privateca_v1beta1_generated_CertificateAuthorityService_UpdateCertificateRevocationList_async] diff --git a/owl-bot-staging/v1beta1/samples/generated_samples/privateca_v1beta1_generated_certificate_authority_service_update_certificate_revocation_list_sync.py b/owl-bot-staging/v1beta1/samples/generated_samples/privateca_v1beta1_generated_certificate_authority_service_update_certificate_revocation_list_sync.py deleted file mode 100644 index 3ae5dda..0000000 --- a/owl-bot-staging/v1beta1/samples/generated_samples/privateca_v1beta1_generated_certificate_authority_service_update_certificate_revocation_list_sync.py +++ /dev/null @@ -1,55 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for UpdateCertificateRevocationList -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-private-ca - - -# [START privateca_v1beta1_generated_CertificateAuthorityService_UpdateCertificateRevocationList_sync] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud.security import privateca_v1beta1 - - -def sample_update_certificate_revocation_list(): - # Create a client - client = privateca_v1beta1.CertificateAuthorityServiceClient() - - # Initialize request argument(s) - request = privateca_v1beta1.UpdateCertificateRevocationListRequest( - ) - - # Make the request - operation = client.update_certificate_revocation_list(request=request) - - print("Waiting for operation to complete...") - - response = operation.result() - - # Handle the response - print(response) - -# [END privateca_v1beta1_generated_CertificateAuthorityService_UpdateCertificateRevocationList_sync] diff --git a/owl-bot-staging/v1beta1/samples/generated_samples/privateca_v1beta1_generated_certificate_authority_service_update_certificate_sync.py b/owl-bot-staging/v1beta1/samples/generated_samples/privateca_v1beta1_generated_certificate_authority_service_update_certificate_sync.py deleted file mode 100644 index 44beba8..0000000 --- a/owl-bot-staging/v1beta1/samples/generated_samples/privateca_v1beta1_generated_certificate_authority_service_update_certificate_sync.py +++ /dev/null @@ -1,55 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for UpdateCertificate -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-private-ca - - -# [START privateca_v1beta1_generated_CertificateAuthorityService_UpdateCertificate_sync] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud.security import privateca_v1beta1 - - -def sample_update_certificate(): - # Create a client - client = privateca_v1beta1.CertificateAuthorityServiceClient() - - # Initialize request argument(s) - certificate = privateca_v1beta1.Certificate() - certificate.pem_csr = "pem_csr_value" - - request = privateca_v1beta1.UpdateCertificateRequest( - certificate=certificate, - ) - - # Make the request - response = client.update_certificate(request=request) - - # Handle the response - print(response) - -# [END privateca_v1beta1_generated_CertificateAuthorityService_UpdateCertificate_sync] diff --git a/owl-bot-staging/v1beta1/samples/generated_samples/snippet_metadata_google.cloud.security.privateca.v1beta1.json b/owl-bot-staging/v1beta1/samples/generated_samples/snippet_metadata_google.cloud.security.privateca.v1beta1.json deleted file mode 100644 index d9af1f5..0000000 --- a/owl-bot-staging/v1beta1/samples/generated_samples/snippet_metadata_google.cloud.security.privateca.v1beta1.json +++ /dev/null @@ -1,3291 +0,0 @@ -{ - "clientLibrary": { - "apis": [ - { - "id": "google.cloud.security.privateca.v1beta1", - "version": "v1beta1" - } - ], - "language": "PYTHON", - "name": "google-cloud-private-ca", - "version": "0.1.0" - }, - "snippets": [ - { - "canonical": true, - "clientMethod": { - "async": true, - "client": { - "fullName": "google.cloud.security.privateca_v1beta1.CertificateAuthorityServiceAsyncClient", - "shortName": "CertificateAuthorityServiceAsyncClient" - }, - "fullName": "google.cloud.security.privateca_v1beta1.CertificateAuthorityServiceAsyncClient.activate_certificate_authority", - "method": { - "fullName": "google.cloud.security.privateca.v1beta1.CertificateAuthorityService.ActivateCertificateAuthority", - "service": { - "fullName": "google.cloud.security.privateca.v1beta1.CertificateAuthorityService", - "shortName": "CertificateAuthorityService" - }, - "shortName": "ActivateCertificateAuthority" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.security.privateca_v1beta1.types.ActivateCertificateAuthorityRequest" - }, - { - "name": "name", - "type": "str" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.api_core.operation_async.AsyncOperation", - "shortName": "activate_certificate_authority" - }, - "description": "Sample for ActivateCertificateAuthority", - "file": "privateca_v1beta1_generated_certificate_authority_service_activate_certificate_authority_async.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "privateca_v1beta1_generated_CertificateAuthorityService_ActivateCertificateAuthority_async", - "segments": [ - { - "end": 60, - "start": 27, - "type": "FULL" - }, - { - "end": 60, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 50, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 57, - "start": 51, - "type": "REQUEST_EXECUTION" - }, - { - "end": 61, - "start": 58, - "type": "RESPONSE_HANDLING" - } - ], - "title": "privateca_v1beta1_generated_certificate_authority_service_activate_certificate_authority_async.py" - }, - { - "canonical": true, - "clientMethod": { - "client": { - "fullName": "google.cloud.security.privateca_v1beta1.CertificateAuthorityServiceClient", - "shortName": "CertificateAuthorityServiceClient" - }, - "fullName": "google.cloud.security.privateca_v1beta1.CertificateAuthorityServiceClient.activate_certificate_authority", - "method": { - "fullName": "google.cloud.security.privateca.v1beta1.CertificateAuthorityService.ActivateCertificateAuthority", - "service": { - "fullName": "google.cloud.security.privateca.v1beta1.CertificateAuthorityService", - "shortName": "CertificateAuthorityService" - }, - "shortName": "ActivateCertificateAuthority" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.security.privateca_v1beta1.types.ActivateCertificateAuthorityRequest" - }, - { - "name": "name", - "type": "str" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.api_core.operation.Operation", - "shortName": "activate_certificate_authority" - }, - "description": "Sample for ActivateCertificateAuthority", - "file": "privateca_v1beta1_generated_certificate_authority_service_activate_certificate_authority_sync.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "privateca_v1beta1_generated_CertificateAuthorityService_ActivateCertificateAuthority_sync", - "segments": [ - { - "end": 60, - "start": 27, - "type": "FULL" - }, - { - "end": 60, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 50, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 57, - "start": 51, - "type": "REQUEST_EXECUTION" - }, - { - "end": 61, - "start": 58, - "type": "RESPONSE_HANDLING" - } - ], - "title": "privateca_v1beta1_generated_certificate_authority_service_activate_certificate_authority_sync.py" - }, - { - "canonical": true, - "clientMethod": { - "async": true, - "client": { - "fullName": "google.cloud.security.privateca_v1beta1.CertificateAuthorityServiceAsyncClient", - "shortName": "CertificateAuthorityServiceAsyncClient" - }, - "fullName": "google.cloud.security.privateca_v1beta1.CertificateAuthorityServiceAsyncClient.create_certificate_authority", - "method": { - "fullName": "google.cloud.security.privateca.v1beta1.CertificateAuthorityService.CreateCertificateAuthority", - "service": { - "fullName": "google.cloud.security.privateca.v1beta1.CertificateAuthorityService", - "shortName": "CertificateAuthorityService" - }, - "shortName": "CreateCertificateAuthority" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.security.privateca_v1beta1.types.CreateCertificateAuthorityRequest" - }, - { - "name": "parent", - "type": "str" - }, - { - "name": "certificate_authority", - "type": "google.cloud.security.privateca_v1beta1.types.CertificateAuthority" - }, - { - "name": "certificate_authority_id", - "type": "str" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.api_core.operation_async.AsyncOperation", - "shortName": "create_certificate_authority" - }, - "description": "Sample for CreateCertificateAuthority", - "file": "privateca_v1beta1_generated_certificate_authority_service_create_certificate_authority_async.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "privateca_v1beta1_generated_CertificateAuthorityService_CreateCertificateAuthority_async", - "segments": [ - { - "end": 63, - "start": 27, - "type": "FULL" - }, - { - "end": 63, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 53, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 60, - "start": 54, - "type": "REQUEST_EXECUTION" - }, - { - "end": 64, - "start": 61, - "type": "RESPONSE_HANDLING" - } - ], - "title": "privateca_v1beta1_generated_certificate_authority_service_create_certificate_authority_async.py" - }, - { - "canonical": true, - "clientMethod": { - "client": { - "fullName": "google.cloud.security.privateca_v1beta1.CertificateAuthorityServiceClient", - "shortName": "CertificateAuthorityServiceClient" - }, - "fullName": "google.cloud.security.privateca_v1beta1.CertificateAuthorityServiceClient.create_certificate_authority", - "method": { - "fullName": "google.cloud.security.privateca.v1beta1.CertificateAuthorityService.CreateCertificateAuthority", - "service": { - "fullName": "google.cloud.security.privateca.v1beta1.CertificateAuthorityService", - "shortName": "CertificateAuthorityService" - }, - "shortName": "CreateCertificateAuthority" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.security.privateca_v1beta1.types.CreateCertificateAuthorityRequest" - }, - { - "name": "parent", - "type": "str" - }, - { - "name": "certificate_authority", - "type": "google.cloud.security.privateca_v1beta1.types.CertificateAuthority" - }, - { - "name": "certificate_authority_id", - "type": "str" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.api_core.operation.Operation", - "shortName": "create_certificate_authority" - }, - "description": "Sample for CreateCertificateAuthority", - "file": "privateca_v1beta1_generated_certificate_authority_service_create_certificate_authority_sync.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "privateca_v1beta1_generated_CertificateAuthorityService_CreateCertificateAuthority_sync", - "segments": [ - { - "end": 63, - "start": 27, - "type": "FULL" - }, - { - "end": 63, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 53, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 60, - "start": 54, - "type": "REQUEST_EXECUTION" - }, - { - "end": 64, - "start": 61, - "type": "RESPONSE_HANDLING" - } - ], - "title": "privateca_v1beta1_generated_certificate_authority_service_create_certificate_authority_sync.py" - }, - { - "canonical": true, - "clientMethod": { - "async": true, - "client": { - "fullName": "google.cloud.security.privateca_v1beta1.CertificateAuthorityServiceAsyncClient", - "shortName": "CertificateAuthorityServiceAsyncClient" - }, - "fullName": "google.cloud.security.privateca_v1beta1.CertificateAuthorityServiceAsyncClient.create_certificate", - "method": { - "fullName": "google.cloud.security.privateca.v1beta1.CertificateAuthorityService.CreateCertificate", - "service": { - "fullName": "google.cloud.security.privateca.v1beta1.CertificateAuthorityService", - "shortName": "CertificateAuthorityService" - }, - "shortName": "CreateCertificate" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.security.privateca_v1beta1.types.CreateCertificateRequest" - }, - { - "name": "parent", - "type": "str" - }, - { - "name": "certificate", - "type": "google.cloud.security.privateca_v1beta1.types.Certificate" - }, - { - "name": "certificate_id", - "type": "str" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.cloud.security.privateca_v1beta1.types.Certificate", - "shortName": "create_certificate" - }, - "description": "Sample for CreateCertificate", - "file": "privateca_v1beta1_generated_certificate_authority_service_create_certificate_async.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "privateca_v1beta1_generated_CertificateAuthorityService_CreateCertificate_async", - "segments": [ - { - "end": 55, - "start": 27, - "type": "FULL" - }, - { - "end": 55, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 49, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 52, - "start": 50, - "type": "REQUEST_EXECUTION" - }, - { - "end": 56, - "start": 53, - "type": "RESPONSE_HANDLING" - } - ], - "title": "privateca_v1beta1_generated_certificate_authority_service_create_certificate_async.py" - }, - { - "canonical": true, - "clientMethod": { - "client": { - "fullName": "google.cloud.security.privateca_v1beta1.CertificateAuthorityServiceClient", - "shortName": "CertificateAuthorityServiceClient" - }, - "fullName": "google.cloud.security.privateca_v1beta1.CertificateAuthorityServiceClient.create_certificate", - "method": { - "fullName": "google.cloud.security.privateca.v1beta1.CertificateAuthorityService.CreateCertificate", - "service": { - "fullName": "google.cloud.security.privateca.v1beta1.CertificateAuthorityService", - "shortName": "CertificateAuthorityService" - }, - "shortName": "CreateCertificate" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.security.privateca_v1beta1.types.CreateCertificateRequest" - }, - { - "name": "parent", - "type": "str" - }, - { - "name": "certificate", - "type": "google.cloud.security.privateca_v1beta1.types.Certificate" - }, - { - "name": "certificate_id", - "type": "str" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.cloud.security.privateca_v1beta1.types.Certificate", - "shortName": "create_certificate" - }, - "description": "Sample for CreateCertificate", - "file": "privateca_v1beta1_generated_certificate_authority_service_create_certificate_sync.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "privateca_v1beta1_generated_CertificateAuthorityService_CreateCertificate_sync", - "segments": [ - { - "end": 55, - "start": 27, - "type": "FULL" - }, - { - "end": 55, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 49, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 52, - "start": 50, - "type": "REQUEST_EXECUTION" - }, - { - "end": 56, - "start": 53, - "type": "RESPONSE_HANDLING" - } - ], - "title": "privateca_v1beta1_generated_certificate_authority_service_create_certificate_sync.py" - }, - { - "canonical": true, - "clientMethod": { - "async": true, - "client": { - "fullName": "google.cloud.security.privateca_v1beta1.CertificateAuthorityServiceAsyncClient", - "shortName": "CertificateAuthorityServiceAsyncClient" - }, - "fullName": "google.cloud.security.privateca_v1beta1.CertificateAuthorityServiceAsyncClient.disable_certificate_authority", - "method": { - "fullName": "google.cloud.security.privateca.v1beta1.CertificateAuthorityService.DisableCertificateAuthority", - "service": { - "fullName": "google.cloud.security.privateca.v1beta1.CertificateAuthorityService", - "shortName": "CertificateAuthorityService" - }, - "shortName": "DisableCertificateAuthority" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.security.privateca_v1beta1.types.DisableCertificateAuthorityRequest" - }, - { - "name": "name", - "type": "str" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.api_core.operation_async.AsyncOperation", - "shortName": "disable_certificate_authority" - }, - "description": "Sample for DisableCertificateAuthority", - "file": "privateca_v1beta1_generated_certificate_authority_service_disable_certificate_authority_async.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "privateca_v1beta1_generated_CertificateAuthorityService_DisableCertificateAuthority_async", - "segments": [ - { - "end": 55, - "start": 27, - "type": "FULL" - }, - { - "end": 55, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 45, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 52, - "start": 46, - "type": "REQUEST_EXECUTION" - }, - { - "end": 56, - "start": 53, - "type": "RESPONSE_HANDLING" - } - ], - "title": "privateca_v1beta1_generated_certificate_authority_service_disable_certificate_authority_async.py" - }, - { - "canonical": true, - "clientMethod": { - "client": { - "fullName": "google.cloud.security.privateca_v1beta1.CertificateAuthorityServiceClient", - "shortName": "CertificateAuthorityServiceClient" - }, - "fullName": "google.cloud.security.privateca_v1beta1.CertificateAuthorityServiceClient.disable_certificate_authority", - "method": { - "fullName": "google.cloud.security.privateca.v1beta1.CertificateAuthorityService.DisableCertificateAuthority", - "service": { - "fullName": "google.cloud.security.privateca.v1beta1.CertificateAuthorityService", - "shortName": "CertificateAuthorityService" - }, - "shortName": "DisableCertificateAuthority" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.security.privateca_v1beta1.types.DisableCertificateAuthorityRequest" - }, - { - "name": "name", - "type": "str" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.api_core.operation.Operation", - "shortName": "disable_certificate_authority" - }, - "description": "Sample for DisableCertificateAuthority", - "file": "privateca_v1beta1_generated_certificate_authority_service_disable_certificate_authority_sync.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "privateca_v1beta1_generated_CertificateAuthorityService_DisableCertificateAuthority_sync", - "segments": [ - { - "end": 55, - "start": 27, - "type": "FULL" - }, - { - "end": 55, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 45, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 52, - "start": 46, - "type": "REQUEST_EXECUTION" - }, - { - "end": 56, - "start": 53, - "type": "RESPONSE_HANDLING" - } - ], - "title": "privateca_v1beta1_generated_certificate_authority_service_disable_certificate_authority_sync.py" - }, - { - "canonical": true, - "clientMethod": { - "async": true, - "client": { - "fullName": "google.cloud.security.privateca_v1beta1.CertificateAuthorityServiceAsyncClient", - "shortName": "CertificateAuthorityServiceAsyncClient" - }, - "fullName": "google.cloud.security.privateca_v1beta1.CertificateAuthorityServiceAsyncClient.enable_certificate_authority", - "method": { - "fullName": "google.cloud.security.privateca.v1beta1.CertificateAuthorityService.EnableCertificateAuthority", - "service": { - "fullName": "google.cloud.security.privateca.v1beta1.CertificateAuthorityService", - "shortName": "CertificateAuthorityService" - }, - "shortName": "EnableCertificateAuthority" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.security.privateca_v1beta1.types.EnableCertificateAuthorityRequest" - }, - { - "name": "name", - "type": "str" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.api_core.operation_async.AsyncOperation", - "shortName": "enable_certificate_authority" - }, - "description": "Sample for EnableCertificateAuthority", - "file": "privateca_v1beta1_generated_certificate_authority_service_enable_certificate_authority_async.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "privateca_v1beta1_generated_CertificateAuthorityService_EnableCertificateAuthority_async", - "segments": [ - { - "end": 55, - "start": 27, - "type": "FULL" - }, - { - "end": 55, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 45, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 52, - "start": 46, - "type": "REQUEST_EXECUTION" - }, - { - "end": 56, - "start": 53, - "type": "RESPONSE_HANDLING" - } - ], - "title": "privateca_v1beta1_generated_certificate_authority_service_enable_certificate_authority_async.py" - }, - { - "canonical": true, - "clientMethod": { - "client": { - "fullName": "google.cloud.security.privateca_v1beta1.CertificateAuthorityServiceClient", - "shortName": "CertificateAuthorityServiceClient" - }, - "fullName": "google.cloud.security.privateca_v1beta1.CertificateAuthorityServiceClient.enable_certificate_authority", - "method": { - "fullName": "google.cloud.security.privateca.v1beta1.CertificateAuthorityService.EnableCertificateAuthority", - "service": { - "fullName": "google.cloud.security.privateca.v1beta1.CertificateAuthorityService", - "shortName": "CertificateAuthorityService" - }, - "shortName": "EnableCertificateAuthority" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.security.privateca_v1beta1.types.EnableCertificateAuthorityRequest" - }, - { - "name": "name", - "type": "str" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.api_core.operation.Operation", - "shortName": "enable_certificate_authority" - }, - "description": "Sample for EnableCertificateAuthority", - "file": "privateca_v1beta1_generated_certificate_authority_service_enable_certificate_authority_sync.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "privateca_v1beta1_generated_CertificateAuthorityService_EnableCertificateAuthority_sync", - "segments": [ - { - "end": 55, - "start": 27, - "type": "FULL" - }, - { - "end": 55, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 45, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 52, - "start": 46, - "type": "REQUEST_EXECUTION" - }, - { - "end": 56, - "start": 53, - "type": "RESPONSE_HANDLING" - } - ], - "title": "privateca_v1beta1_generated_certificate_authority_service_enable_certificate_authority_sync.py" - }, - { - "canonical": true, - "clientMethod": { - "async": true, - "client": { - "fullName": "google.cloud.security.privateca_v1beta1.CertificateAuthorityServiceAsyncClient", - "shortName": "CertificateAuthorityServiceAsyncClient" - }, - "fullName": "google.cloud.security.privateca_v1beta1.CertificateAuthorityServiceAsyncClient.fetch_certificate_authority_csr", - "method": { - "fullName": "google.cloud.security.privateca.v1beta1.CertificateAuthorityService.FetchCertificateAuthorityCsr", - "service": { - "fullName": "google.cloud.security.privateca.v1beta1.CertificateAuthorityService", - "shortName": "CertificateAuthorityService" - }, - "shortName": "FetchCertificateAuthorityCsr" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.security.privateca_v1beta1.types.FetchCertificateAuthorityCsrRequest" - }, - { - "name": "name", - "type": "str" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.cloud.security.privateca_v1beta1.types.FetchCertificateAuthorityCsrResponse", - "shortName": "fetch_certificate_authority_csr" - }, - "description": "Sample for FetchCertificateAuthorityCsr", - "file": "privateca_v1beta1_generated_certificate_authority_service_fetch_certificate_authority_csr_async.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "privateca_v1beta1_generated_CertificateAuthorityService_FetchCertificateAuthorityCsr_async", - "segments": [ - { - "end": 51, - "start": 27, - "type": "FULL" - }, - { - "end": 51, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 45, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 48, - "start": 46, - "type": "REQUEST_EXECUTION" - }, - { - "end": 52, - "start": 49, - "type": "RESPONSE_HANDLING" - } - ], - "title": "privateca_v1beta1_generated_certificate_authority_service_fetch_certificate_authority_csr_async.py" - }, - { - "canonical": true, - "clientMethod": { - "client": { - "fullName": "google.cloud.security.privateca_v1beta1.CertificateAuthorityServiceClient", - "shortName": "CertificateAuthorityServiceClient" - }, - "fullName": "google.cloud.security.privateca_v1beta1.CertificateAuthorityServiceClient.fetch_certificate_authority_csr", - "method": { - "fullName": "google.cloud.security.privateca.v1beta1.CertificateAuthorityService.FetchCertificateAuthorityCsr", - "service": { - "fullName": "google.cloud.security.privateca.v1beta1.CertificateAuthorityService", - "shortName": "CertificateAuthorityService" - }, - "shortName": "FetchCertificateAuthorityCsr" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.security.privateca_v1beta1.types.FetchCertificateAuthorityCsrRequest" - }, - { - "name": "name", - "type": "str" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.cloud.security.privateca_v1beta1.types.FetchCertificateAuthorityCsrResponse", - "shortName": "fetch_certificate_authority_csr" - }, - "description": "Sample for FetchCertificateAuthorityCsr", - "file": "privateca_v1beta1_generated_certificate_authority_service_fetch_certificate_authority_csr_sync.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "privateca_v1beta1_generated_CertificateAuthorityService_FetchCertificateAuthorityCsr_sync", - "segments": [ - { - "end": 51, - "start": 27, - "type": "FULL" - }, - { - "end": 51, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 45, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 48, - "start": 46, - "type": "REQUEST_EXECUTION" - }, - { - "end": 52, - "start": 49, - "type": "RESPONSE_HANDLING" - } - ], - "title": "privateca_v1beta1_generated_certificate_authority_service_fetch_certificate_authority_csr_sync.py" - }, - { - "canonical": true, - "clientMethod": { - "async": true, - "client": { - "fullName": "google.cloud.security.privateca_v1beta1.CertificateAuthorityServiceAsyncClient", - "shortName": "CertificateAuthorityServiceAsyncClient" - }, - "fullName": "google.cloud.security.privateca_v1beta1.CertificateAuthorityServiceAsyncClient.get_certificate_authority", - "method": { - "fullName": "google.cloud.security.privateca.v1beta1.CertificateAuthorityService.GetCertificateAuthority", - "service": { - "fullName": "google.cloud.security.privateca.v1beta1.CertificateAuthorityService", - "shortName": "CertificateAuthorityService" - }, - "shortName": "GetCertificateAuthority" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.security.privateca_v1beta1.types.GetCertificateAuthorityRequest" - }, - { - "name": "name", - "type": "str" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.cloud.security.privateca_v1beta1.types.CertificateAuthority", - "shortName": "get_certificate_authority" - }, - "description": "Sample for GetCertificateAuthority", - "file": "privateca_v1beta1_generated_certificate_authority_service_get_certificate_authority_async.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "privateca_v1beta1_generated_CertificateAuthorityService_GetCertificateAuthority_async", - "segments": [ - { - "end": 51, - "start": 27, - "type": "FULL" - }, - { - "end": 51, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 45, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 48, - "start": 46, - "type": "REQUEST_EXECUTION" - }, - { - "end": 52, - "start": 49, - "type": "RESPONSE_HANDLING" - } - ], - "title": "privateca_v1beta1_generated_certificate_authority_service_get_certificate_authority_async.py" - }, - { - "canonical": true, - "clientMethod": { - "client": { - "fullName": "google.cloud.security.privateca_v1beta1.CertificateAuthorityServiceClient", - "shortName": "CertificateAuthorityServiceClient" - }, - "fullName": "google.cloud.security.privateca_v1beta1.CertificateAuthorityServiceClient.get_certificate_authority", - "method": { - "fullName": "google.cloud.security.privateca.v1beta1.CertificateAuthorityService.GetCertificateAuthority", - "service": { - "fullName": "google.cloud.security.privateca.v1beta1.CertificateAuthorityService", - "shortName": "CertificateAuthorityService" - }, - "shortName": "GetCertificateAuthority" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.security.privateca_v1beta1.types.GetCertificateAuthorityRequest" - }, - { - "name": "name", - "type": "str" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.cloud.security.privateca_v1beta1.types.CertificateAuthority", - "shortName": "get_certificate_authority" - }, - "description": "Sample for GetCertificateAuthority", - "file": "privateca_v1beta1_generated_certificate_authority_service_get_certificate_authority_sync.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "privateca_v1beta1_generated_CertificateAuthorityService_GetCertificateAuthority_sync", - "segments": [ - { - "end": 51, - "start": 27, - "type": "FULL" - }, - { - "end": 51, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 45, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 48, - "start": 46, - "type": "REQUEST_EXECUTION" - }, - { - "end": 52, - "start": 49, - "type": "RESPONSE_HANDLING" - } - ], - "title": "privateca_v1beta1_generated_certificate_authority_service_get_certificate_authority_sync.py" - }, - { - "canonical": true, - "clientMethod": { - "async": true, - "client": { - "fullName": "google.cloud.security.privateca_v1beta1.CertificateAuthorityServiceAsyncClient", - "shortName": "CertificateAuthorityServiceAsyncClient" - }, - "fullName": "google.cloud.security.privateca_v1beta1.CertificateAuthorityServiceAsyncClient.get_certificate_revocation_list", - "method": { - "fullName": "google.cloud.security.privateca.v1beta1.CertificateAuthorityService.GetCertificateRevocationList", - "service": { - "fullName": "google.cloud.security.privateca.v1beta1.CertificateAuthorityService", - "shortName": "CertificateAuthorityService" - }, - "shortName": "GetCertificateRevocationList" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.security.privateca_v1beta1.types.GetCertificateRevocationListRequest" - }, - { - "name": "name", - "type": "str" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.cloud.security.privateca_v1beta1.types.CertificateRevocationList", - "shortName": "get_certificate_revocation_list" - }, - "description": "Sample for GetCertificateRevocationList", - "file": "privateca_v1beta1_generated_certificate_authority_service_get_certificate_revocation_list_async.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "privateca_v1beta1_generated_CertificateAuthorityService_GetCertificateRevocationList_async", - "segments": [ - { - "end": 51, - "start": 27, - "type": "FULL" - }, - { - "end": 51, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 45, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 48, - "start": 46, - "type": "REQUEST_EXECUTION" - }, - { - "end": 52, - "start": 49, - "type": "RESPONSE_HANDLING" - } - ], - "title": "privateca_v1beta1_generated_certificate_authority_service_get_certificate_revocation_list_async.py" - }, - { - "canonical": true, - "clientMethod": { - "client": { - "fullName": "google.cloud.security.privateca_v1beta1.CertificateAuthorityServiceClient", - "shortName": "CertificateAuthorityServiceClient" - }, - "fullName": "google.cloud.security.privateca_v1beta1.CertificateAuthorityServiceClient.get_certificate_revocation_list", - "method": { - "fullName": "google.cloud.security.privateca.v1beta1.CertificateAuthorityService.GetCertificateRevocationList", - "service": { - "fullName": "google.cloud.security.privateca.v1beta1.CertificateAuthorityService", - "shortName": "CertificateAuthorityService" - }, - "shortName": "GetCertificateRevocationList" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.security.privateca_v1beta1.types.GetCertificateRevocationListRequest" - }, - { - "name": "name", - "type": "str" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.cloud.security.privateca_v1beta1.types.CertificateRevocationList", - "shortName": "get_certificate_revocation_list" - }, - "description": "Sample for GetCertificateRevocationList", - "file": "privateca_v1beta1_generated_certificate_authority_service_get_certificate_revocation_list_sync.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "privateca_v1beta1_generated_CertificateAuthorityService_GetCertificateRevocationList_sync", - "segments": [ - { - "end": 51, - "start": 27, - "type": "FULL" - }, - { - "end": 51, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 45, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 48, - "start": 46, - "type": "REQUEST_EXECUTION" - }, - { - "end": 52, - "start": 49, - "type": "RESPONSE_HANDLING" - } - ], - "title": "privateca_v1beta1_generated_certificate_authority_service_get_certificate_revocation_list_sync.py" - }, - { - "canonical": true, - "clientMethod": { - "async": true, - "client": { - "fullName": "google.cloud.security.privateca_v1beta1.CertificateAuthorityServiceAsyncClient", - "shortName": "CertificateAuthorityServiceAsyncClient" - }, - "fullName": "google.cloud.security.privateca_v1beta1.CertificateAuthorityServiceAsyncClient.get_certificate", - "method": { - "fullName": "google.cloud.security.privateca.v1beta1.CertificateAuthorityService.GetCertificate", - "service": { - "fullName": "google.cloud.security.privateca.v1beta1.CertificateAuthorityService", - "shortName": "CertificateAuthorityService" - }, - "shortName": "GetCertificate" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.security.privateca_v1beta1.types.GetCertificateRequest" - }, - { - "name": "name", - "type": "str" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.cloud.security.privateca_v1beta1.types.Certificate", - "shortName": "get_certificate" - }, - "description": "Sample for GetCertificate", - "file": "privateca_v1beta1_generated_certificate_authority_service_get_certificate_async.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "privateca_v1beta1_generated_CertificateAuthorityService_GetCertificate_async", - "segments": [ - { - "end": 51, - "start": 27, - "type": "FULL" - }, - { - "end": 51, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 45, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 48, - "start": 46, - "type": "REQUEST_EXECUTION" - }, - { - "end": 52, - "start": 49, - "type": "RESPONSE_HANDLING" - } - ], - "title": "privateca_v1beta1_generated_certificate_authority_service_get_certificate_async.py" - }, - { - "canonical": true, - "clientMethod": { - "client": { - "fullName": "google.cloud.security.privateca_v1beta1.CertificateAuthorityServiceClient", - "shortName": "CertificateAuthorityServiceClient" - }, - "fullName": "google.cloud.security.privateca_v1beta1.CertificateAuthorityServiceClient.get_certificate", - "method": { - "fullName": "google.cloud.security.privateca.v1beta1.CertificateAuthorityService.GetCertificate", - "service": { - "fullName": "google.cloud.security.privateca.v1beta1.CertificateAuthorityService", - "shortName": "CertificateAuthorityService" - }, - "shortName": "GetCertificate" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.security.privateca_v1beta1.types.GetCertificateRequest" - }, - { - "name": "name", - "type": "str" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.cloud.security.privateca_v1beta1.types.Certificate", - "shortName": "get_certificate" - }, - "description": "Sample for GetCertificate", - "file": "privateca_v1beta1_generated_certificate_authority_service_get_certificate_sync.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "privateca_v1beta1_generated_CertificateAuthorityService_GetCertificate_sync", - "segments": [ - { - "end": 51, - "start": 27, - "type": "FULL" - }, - { - "end": 51, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 45, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 48, - "start": 46, - "type": "REQUEST_EXECUTION" - }, - { - "end": 52, - "start": 49, - "type": "RESPONSE_HANDLING" - } - ], - "title": "privateca_v1beta1_generated_certificate_authority_service_get_certificate_sync.py" - }, - { - "canonical": true, - "clientMethod": { - "async": true, - "client": { - "fullName": "google.cloud.security.privateca_v1beta1.CertificateAuthorityServiceAsyncClient", - "shortName": "CertificateAuthorityServiceAsyncClient" - }, - "fullName": "google.cloud.security.privateca_v1beta1.CertificateAuthorityServiceAsyncClient.get_reusable_config", - "method": { - "fullName": "google.cloud.security.privateca.v1beta1.CertificateAuthorityService.GetReusableConfig", - "service": { - "fullName": "google.cloud.security.privateca.v1beta1.CertificateAuthorityService", - "shortName": "CertificateAuthorityService" - }, - "shortName": "GetReusableConfig" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.security.privateca_v1beta1.types.GetReusableConfigRequest" - }, - { - "name": "name", - "type": "str" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.cloud.security.privateca_v1beta1.types.ReusableConfig", - "shortName": "get_reusable_config" - }, - "description": "Sample for GetReusableConfig", - "file": "privateca_v1beta1_generated_certificate_authority_service_get_reusable_config_async.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "privateca_v1beta1_generated_CertificateAuthorityService_GetReusableConfig_async", - "segments": [ - { - "end": 51, - "start": 27, - "type": "FULL" - }, - { - "end": 51, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 45, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 48, - "start": 46, - "type": "REQUEST_EXECUTION" - }, - { - "end": 52, - "start": 49, - "type": "RESPONSE_HANDLING" - } - ], - "title": "privateca_v1beta1_generated_certificate_authority_service_get_reusable_config_async.py" - }, - { - "canonical": true, - "clientMethod": { - "client": { - "fullName": "google.cloud.security.privateca_v1beta1.CertificateAuthorityServiceClient", - "shortName": "CertificateAuthorityServiceClient" - }, - "fullName": "google.cloud.security.privateca_v1beta1.CertificateAuthorityServiceClient.get_reusable_config", - "method": { - "fullName": "google.cloud.security.privateca.v1beta1.CertificateAuthorityService.GetReusableConfig", - "service": { - "fullName": "google.cloud.security.privateca.v1beta1.CertificateAuthorityService", - "shortName": "CertificateAuthorityService" - }, - "shortName": "GetReusableConfig" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.security.privateca_v1beta1.types.GetReusableConfigRequest" - }, - { - "name": "name", - "type": "str" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.cloud.security.privateca_v1beta1.types.ReusableConfig", - "shortName": "get_reusable_config" - }, - "description": "Sample for GetReusableConfig", - "file": "privateca_v1beta1_generated_certificate_authority_service_get_reusable_config_sync.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "privateca_v1beta1_generated_CertificateAuthorityService_GetReusableConfig_sync", - "segments": [ - { - "end": 51, - "start": 27, - "type": "FULL" - }, - { - "end": 51, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 45, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 48, - "start": 46, - "type": "REQUEST_EXECUTION" - }, - { - "end": 52, - "start": 49, - "type": "RESPONSE_HANDLING" - } - ], - "title": "privateca_v1beta1_generated_certificate_authority_service_get_reusable_config_sync.py" - }, - { - "canonical": true, - "clientMethod": { - "async": true, - "client": { - "fullName": "google.cloud.security.privateca_v1beta1.CertificateAuthorityServiceAsyncClient", - "shortName": "CertificateAuthorityServiceAsyncClient" - }, - "fullName": "google.cloud.security.privateca_v1beta1.CertificateAuthorityServiceAsyncClient.list_certificate_authorities", - "method": { - "fullName": "google.cloud.security.privateca.v1beta1.CertificateAuthorityService.ListCertificateAuthorities", - "service": { - "fullName": "google.cloud.security.privateca.v1beta1.CertificateAuthorityService", - "shortName": "CertificateAuthorityService" - }, - "shortName": "ListCertificateAuthorities" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.security.privateca_v1beta1.types.ListCertificateAuthoritiesRequest" - }, - { - "name": "parent", - "type": "str" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.cloud.security.privateca_v1beta1.services.certificate_authority_service.pagers.ListCertificateAuthoritiesAsyncPager", - "shortName": "list_certificate_authorities" - }, - "description": "Sample for ListCertificateAuthorities", - "file": "privateca_v1beta1_generated_certificate_authority_service_list_certificate_authorities_async.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "privateca_v1beta1_generated_CertificateAuthorityService_ListCertificateAuthorities_async", - "segments": [ - { - "end": 52, - "start": 27, - "type": "FULL" - }, - { - "end": 52, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 45, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 48, - "start": 46, - "type": "REQUEST_EXECUTION" - }, - { - "end": 53, - "start": 49, - "type": "RESPONSE_HANDLING" - } - ], - "title": "privateca_v1beta1_generated_certificate_authority_service_list_certificate_authorities_async.py" - }, - { - "canonical": true, - "clientMethod": { - "client": { - "fullName": "google.cloud.security.privateca_v1beta1.CertificateAuthorityServiceClient", - "shortName": "CertificateAuthorityServiceClient" - }, - "fullName": "google.cloud.security.privateca_v1beta1.CertificateAuthorityServiceClient.list_certificate_authorities", - "method": { - "fullName": "google.cloud.security.privateca.v1beta1.CertificateAuthorityService.ListCertificateAuthorities", - "service": { - "fullName": "google.cloud.security.privateca.v1beta1.CertificateAuthorityService", - "shortName": "CertificateAuthorityService" - }, - "shortName": "ListCertificateAuthorities" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.security.privateca_v1beta1.types.ListCertificateAuthoritiesRequest" - }, - { - "name": "parent", - "type": "str" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.cloud.security.privateca_v1beta1.services.certificate_authority_service.pagers.ListCertificateAuthoritiesPager", - "shortName": "list_certificate_authorities" - }, - "description": "Sample for ListCertificateAuthorities", - "file": "privateca_v1beta1_generated_certificate_authority_service_list_certificate_authorities_sync.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "privateca_v1beta1_generated_CertificateAuthorityService_ListCertificateAuthorities_sync", - "segments": [ - { - "end": 52, - "start": 27, - "type": "FULL" - }, - { - "end": 52, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 45, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 48, - "start": 46, - "type": "REQUEST_EXECUTION" - }, - { - "end": 53, - "start": 49, - "type": "RESPONSE_HANDLING" - } - ], - "title": "privateca_v1beta1_generated_certificate_authority_service_list_certificate_authorities_sync.py" - }, - { - "canonical": true, - "clientMethod": { - "async": true, - "client": { - "fullName": "google.cloud.security.privateca_v1beta1.CertificateAuthorityServiceAsyncClient", - "shortName": "CertificateAuthorityServiceAsyncClient" - }, - "fullName": "google.cloud.security.privateca_v1beta1.CertificateAuthorityServiceAsyncClient.list_certificate_revocation_lists", - "method": { - "fullName": "google.cloud.security.privateca.v1beta1.CertificateAuthorityService.ListCertificateRevocationLists", - "service": { - "fullName": "google.cloud.security.privateca.v1beta1.CertificateAuthorityService", - "shortName": "CertificateAuthorityService" - }, - "shortName": "ListCertificateRevocationLists" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.security.privateca_v1beta1.types.ListCertificateRevocationListsRequest" - }, - { - "name": "parent", - "type": "str" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.cloud.security.privateca_v1beta1.services.certificate_authority_service.pagers.ListCertificateRevocationListsAsyncPager", - "shortName": "list_certificate_revocation_lists" - }, - "description": "Sample for ListCertificateRevocationLists", - "file": "privateca_v1beta1_generated_certificate_authority_service_list_certificate_revocation_lists_async.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "privateca_v1beta1_generated_CertificateAuthorityService_ListCertificateRevocationLists_async", - "segments": [ - { - "end": 52, - "start": 27, - "type": "FULL" - }, - { - "end": 52, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 45, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 48, - "start": 46, - "type": "REQUEST_EXECUTION" - }, - { - "end": 53, - "start": 49, - "type": "RESPONSE_HANDLING" - } - ], - "title": "privateca_v1beta1_generated_certificate_authority_service_list_certificate_revocation_lists_async.py" - }, - { - "canonical": true, - "clientMethod": { - "client": { - "fullName": "google.cloud.security.privateca_v1beta1.CertificateAuthorityServiceClient", - "shortName": "CertificateAuthorityServiceClient" - }, - "fullName": "google.cloud.security.privateca_v1beta1.CertificateAuthorityServiceClient.list_certificate_revocation_lists", - "method": { - "fullName": "google.cloud.security.privateca.v1beta1.CertificateAuthorityService.ListCertificateRevocationLists", - "service": { - "fullName": "google.cloud.security.privateca.v1beta1.CertificateAuthorityService", - "shortName": "CertificateAuthorityService" - }, - "shortName": "ListCertificateRevocationLists" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.security.privateca_v1beta1.types.ListCertificateRevocationListsRequest" - }, - { - "name": "parent", - "type": "str" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.cloud.security.privateca_v1beta1.services.certificate_authority_service.pagers.ListCertificateRevocationListsPager", - "shortName": "list_certificate_revocation_lists" - }, - "description": "Sample for ListCertificateRevocationLists", - "file": "privateca_v1beta1_generated_certificate_authority_service_list_certificate_revocation_lists_sync.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "privateca_v1beta1_generated_CertificateAuthorityService_ListCertificateRevocationLists_sync", - "segments": [ - { - "end": 52, - "start": 27, - "type": "FULL" - }, - { - "end": 52, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 45, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 48, - "start": 46, - "type": "REQUEST_EXECUTION" - }, - { - "end": 53, - "start": 49, - "type": "RESPONSE_HANDLING" - } - ], - "title": "privateca_v1beta1_generated_certificate_authority_service_list_certificate_revocation_lists_sync.py" - }, - { - "canonical": true, - "clientMethod": { - "async": true, - "client": { - "fullName": "google.cloud.security.privateca_v1beta1.CertificateAuthorityServiceAsyncClient", - "shortName": "CertificateAuthorityServiceAsyncClient" - }, - "fullName": "google.cloud.security.privateca_v1beta1.CertificateAuthorityServiceAsyncClient.list_certificates", - "method": { - "fullName": "google.cloud.security.privateca.v1beta1.CertificateAuthorityService.ListCertificates", - "service": { - "fullName": "google.cloud.security.privateca.v1beta1.CertificateAuthorityService", - "shortName": "CertificateAuthorityService" - }, - "shortName": "ListCertificates" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.security.privateca_v1beta1.types.ListCertificatesRequest" - }, - { - "name": "parent", - "type": "str" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.cloud.security.privateca_v1beta1.services.certificate_authority_service.pagers.ListCertificatesAsyncPager", - "shortName": "list_certificates" - }, - "description": "Sample for ListCertificates", - "file": "privateca_v1beta1_generated_certificate_authority_service_list_certificates_async.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "privateca_v1beta1_generated_CertificateAuthorityService_ListCertificates_async", - "segments": [ - { - "end": 52, - "start": 27, - "type": "FULL" - }, - { - "end": 52, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 45, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 48, - "start": 46, - "type": "REQUEST_EXECUTION" - }, - { - "end": 53, - "start": 49, - "type": "RESPONSE_HANDLING" - } - ], - "title": "privateca_v1beta1_generated_certificate_authority_service_list_certificates_async.py" - }, - { - "canonical": true, - "clientMethod": { - "client": { - "fullName": "google.cloud.security.privateca_v1beta1.CertificateAuthorityServiceClient", - "shortName": "CertificateAuthorityServiceClient" - }, - "fullName": "google.cloud.security.privateca_v1beta1.CertificateAuthorityServiceClient.list_certificates", - "method": { - "fullName": "google.cloud.security.privateca.v1beta1.CertificateAuthorityService.ListCertificates", - "service": { - "fullName": "google.cloud.security.privateca.v1beta1.CertificateAuthorityService", - "shortName": "CertificateAuthorityService" - }, - "shortName": "ListCertificates" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.security.privateca_v1beta1.types.ListCertificatesRequest" - }, - { - "name": "parent", - "type": "str" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.cloud.security.privateca_v1beta1.services.certificate_authority_service.pagers.ListCertificatesPager", - "shortName": "list_certificates" - }, - "description": "Sample for ListCertificates", - "file": "privateca_v1beta1_generated_certificate_authority_service_list_certificates_sync.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "privateca_v1beta1_generated_CertificateAuthorityService_ListCertificates_sync", - "segments": [ - { - "end": 52, - "start": 27, - "type": "FULL" - }, - { - "end": 52, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 45, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 48, - "start": 46, - "type": "REQUEST_EXECUTION" - }, - { - "end": 53, - "start": 49, - "type": "RESPONSE_HANDLING" - } - ], - "title": "privateca_v1beta1_generated_certificate_authority_service_list_certificates_sync.py" - }, - { - "canonical": true, - "clientMethod": { - "async": true, - "client": { - "fullName": "google.cloud.security.privateca_v1beta1.CertificateAuthorityServiceAsyncClient", - "shortName": "CertificateAuthorityServiceAsyncClient" - }, - "fullName": "google.cloud.security.privateca_v1beta1.CertificateAuthorityServiceAsyncClient.list_reusable_configs", - "method": { - "fullName": "google.cloud.security.privateca.v1beta1.CertificateAuthorityService.ListReusableConfigs", - "service": { - "fullName": "google.cloud.security.privateca.v1beta1.CertificateAuthorityService", - "shortName": "CertificateAuthorityService" - }, - "shortName": "ListReusableConfigs" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.security.privateca_v1beta1.types.ListReusableConfigsRequest" - }, - { - "name": "parent", - "type": "str" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.cloud.security.privateca_v1beta1.services.certificate_authority_service.pagers.ListReusableConfigsAsyncPager", - "shortName": "list_reusable_configs" - }, - "description": "Sample for ListReusableConfigs", - "file": "privateca_v1beta1_generated_certificate_authority_service_list_reusable_configs_async.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "privateca_v1beta1_generated_CertificateAuthorityService_ListReusableConfigs_async", - "segments": [ - { - "end": 52, - "start": 27, - "type": "FULL" - }, - { - "end": 52, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 45, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 48, - "start": 46, - "type": "REQUEST_EXECUTION" - }, - { - "end": 53, - "start": 49, - "type": "RESPONSE_HANDLING" - } - ], - "title": "privateca_v1beta1_generated_certificate_authority_service_list_reusable_configs_async.py" - }, - { - "canonical": true, - "clientMethod": { - "client": { - "fullName": "google.cloud.security.privateca_v1beta1.CertificateAuthorityServiceClient", - "shortName": "CertificateAuthorityServiceClient" - }, - "fullName": "google.cloud.security.privateca_v1beta1.CertificateAuthorityServiceClient.list_reusable_configs", - "method": { - "fullName": "google.cloud.security.privateca.v1beta1.CertificateAuthorityService.ListReusableConfigs", - "service": { - "fullName": "google.cloud.security.privateca.v1beta1.CertificateAuthorityService", - "shortName": "CertificateAuthorityService" - }, - "shortName": "ListReusableConfigs" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.security.privateca_v1beta1.types.ListReusableConfigsRequest" - }, - { - "name": "parent", - "type": "str" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.cloud.security.privateca_v1beta1.services.certificate_authority_service.pagers.ListReusableConfigsPager", - "shortName": "list_reusable_configs" - }, - "description": "Sample for ListReusableConfigs", - "file": "privateca_v1beta1_generated_certificate_authority_service_list_reusable_configs_sync.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "privateca_v1beta1_generated_CertificateAuthorityService_ListReusableConfigs_sync", - "segments": [ - { - "end": 52, - "start": 27, - "type": "FULL" - }, - { - "end": 52, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 45, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 48, - "start": 46, - "type": "REQUEST_EXECUTION" - }, - { - "end": 53, - "start": 49, - "type": "RESPONSE_HANDLING" - } - ], - "title": "privateca_v1beta1_generated_certificate_authority_service_list_reusable_configs_sync.py" - }, - { - "canonical": true, - "clientMethod": { - "async": true, - "client": { - "fullName": "google.cloud.security.privateca_v1beta1.CertificateAuthorityServiceAsyncClient", - "shortName": "CertificateAuthorityServiceAsyncClient" - }, - "fullName": "google.cloud.security.privateca_v1beta1.CertificateAuthorityServiceAsyncClient.restore_certificate_authority", - "method": { - "fullName": "google.cloud.security.privateca.v1beta1.CertificateAuthorityService.RestoreCertificateAuthority", - "service": { - "fullName": "google.cloud.security.privateca.v1beta1.CertificateAuthorityService", - "shortName": "CertificateAuthorityService" - }, - "shortName": "RestoreCertificateAuthority" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.security.privateca_v1beta1.types.RestoreCertificateAuthorityRequest" - }, - { - "name": "name", - "type": "str" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.api_core.operation_async.AsyncOperation", - "shortName": "restore_certificate_authority" - }, - "description": "Sample for RestoreCertificateAuthority", - "file": "privateca_v1beta1_generated_certificate_authority_service_restore_certificate_authority_async.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "privateca_v1beta1_generated_CertificateAuthorityService_RestoreCertificateAuthority_async", - "segments": [ - { - "end": 55, - "start": 27, - "type": "FULL" - }, - { - "end": 55, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 45, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 52, - "start": 46, - "type": "REQUEST_EXECUTION" - }, - { - "end": 56, - "start": 53, - "type": "RESPONSE_HANDLING" - } - ], - "title": "privateca_v1beta1_generated_certificate_authority_service_restore_certificate_authority_async.py" - }, - { - "canonical": true, - "clientMethod": { - "client": { - "fullName": "google.cloud.security.privateca_v1beta1.CertificateAuthorityServiceClient", - "shortName": "CertificateAuthorityServiceClient" - }, - "fullName": "google.cloud.security.privateca_v1beta1.CertificateAuthorityServiceClient.restore_certificate_authority", - "method": { - "fullName": "google.cloud.security.privateca.v1beta1.CertificateAuthorityService.RestoreCertificateAuthority", - "service": { - "fullName": "google.cloud.security.privateca.v1beta1.CertificateAuthorityService", - "shortName": "CertificateAuthorityService" - }, - "shortName": "RestoreCertificateAuthority" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.security.privateca_v1beta1.types.RestoreCertificateAuthorityRequest" - }, - { - "name": "name", - "type": "str" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.api_core.operation.Operation", - "shortName": "restore_certificate_authority" - }, - "description": "Sample for RestoreCertificateAuthority", - "file": "privateca_v1beta1_generated_certificate_authority_service_restore_certificate_authority_sync.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "privateca_v1beta1_generated_CertificateAuthorityService_RestoreCertificateAuthority_sync", - "segments": [ - { - "end": 55, - "start": 27, - "type": "FULL" - }, - { - "end": 55, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 45, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 52, - "start": 46, - "type": "REQUEST_EXECUTION" - }, - { - "end": 56, - "start": 53, - "type": "RESPONSE_HANDLING" - } - ], - "title": "privateca_v1beta1_generated_certificate_authority_service_restore_certificate_authority_sync.py" - }, - { - "canonical": true, - "clientMethod": { - "async": true, - "client": { - "fullName": "google.cloud.security.privateca_v1beta1.CertificateAuthorityServiceAsyncClient", - "shortName": "CertificateAuthorityServiceAsyncClient" - }, - "fullName": "google.cloud.security.privateca_v1beta1.CertificateAuthorityServiceAsyncClient.revoke_certificate", - "method": { - "fullName": "google.cloud.security.privateca.v1beta1.CertificateAuthorityService.RevokeCertificate", - "service": { - "fullName": "google.cloud.security.privateca.v1beta1.CertificateAuthorityService", - "shortName": "CertificateAuthorityService" - }, - "shortName": "RevokeCertificate" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.security.privateca_v1beta1.types.RevokeCertificateRequest" - }, - { - "name": "name", - "type": "str" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.cloud.security.privateca_v1beta1.types.Certificate", - "shortName": "revoke_certificate" - }, - "description": "Sample for RevokeCertificate", - "file": "privateca_v1beta1_generated_certificate_authority_service_revoke_certificate_async.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "privateca_v1beta1_generated_CertificateAuthorityService_RevokeCertificate_async", - "segments": [ - { - "end": 52, - "start": 27, - "type": "FULL" - }, - { - "end": 52, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 46, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 49, - "start": 47, - "type": "REQUEST_EXECUTION" - }, - { - "end": 53, - "start": 50, - "type": "RESPONSE_HANDLING" - } - ], - "title": "privateca_v1beta1_generated_certificate_authority_service_revoke_certificate_async.py" - }, - { - "canonical": true, - "clientMethod": { - "client": { - "fullName": "google.cloud.security.privateca_v1beta1.CertificateAuthorityServiceClient", - "shortName": "CertificateAuthorityServiceClient" - }, - "fullName": "google.cloud.security.privateca_v1beta1.CertificateAuthorityServiceClient.revoke_certificate", - "method": { - "fullName": "google.cloud.security.privateca.v1beta1.CertificateAuthorityService.RevokeCertificate", - "service": { - "fullName": "google.cloud.security.privateca.v1beta1.CertificateAuthorityService", - "shortName": "CertificateAuthorityService" - }, - "shortName": "RevokeCertificate" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.security.privateca_v1beta1.types.RevokeCertificateRequest" - }, - { - "name": "name", - "type": "str" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.cloud.security.privateca_v1beta1.types.Certificate", - "shortName": "revoke_certificate" - }, - "description": "Sample for RevokeCertificate", - "file": "privateca_v1beta1_generated_certificate_authority_service_revoke_certificate_sync.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "privateca_v1beta1_generated_CertificateAuthorityService_RevokeCertificate_sync", - "segments": [ - { - "end": 52, - "start": 27, - "type": "FULL" - }, - { - "end": 52, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 46, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 49, - "start": 47, - "type": "REQUEST_EXECUTION" - }, - { - "end": 53, - "start": 50, - "type": "RESPONSE_HANDLING" - } - ], - "title": "privateca_v1beta1_generated_certificate_authority_service_revoke_certificate_sync.py" - }, - { - "canonical": true, - "clientMethod": { - "async": true, - "client": { - "fullName": "google.cloud.security.privateca_v1beta1.CertificateAuthorityServiceAsyncClient", - "shortName": "CertificateAuthorityServiceAsyncClient" - }, - "fullName": "google.cloud.security.privateca_v1beta1.CertificateAuthorityServiceAsyncClient.schedule_delete_certificate_authority", - "method": { - "fullName": "google.cloud.security.privateca.v1beta1.CertificateAuthorityService.ScheduleDeleteCertificateAuthority", - "service": { - "fullName": "google.cloud.security.privateca.v1beta1.CertificateAuthorityService", - "shortName": "CertificateAuthorityService" - }, - "shortName": "ScheduleDeleteCertificateAuthority" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.security.privateca_v1beta1.types.ScheduleDeleteCertificateAuthorityRequest" - }, - { - "name": "name", - "type": "str" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.api_core.operation_async.AsyncOperation", - "shortName": "schedule_delete_certificate_authority" - }, - "description": "Sample for ScheduleDeleteCertificateAuthority", - "file": "privateca_v1beta1_generated_certificate_authority_service_schedule_delete_certificate_authority_async.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "privateca_v1beta1_generated_CertificateAuthorityService_ScheduleDeleteCertificateAuthority_async", - "segments": [ - { - "end": 55, - "start": 27, - "type": "FULL" - }, - { - "end": 55, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 45, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 52, - "start": 46, - "type": "REQUEST_EXECUTION" - }, - { - "end": 56, - "start": 53, - "type": "RESPONSE_HANDLING" - } - ], - "title": "privateca_v1beta1_generated_certificate_authority_service_schedule_delete_certificate_authority_async.py" - }, - { - "canonical": true, - "clientMethod": { - "client": { - "fullName": "google.cloud.security.privateca_v1beta1.CertificateAuthorityServiceClient", - "shortName": "CertificateAuthorityServiceClient" - }, - "fullName": "google.cloud.security.privateca_v1beta1.CertificateAuthorityServiceClient.schedule_delete_certificate_authority", - "method": { - "fullName": "google.cloud.security.privateca.v1beta1.CertificateAuthorityService.ScheduleDeleteCertificateAuthority", - "service": { - "fullName": "google.cloud.security.privateca.v1beta1.CertificateAuthorityService", - "shortName": "CertificateAuthorityService" - }, - "shortName": "ScheduleDeleteCertificateAuthority" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.security.privateca_v1beta1.types.ScheduleDeleteCertificateAuthorityRequest" - }, - { - "name": "name", - "type": "str" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.api_core.operation.Operation", - "shortName": "schedule_delete_certificate_authority" - }, - "description": "Sample for ScheduleDeleteCertificateAuthority", - "file": "privateca_v1beta1_generated_certificate_authority_service_schedule_delete_certificate_authority_sync.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "privateca_v1beta1_generated_CertificateAuthorityService_ScheduleDeleteCertificateAuthority_sync", - "segments": [ - { - "end": 55, - "start": 27, - "type": "FULL" - }, - { - "end": 55, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 45, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 52, - "start": 46, - "type": "REQUEST_EXECUTION" - }, - { - "end": 56, - "start": 53, - "type": "RESPONSE_HANDLING" - } - ], - "title": "privateca_v1beta1_generated_certificate_authority_service_schedule_delete_certificate_authority_sync.py" - }, - { - "canonical": true, - "clientMethod": { - "async": true, - "client": { - "fullName": "google.cloud.security.privateca_v1beta1.CertificateAuthorityServiceAsyncClient", - "shortName": "CertificateAuthorityServiceAsyncClient" - }, - "fullName": "google.cloud.security.privateca_v1beta1.CertificateAuthorityServiceAsyncClient.update_certificate_authority", - "method": { - "fullName": "google.cloud.security.privateca.v1beta1.CertificateAuthorityService.UpdateCertificateAuthority", - "service": { - "fullName": "google.cloud.security.privateca.v1beta1.CertificateAuthorityService", - "shortName": "CertificateAuthorityService" - }, - "shortName": "UpdateCertificateAuthority" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.security.privateca_v1beta1.types.UpdateCertificateAuthorityRequest" - }, - { - "name": "certificate_authority", - "type": "google.cloud.security.privateca_v1beta1.types.CertificateAuthority" - }, - { - "name": "update_mask", - "type": "google.protobuf.field_mask_pb2.FieldMask" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.api_core.operation_async.AsyncOperation", - "shortName": "update_certificate_authority" - }, - "description": "Sample for UpdateCertificateAuthority", - "file": "privateca_v1beta1_generated_certificate_authority_service_update_certificate_authority_async.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "privateca_v1beta1_generated_CertificateAuthorityService_UpdateCertificateAuthority_async", - "segments": [ - { - "end": 61, - "start": 27, - "type": "FULL" - }, - { - "end": 61, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 51, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 58, - "start": 52, - "type": "REQUEST_EXECUTION" - }, - { - "end": 62, - "start": 59, - "type": "RESPONSE_HANDLING" - } - ], - "title": "privateca_v1beta1_generated_certificate_authority_service_update_certificate_authority_async.py" - }, - { - "canonical": true, - "clientMethod": { - "client": { - "fullName": "google.cloud.security.privateca_v1beta1.CertificateAuthorityServiceClient", - "shortName": "CertificateAuthorityServiceClient" - }, - "fullName": "google.cloud.security.privateca_v1beta1.CertificateAuthorityServiceClient.update_certificate_authority", - "method": { - "fullName": "google.cloud.security.privateca.v1beta1.CertificateAuthorityService.UpdateCertificateAuthority", - "service": { - "fullName": "google.cloud.security.privateca.v1beta1.CertificateAuthorityService", - "shortName": "CertificateAuthorityService" - }, - "shortName": "UpdateCertificateAuthority" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.security.privateca_v1beta1.types.UpdateCertificateAuthorityRequest" - }, - { - "name": "certificate_authority", - "type": "google.cloud.security.privateca_v1beta1.types.CertificateAuthority" - }, - { - "name": "update_mask", - "type": "google.protobuf.field_mask_pb2.FieldMask" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.api_core.operation.Operation", - "shortName": "update_certificate_authority" - }, - "description": "Sample for UpdateCertificateAuthority", - "file": "privateca_v1beta1_generated_certificate_authority_service_update_certificate_authority_sync.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "privateca_v1beta1_generated_CertificateAuthorityService_UpdateCertificateAuthority_sync", - "segments": [ - { - "end": 61, - "start": 27, - "type": "FULL" - }, - { - "end": 61, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 51, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 58, - "start": 52, - "type": "REQUEST_EXECUTION" - }, - { - "end": 62, - "start": 59, - "type": "RESPONSE_HANDLING" - } - ], - "title": "privateca_v1beta1_generated_certificate_authority_service_update_certificate_authority_sync.py" - }, - { - "canonical": true, - "clientMethod": { - "async": true, - "client": { - "fullName": "google.cloud.security.privateca_v1beta1.CertificateAuthorityServiceAsyncClient", - "shortName": "CertificateAuthorityServiceAsyncClient" - }, - "fullName": "google.cloud.security.privateca_v1beta1.CertificateAuthorityServiceAsyncClient.update_certificate_revocation_list", - "method": { - "fullName": "google.cloud.security.privateca.v1beta1.CertificateAuthorityService.UpdateCertificateRevocationList", - "service": { - "fullName": "google.cloud.security.privateca.v1beta1.CertificateAuthorityService", - "shortName": "CertificateAuthorityService" - }, - "shortName": "UpdateCertificateRevocationList" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.security.privateca_v1beta1.types.UpdateCertificateRevocationListRequest" - }, - { - "name": "certificate_revocation_list", - "type": "google.cloud.security.privateca_v1beta1.types.CertificateRevocationList" - }, - { - "name": "update_mask", - "type": "google.protobuf.field_mask_pb2.FieldMask" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.api_core.operation_async.AsyncOperation", - "shortName": "update_certificate_revocation_list" - }, - "description": "Sample for UpdateCertificateRevocationList", - "file": "privateca_v1beta1_generated_certificate_authority_service_update_certificate_revocation_list_async.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "privateca_v1beta1_generated_CertificateAuthorityService_UpdateCertificateRevocationList_async", - "segments": [ - { - "end": 54, - "start": 27, - "type": "FULL" - }, - { - "end": 54, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 44, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 51, - "start": 45, - "type": "REQUEST_EXECUTION" - }, - { - "end": 55, - "start": 52, - "type": "RESPONSE_HANDLING" - } - ], - "title": "privateca_v1beta1_generated_certificate_authority_service_update_certificate_revocation_list_async.py" - }, - { - "canonical": true, - "clientMethod": { - "client": { - "fullName": "google.cloud.security.privateca_v1beta1.CertificateAuthorityServiceClient", - "shortName": "CertificateAuthorityServiceClient" - }, - "fullName": "google.cloud.security.privateca_v1beta1.CertificateAuthorityServiceClient.update_certificate_revocation_list", - "method": { - "fullName": "google.cloud.security.privateca.v1beta1.CertificateAuthorityService.UpdateCertificateRevocationList", - "service": { - "fullName": "google.cloud.security.privateca.v1beta1.CertificateAuthorityService", - "shortName": "CertificateAuthorityService" - }, - "shortName": "UpdateCertificateRevocationList" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.security.privateca_v1beta1.types.UpdateCertificateRevocationListRequest" - }, - { - "name": "certificate_revocation_list", - "type": "google.cloud.security.privateca_v1beta1.types.CertificateRevocationList" - }, - { - "name": "update_mask", - "type": "google.protobuf.field_mask_pb2.FieldMask" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.api_core.operation.Operation", - "shortName": "update_certificate_revocation_list" - }, - "description": "Sample for UpdateCertificateRevocationList", - "file": "privateca_v1beta1_generated_certificate_authority_service_update_certificate_revocation_list_sync.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "privateca_v1beta1_generated_CertificateAuthorityService_UpdateCertificateRevocationList_sync", - "segments": [ - { - "end": 54, - "start": 27, - "type": "FULL" - }, - { - "end": 54, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 44, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 51, - "start": 45, - "type": "REQUEST_EXECUTION" - }, - { - "end": 55, - "start": 52, - "type": "RESPONSE_HANDLING" - } - ], - "title": "privateca_v1beta1_generated_certificate_authority_service_update_certificate_revocation_list_sync.py" - }, - { - "canonical": true, - "clientMethod": { - "async": true, - "client": { - "fullName": "google.cloud.security.privateca_v1beta1.CertificateAuthorityServiceAsyncClient", - "shortName": "CertificateAuthorityServiceAsyncClient" - }, - "fullName": "google.cloud.security.privateca_v1beta1.CertificateAuthorityServiceAsyncClient.update_certificate", - "method": { - "fullName": "google.cloud.security.privateca.v1beta1.CertificateAuthorityService.UpdateCertificate", - "service": { - "fullName": "google.cloud.security.privateca.v1beta1.CertificateAuthorityService", - "shortName": "CertificateAuthorityService" - }, - "shortName": "UpdateCertificate" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.security.privateca_v1beta1.types.UpdateCertificateRequest" - }, - { - "name": "certificate", - "type": "google.cloud.security.privateca_v1beta1.types.Certificate" - }, - { - "name": "update_mask", - "type": "google.protobuf.field_mask_pb2.FieldMask" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.cloud.security.privateca_v1beta1.types.Certificate", - "shortName": "update_certificate" - }, - "description": "Sample for UpdateCertificate", - "file": "privateca_v1beta1_generated_certificate_authority_service_update_certificate_async.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "privateca_v1beta1_generated_CertificateAuthorityService_UpdateCertificate_async", - "segments": [ - { - "end": 54, - "start": 27, - "type": "FULL" - }, - { - "end": 54, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 48, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 51, - "start": 49, - "type": "REQUEST_EXECUTION" - }, - { - "end": 55, - "start": 52, - "type": "RESPONSE_HANDLING" - } - ], - "title": "privateca_v1beta1_generated_certificate_authority_service_update_certificate_async.py" - }, - { - "canonical": true, - "clientMethod": { - "client": { - "fullName": "google.cloud.security.privateca_v1beta1.CertificateAuthorityServiceClient", - "shortName": "CertificateAuthorityServiceClient" - }, - "fullName": "google.cloud.security.privateca_v1beta1.CertificateAuthorityServiceClient.update_certificate", - "method": { - "fullName": "google.cloud.security.privateca.v1beta1.CertificateAuthorityService.UpdateCertificate", - "service": { - "fullName": "google.cloud.security.privateca.v1beta1.CertificateAuthorityService", - "shortName": "CertificateAuthorityService" - }, - "shortName": "UpdateCertificate" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.security.privateca_v1beta1.types.UpdateCertificateRequest" - }, - { - "name": "certificate", - "type": "google.cloud.security.privateca_v1beta1.types.Certificate" - }, - { - "name": "update_mask", - "type": "google.protobuf.field_mask_pb2.FieldMask" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.cloud.security.privateca_v1beta1.types.Certificate", - "shortName": "update_certificate" - }, - "description": "Sample for UpdateCertificate", - "file": "privateca_v1beta1_generated_certificate_authority_service_update_certificate_sync.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "privateca_v1beta1_generated_CertificateAuthorityService_UpdateCertificate_sync", - "segments": [ - { - "end": 54, - "start": 27, - "type": "FULL" - }, - { - "end": 54, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 48, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 51, - "start": 49, - "type": "REQUEST_EXECUTION" - }, - { - "end": 55, - "start": 52, - "type": "RESPONSE_HANDLING" - } - ], - "title": "privateca_v1beta1_generated_certificate_authority_service_update_certificate_sync.py" - } - ] -} diff --git a/owl-bot-staging/v1beta1/scripts/fixup_privateca_v1beta1_keywords.py b/owl-bot-staging/v1beta1/scripts/fixup_privateca_v1beta1_keywords.py deleted file mode 100644 index 1ed2250..0000000 --- a/owl-bot-staging/v1beta1/scripts/fixup_privateca_v1beta1_keywords.py +++ /dev/null @@ -1,195 +0,0 @@ -#! /usr/bin/env python3 -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -import argparse -import os -import libcst as cst -import pathlib -import sys -from typing import (Any, Callable, Dict, List, Sequence, Tuple) - - -def partition( - predicate: Callable[[Any], bool], - iterator: Sequence[Any] -) -> Tuple[List[Any], List[Any]]: - """A stable, out-of-place partition.""" - results = ([], []) - - for i in iterator: - results[int(predicate(i))].append(i) - - # Returns trueList, falseList - return results[1], results[0] - - -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', ), - } - - def leave_Call(self, original: cst.Call, updated: cst.Call) -> cst.CSTNode: - try: - key = original.func.attr.value - kword_params = self.METHOD_TO_PARAMS[key] - except (AttributeError, KeyError): - # Either not a method from the API or too convoluted to be sure. - return updated - - # If the existing code is valid, keyword args come after positional args. - # Therefore, all positional args must map to the first parameters. - args, kwargs = partition(lambda a: not bool(a.keyword), updated.args) - if any(k.keyword.value == "request" for k in kwargs): - # We've already fixed this file, don't fix it again. - return updated - - kwargs, ctrl_kwargs = partition( - lambda a: a.keyword.value not in self.CTRL_PARAMS, - kwargs - ) - - args, ctrl_args = args[:len(kword_params)], args[len(kword_params):] - ctrl_kwargs.extend(cst.Arg(value=a.value, keyword=cst.Name(value=ctrl)) - for a, ctrl in zip(ctrl_args, self.CTRL_PARAMS)) - - request_arg = cst.Arg( - value=cst.Dict([ - cst.DictElement( - cst.SimpleString("'{}'".format(name)), -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 - # those could have been passed positionally or by keyword. - for name, arg in zip(kword_params, args + kwargs)]), - keyword=cst.Name("request") - ) - - return updated.with_changes( - args=[request_arg] + ctrl_kwargs - ) - - -def fix_files( - in_dir: pathlib.Path, - out_dir: pathlib.Path, - *, - transformer=privatecaCallTransformer(), -): - """Duplicate the input dir to the output dir, fixing file method calls. - - Preconditions: - * in_dir is a real directory - * out_dir is a real, empty directory - """ - pyfile_gen = ( - pathlib.Path(os.path.join(root, f)) - for root, _, files in os.walk(in_dir) - for f in files if os.path.splitext(f)[1] == ".py" - ) - - for fpath in pyfile_gen: - with open(fpath, 'r') as f: - src = f.read() - - # Parse the code and insert method call fixes. - tree = cst.parse_module(src) - updated = tree.visit(transformer) - - # Create the path and directory structure for the new file. - updated_path = out_dir.joinpath(fpath.relative_to(in_dir)) - updated_path.parent.mkdir(parents=True, exist_ok=True) - - # Generate the updated source file at the corresponding path. - with open(updated_path, 'w') as f: - f.write(updated.code) - - -if __name__ == '__main__': - parser = argparse.ArgumentParser( - description="""Fix up source that uses the privateca client library. - -The existing sources are NOT overwritten but are copied to output_dir with changes made. - -Note: This tool operates at a best-effort level at converting positional - parameters in client method calls to keyword based parameters. - Cases where it WILL FAIL include - A) * or ** expansion in a method call. - B) Calls via function or method alias (includes free function calls) - C) Indirect or dispatched calls (e.g. the method is looked up dynamically) - - These all constitute false negatives. The tool will also detect false - positives when an API method shares a name with another method. -""") - parser.add_argument( - '-d', - '--input-directory', - required=True, - dest='input_dir', - help='the input directory to walk for python files to fix up', - ) - parser.add_argument( - '-o', - '--output-directory', - required=True, - dest='output_dir', - help='the directory to output files fixed via un-flattening', - ) - args = parser.parse_args() - input_dir = pathlib.Path(args.input_dir) - output_dir = pathlib.Path(args.output_dir) - if not input_dir.is_dir(): - print( - f"input directory '{input_dir}' does not exist or is not a directory", - file=sys.stderr, - ) - sys.exit(-1) - - if not output_dir.is_dir(): - print( - f"output directory '{output_dir}' does not exist or is not a directory", - file=sys.stderr, - ) - sys.exit(-1) - - if os.listdir(output_dir): - print( - f"output directory '{output_dir}' is not empty", - file=sys.stderr, - ) - sys.exit(-1) - - fix_files(input_dir, output_dir) diff --git a/owl-bot-staging/v1beta1/setup.py b/owl-bot-staging/v1beta1/setup.py deleted file mode 100644 index 0c1a9f7..0000000 --- a/owl-bot-staging/v1beta1/setup.py +++ /dev/null @@ -1,92 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -import io -import os - -import setuptools # type: ignore - -package_root = os.path.abspath(os.path.dirname(__file__)) - -name = 'google-cloud-private-ca' - - -description = "Google Cloud Private Ca API client library" - -version = {} -with open(os.path.join(package_root, 'google/cloud/security/privateca/gapic_version.py')) as fp: - exec(fp.read(), version) -version = version["__version__"] - -if version[0] == "0": - release_status = "Development Status :: 4 - Beta" -else: - release_status = "Development Status :: 5 - Production/Stable" - -dependencies = [ - "google-api-core[grpc] >= 1.34.0, <3.0.0dev,!=2.0.*,!=2.1.*,!=2.2.*,!=2.3.*,!=2.4.*,!=2.5.*,!=2.6.*,!=2.7.*,!=2.8.*,!=2.9.*,!=2.10.*", - "proto-plus >= 1.22.0, <2.0.0dev", - "proto-plus >= 1.22.2, <2.0.0dev; python_version>='3.11'", - "protobuf>=3.19.5,<5.0.0dev,!=3.20.0,!=3.20.1,!=4.21.0,!=4.21.1,!=4.21.2,!=4.21.3,!=4.21.4,!=4.21.5", -] -url = "https://github.com/googleapis/python-private-ca" - -package_root = os.path.abspath(os.path.dirname(__file__)) - -readme_filename = os.path.join(package_root, "README.rst") -with io.open(readme_filename, encoding="utf-8") as readme_file: - readme = readme_file.read() - -packages = [ - package - for package in setuptools.PEP420PackageFinder.find() - if package.startswith("google") -] - -namespaces = ["google"] -if "google.cloud" in packages: - namespaces.append("google.cloud") - -setuptools.setup( - name=name, - version=version, - description=description, - long_description=readme, - author="Google LLC", - author_email="googleapis-packages@google.com", - license="Apache 2.0", - url=url, - classifiers=[ - release_status, - "Intended Audience :: Developers", - "License :: OSI Approved :: Apache Software License", - "Programming Language :: Python", - "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.7", - "Programming Language :: Python :: 3.8", - "Programming Language :: Python :: 3.9", - "Programming Language :: Python :: 3.10", - "Programming Language :: Python :: 3.11", - "Operating System :: OS Independent", - "Topic :: Internet", - ], - platforms="Posix; MacOS X; Windows", - packages=packages, - python_requires=">=3.7", - namespace_packages=namespaces, - install_requires=dependencies, - include_package_data=True, - zip_safe=False, -) diff --git a/owl-bot-staging/v1beta1/testing/constraints-3.10.txt b/owl-bot-staging/v1beta1/testing/constraints-3.10.txt deleted file mode 100644 index ed7f9ae..0000000 --- a/owl-bot-staging/v1beta1/testing/constraints-3.10.txt +++ /dev/null @@ -1,6 +0,0 @@ -# -*- coding: utf-8 -*- -# This constraints file is required for unit tests. -# List all library dependencies and extras in this file. -google-api-core -proto-plus -protobuf diff --git a/owl-bot-staging/v1beta1/testing/constraints-3.11.txt b/owl-bot-staging/v1beta1/testing/constraints-3.11.txt deleted file mode 100644 index ed7f9ae..0000000 --- a/owl-bot-staging/v1beta1/testing/constraints-3.11.txt +++ /dev/null @@ -1,6 +0,0 @@ -# -*- coding: utf-8 -*- -# This constraints file is required for unit tests. -# List all library dependencies and extras in this file. -google-api-core -proto-plus -protobuf diff --git a/owl-bot-staging/v1beta1/testing/constraints-3.12.txt b/owl-bot-staging/v1beta1/testing/constraints-3.12.txt deleted file mode 100644 index ed7f9ae..0000000 --- a/owl-bot-staging/v1beta1/testing/constraints-3.12.txt +++ /dev/null @@ -1,6 +0,0 @@ -# -*- coding: utf-8 -*- -# This constraints file is required for unit tests. -# List all library dependencies and extras in this file. -google-api-core -proto-plus -protobuf diff --git a/owl-bot-staging/v1beta1/testing/constraints-3.7.txt b/owl-bot-staging/v1beta1/testing/constraints-3.7.txt deleted file mode 100644 index 6c44adf..0000000 --- a/owl-bot-staging/v1beta1/testing/constraints-3.7.txt +++ /dev/null @@ -1,9 +0,0 @@ -# This constraints file is used to check that lower bounds -# are correct in setup.py -# List all library dependencies and extras in this file. -# Pin the version to the lower bound. -# e.g., if setup.py has "google-cloud-foo >= 1.14.0, < 2.0.0dev", -# Then this file should have google-cloud-foo==1.14.0 -google-api-core==1.34.0 -proto-plus==1.22.0 -protobuf==3.19.5 diff --git a/owl-bot-staging/v1beta1/testing/constraints-3.8.txt b/owl-bot-staging/v1beta1/testing/constraints-3.8.txt deleted file mode 100644 index ed7f9ae..0000000 --- a/owl-bot-staging/v1beta1/testing/constraints-3.8.txt +++ /dev/null @@ -1,6 +0,0 @@ -# -*- coding: utf-8 -*- -# This constraints file is required for unit tests. -# List all library dependencies and extras in this file. -google-api-core -proto-plus -protobuf diff --git a/owl-bot-staging/v1beta1/testing/constraints-3.9.txt b/owl-bot-staging/v1beta1/testing/constraints-3.9.txt deleted file mode 100644 index ed7f9ae..0000000 --- a/owl-bot-staging/v1beta1/testing/constraints-3.9.txt +++ /dev/null @@ -1,6 +0,0 @@ -# -*- coding: utf-8 -*- -# This constraints file is required for unit tests. -# List all library dependencies and extras in this file. -google-api-core -proto-plus -protobuf diff --git a/owl-bot-staging/v1beta1/tests/__init__.py b/owl-bot-staging/v1beta1/tests/__init__.py deleted file mode 100644 index 231bc12..0000000 --- a/owl-bot-staging/v1beta1/tests/__init__.py +++ /dev/null @@ -1,16 +0,0 @@ - -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# diff --git a/owl-bot-staging/v1beta1/tests/unit/__init__.py b/owl-bot-staging/v1beta1/tests/unit/__init__.py deleted file mode 100644 index 231bc12..0000000 --- a/owl-bot-staging/v1beta1/tests/unit/__init__.py +++ /dev/null @@ -1,16 +0,0 @@ - -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# diff --git a/owl-bot-staging/v1beta1/tests/unit/gapic/__init__.py b/owl-bot-staging/v1beta1/tests/unit/gapic/__init__.py deleted file mode 100644 index 231bc12..0000000 --- a/owl-bot-staging/v1beta1/tests/unit/gapic/__init__.py +++ /dev/null @@ -1,16 +0,0 @@ - -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# diff --git a/owl-bot-staging/v1beta1/tests/unit/gapic/privateca_v1beta1/__init__.py b/owl-bot-staging/v1beta1/tests/unit/gapic/privateca_v1beta1/__init__.py deleted file mode 100644 index 231bc12..0000000 --- a/owl-bot-staging/v1beta1/tests/unit/gapic/privateca_v1beta1/__init__.py +++ /dev/null @@ -1,16 +0,0 @@ - -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# diff --git a/owl-bot-staging/v1beta1/tests/unit/gapic/privateca_v1beta1/test_certificate_authority_service.py b/owl-bot-staging/v1beta1/tests/unit/gapic/privateca_v1beta1/test_certificate_authority_service.py deleted file mode 100644 index e86b4e4..0000000 --- a/owl-bot-staging/v1beta1/tests/unit/gapic/privateca_v1beta1/test_certificate_authority_service.py +++ /dev/null @@ -1,6833 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -import os -# try/except added for compatibility with python < 3.8 -try: - from unittest import mock - from unittest.mock import AsyncMock # pragma: NO COVER -except ImportError: # pragma: NO COVER - import mock - -import grpc -from grpc.experimental import aio -import math -import pytest -from proto.marshal.rules.dates import DurationRule, TimestampRule -from proto.marshal.rules import wrappers - -from google.api_core import client_options -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 -from google.api_core import operation_async # type: ignore -from google.api_core import operations_v1 -from google.api_core import path_template -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 -from google.cloud.security.privateca_v1beta1.services.certificate_authority_service import CertificateAuthorityServiceClient -from google.cloud.security.privateca_v1beta1.services.certificate_authority_service import pagers -from google.cloud.security.privateca_v1beta1.services.certificate_authority_service import transports -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 # 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 - - -def client_cert_source_callback(): - return b"cert bytes", b"key bytes" - - -# If default endpoint is localhost, then default mtls endpoint will be the same. -# This method modifies the default endpoint so the client can produce a different -# mtls endpoint for endpoint testing purposes. -def modify_default_endpoint(client): - return "foo.googleapis.com" if ("localhost" in client.DEFAULT_ENDPOINT) else client.DEFAULT_ENDPOINT - - -def test__get_default_mtls_endpoint(): - api_endpoint = "example.googleapis.com" - api_mtls_endpoint = "example.mtls.googleapis.com" - sandbox_endpoint = "example.sandbox.googleapis.com" - sandbox_mtls_endpoint = "example.mtls.sandbox.googleapis.com" - non_googleapi = "api.example.com" - - assert CertificateAuthorityServiceClient._get_default_mtls_endpoint(None) is None - assert CertificateAuthorityServiceClient._get_default_mtls_endpoint(api_endpoint) == api_mtls_endpoint - assert CertificateAuthorityServiceClient._get_default_mtls_endpoint(api_mtls_endpoint) == api_mtls_endpoint - assert CertificateAuthorityServiceClient._get_default_mtls_endpoint(sandbox_endpoint) == sandbox_mtls_endpoint - assert CertificateAuthorityServiceClient._get_default_mtls_endpoint(sandbox_mtls_endpoint) == sandbox_mtls_endpoint - assert CertificateAuthorityServiceClient._get_default_mtls_endpoint(non_googleapi) == non_googleapi - - -@pytest.mark.parametrize("client_class,transport_name", [ - (CertificateAuthorityServiceClient, "grpc"), - (CertificateAuthorityServiceAsyncClient, "grpc_asyncio"), -]) -def test_certificate_authority_service_client_from_service_account_info(client_class, transport_name): - creds = ga_credentials.AnonymousCredentials() - with mock.patch.object(service_account.Credentials, 'from_service_account_info') as factory: - factory.return_value = creds - info = {"valid": True} - client = client_class.from_service_account_info(info, transport=transport_name) - assert client.transport._credentials == creds - assert isinstance(client, client_class) - - assert client.transport._host == ( - 'privateca.googleapis.com:443' - ) - - -@pytest.mark.parametrize("transport_class,transport_name", [ - (transports.CertificateAuthorityServiceGrpcTransport, "grpc"), - (transports.CertificateAuthorityServiceGrpcAsyncIOTransport, "grpc_asyncio"), -]) -def test_certificate_authority_service_client_service_account_always_use_jwt(transport_class, transport_name): - with mock.patch.object(service_account.Credentials, 'with_always_use_jwt_access', create=True) as use_jwt: - creds = service_account.Credentials(None, None, None) - transport = transport_class(credentials=creds, always_use_jwt_access=True) - use_jwt.assert_called_once_with(True) - - with mock.patch.object(service_account.Credentials, 'with_always_use_jwt_access', create=True) as use_jwt: - creds = service_account.Credentials(None, None, None) - transport = transport_class(credentials=creds, always_use_jwt_access=False) - use_jwt.assert_not_called() - - -@pytest.mark.parametrize("client_class,transport_name", [ - (CertificateAuthorityServiceClient, "grpc"), - (CertificateAuthorityServiceAsyncClient, "grpc_asyncio"), -]) -def test_certificate_authority_service_client_from_service_account_file(client_class, transport_name): - creds = ga_credentials.AnonymousCredentials() - with mock.patch.object(service_account.Credentials, 'from_service_account_file') as factory: - factory.return_value = creds - client = client_class.from_service_account_file("dummy/file/path.json", transport=transport_name) - assert client.transport._credentials == creds - assert isinstance(client, client_class) - - client = client_class.from_service_account_json("dummy/file/path.json", transport=transport_name) - assert client.transport._credentials == creds - assert isinstance(client, client_class) - - assert client.transport._host == ( - 'privateca.googleapis.com:443' - ) - - -def test_certificate_authority_service_client_get_transport_class(): - transport = CertificateAuthorityServiceClient.get_transport_class() - available_transports = [ - transports.CertificateAuthorityServiceGrpcTransport, - ] - assert transport in available_transports - - transport = CertificateAuthorityServiceClient.get_transport_class("grpc") - assert transport == transports.CertificateAuthorityServiceGrpcTransport - - -@pytest.mark.parametrize("client_class,transport_class,transport_name", [ - (CertificateAuthorityServiceClient, transports.CertificateAuthorityServiceGrpcTransport, "grpc"), - (CertificateAuthorityServiceAsyncClient, transports.CertificateAuthorityServiceGrpcAsyncIOTransport, "grpc_asyncio"), -]) -@mock.patch.object(CertificateAuthorityServiceClient, "DEFAULT_ENDPOINT", modify_default_endpoint(CertificateAuthorityServiceClient)) -@mock.patch.object(CertificateAuthorityServiceAsyncClient, "DEFAULT_ENDPOINT", modify_default_endpoint(CertificateAuthorityServiceAsyncClient)) -def test_certificate_authority_service_client_client_options(client_class, transport_class, transport_name): - # Check that if channel is provided we won't create a new one. - with mock.patch.object(CertificateAuthorityServiceClient, 'get_transport_class') as gtc: - transport = transport_class( - credentials=ga_credentials.AnonymousCredentials() - ) - client = client_class(transport=transport) - gtc.assert_not_called() - - # Check that if channel is provided via str we will create a new one. - with mock.patch.object(CertificateAuthorityServiceClient, 'get_transport_class') as gtc: - client = client_class(transport=transport_name) - gtc.assert_called() - - # Check the case api_endpoint is provided. - options = client_options.ClientOptions(api_endpoint="squid.clam.whelk") - with mock.patch.object(transport_class, '__init__') as patched: - patched.return_value = None - client = client_class(transport=transport_name, client_options=options) - patched.assert_called_once_with( - credentials=None, - credentials_file=None, - host="squid.clam.whelk", - scopes=None, - client_cert_source_for_mtls=None, - quota_project_id=None, - client_info=transports.base.DEFAULT_CLIENT_INFO, - always_use_jwt_access=True, - api_audience=None, - ) - - # Check the case api_endpoint is not provided and GOOGLE_API_USE_MTLS_ENDPOINT is - # "never". - with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "never"}): - with mock.patch.object(transport_class, '__init__') as patched: - patched.return_value = None - client = client_class(transport=transport_name) - patched.assert_called_once_with( - credentials=None, - credentials_file=None, - host=client.DEFAULT_ENDPOINT, - scopes=None, - client_cert_source_for_mtls=None, - quota_project_id=None, - client_info=transports.base.DEFAULT_CLIENT_INFO, - always_use_jwt_access=True, - api_audience=None, - ) - - # Check the case api_endpoint is not provided and GOOGLE_API_USE_MTLS_ENDPOINT is - # "always". - with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "always"}): - with mock.patch.object(transport_class, '__init__') as patched: - patched.return_value = None - client = client_class(transport=transport_name) - patched.assert_called_once_with( - credentials=None, - credentials_file=None, - host=client.DEFAULT_MTLS_ENDPOINT, - scopes=None, - client_cert_source_for_mtls=None, - quota_project_id=None, - client_info=transports.base.DEFAULT_CLIENT_INFO, - always_use_jwt_access=True, - api_audience=None, - ) - - # Check the case api_endpoint is not provided and GOOGLE_API_USE_MTLS_ENDPOINT has - # unsupported value. - with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "Unsupported"}): - with pytest.raises(MutualTLSChannelError): - client = client_class(transport=transport_name) - - # Check the case GOOGLE_API_USE_CLIENT_CERTIFICATE has unsupported value. - with mock.patch.dict(os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": "Unsupported"}): - with pytest.raises(ValueError): - client = client_class(transport=transport_name) - - # Check the case quota_project_id is provided - options = client_options.ClientOptions(quota_project_id="octopus") - with mock.patch.object(transport_class, '__init__') as patched: - patched.return_value = None - client = client_class(client_options=options, transport=transport_name) - patched.assert_called_once_with( - credentials=None, - credentials_file=None, - host=client.DEFAULT_ENDPOINT, - scopes=None, - client_cert_source_for_mtls=None, - quota_project_id="octopus", - client_info=transports.base.DEFAULT_CLIENT_INFO, - always_use_jwt_access=True, - api_audience=None, - ) - # Check the case api_endpoint is provided - options = client_options.ClientOptions(api_audience="https://language.googleapis.com") - with mock.patch.object(transport_class, '__init__') as patched: - patched.return_value = None - client = client_class(client_options=options, transport=transport_name) - patched.assert_called_once_with( - credentials=None, - credentials_file=None, - host=client.DEFAULT_ENDPOINT, - scopes=None, - client_cert_source_for_mtls=None, - quota_project_id=None, - client_info=transports.base.DEFAULT_CLIENT_INFO, - always_use_jwt_access=True, - api_audience="https://language.googleapis.com" - ) - -@pytest.mark.parametrize("client_class,transport_class,transport_name,use_client_cert_env", [ - (CertificateAuthorityServiceClient, transports.CertificateAuthorityServiceGrpcTransport, "grpc", "true"), - (CertificateAuthorityServiceAsyncClient, transports.CertificateAuthorityServiceGrpcAsyncIOTransport, "grpc_asyncio", "true"), - (CertificateAuthorityServiceClient, transports.CertificateAuthorityServiceGrpcTransport, "grpc", "false"), - (CertificateAuthorityServiceAsyncClient, transports.CertificateAuthorityServiceGrpcAsyncIOTransport, "grpc_asyncio", "false"), -]) -@mock.patch.object(CertificateAuthorityServiceClient, "DEFAULT_ENDPOINT", modify_default_endpoint(CertificateAuthorityServiceClient)) -@mock.patch.object(CertificateAuthorityServiceAsyncClient, "DEFAULT_ENDPOINT", modify_default_endpoint(CertificateAuthorityServiceAsyncClient)) -@mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "auto"}) -def test_certificate_authority_service_client_mtls_env_auto(client_class, transport_class, transport_name, use_client_cert_env): - # This tests the endpoint autoswitch behavior. Endpoint is autoswitched to the default - # mtls endpoint, if GOOGLE_API_USE_CLIENT_CERTIFICATE is "true" and client cert exists. - - # Check the case client_cert_source is provided. Whether client cert is used depends on - # GOOGLE_API_USE_CLIENT_CERTIFICATE value. - with mock.patch.dict(os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": use_client_cert_env}): - options = client_options.ClientOptions(client_cert_source=client_cert_source_callback) - with mock.patch.object(transport_class, '__init__') as patched: - patched.return_value = None - client = client_class(client_options=options, transport=transport_name) - - if use_client_cert_env == "false": - expected_client_cert_source = None - expected_host = client.DEFAULT_ENDPOINT - else: - expected_client_cert_source = client_cert_source_callback - expected_host = client.DEFAULT_MTLS_ENDPOINT - - patched.assert_called_once_with( - credentials=None, - credentials_file=None, - host=expected_host, - scopes=None, - client_cert_source_for_mtls=expected_client_cert_source, - quota_project_id=None, - client_info=transports.base.DEFAULT_CLIENT_INFO, - always_use_jwt_access=True, - api_audience=None, - ) - - # Check the case ADC client cert is provided. Whether client cert is used depends on - # GOOGLE_API_USE_CLIENT_CERTIFICATE value. - with mock.patch.dict(os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": use_client_cert_env}): - with mock.patch.object(transport_class, '__init__') as patched: - with mock.patch('google.auth.transport.mtls.has_default_client_cert_source', return_value=True): - with mock.patch('google.auth.transport.mtls.default_client_cert_source', return_value=client_cert_source_callback): - if use_client_cert_env == "false": - expected_host = client.DEFAULT_ENDPOINT - expected_client_cert_source = None - else: - expected_host = client.DEFAULT_MTLS_ENDPOINT - expected_client_cert_source = client_cert_source_callback - - patched.return_value = None - client = client_class(transport=transport_name) - patched.assert_called_once_with( - credentials=None, - credentials_file=None, - host=expected_host, - scopes=None, - client_cert_source_for_mtls=expected_client_cert_source, - quota_project_id=None, - client_info=transports.base.DEFAULT_CLIENT_INFO, - always_use_jwt_access=True, - api_audience=None, - ) - - # Check the case client_cert_source and ADC client cert are not provided. - with mock.patch.dict(os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": use_client_cert_env}): - with mock.patch.object(transport_class, '__init__') as patched: - with mock.patch("google.auth.transport.mtls.has_default_client_cert_source", return_value=False): - patched.return_value = None - client = client_class(transport=transport_name) - patched.assert_called_once_with( - credentials=None, - credentials_file=None, - host=client.DEFAULT_ENDPOINT, - scopes=None, - client_cert_source_for_mtls=None, - quota_project_id=None, - client_info=transports.base.DEFAULT_CLIENT_INFO, - always_use_jwt_access=True, - api_audience=None, - ) - - -@pytest.mark.parametrize("client_class", [ - CertificateAuthorityServiceClient, CertificateAuthorityServiceAsyncClient -]) -@mock.patch.object(CertificateAuthorityServiceClient, "DEFAULT_ENDPOINT", modify_default_endpoint(CertificateAuthorityServiceClient)) -@mock.patch.object(CertificateAuthorityServiceAsyncClient, "DEFAULT_ENDPOINT", modify_default_endpoint(CertificateAuthorityServiceAsyncClient)) -def test_certificate_authority_service_client_get_mtls_endpoint_and_cert_source(client_class): - mock_client_cert_source = mock.Mock() - - # Test the case GOOGLE_API_USE_CLIENT_CERTIFICATE is "true". - with mock.patch.dict(os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": "true"}): - mock_api_endpoint = "foo" - options = client_options.ClientOptions(client_cert_source=mock_client_cert_source, api_endpoint=mock_api_endpoint) - api_endpoint, cert_source = client_class.get_mtls_endpoint_and_cert_source(options) - assert api_endpoint == mock_api_endpoint - assert cert_source == mock_client_cert_source - - # Test the case GOOGLE_API_USE_CLIENT_CERTIFICATE is "false". - with mock.patch.dict(os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": "false"}): - mock_client_cert_source = mock.Mock() - mock_api_endpoint = "foo" - options = client_options.ClientOptions(client_cert_source=mock_client_cert_source, api_endpoint=mock_api_endpoint) - api_endpoint, cert_source = client_class.get_mtls_endpoint_and_cert_source(options) - assert api_endpoint == mock_api_endpoint - assert cert_source is None - - # Test the case GOOGLE_API_USE_MTLS_ENDPOINT is "never". - with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "never"}): - api_endpoint, cert_source = client_class.get_mtls_endpoint_and_cert_source() - assert api_endpoint == client_class.DEFAULT_ENDPOINT - assert cert_source is None - - # Test the case GOOGLE_API_USE_MTLS_ENDPOINT is "always". - with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "always"}): - api_endpoint, cert_source = client_class.get_mtls_endpoint_and_cert_source() - assert api_endpoint == client_class.DEFAULT_MTLS_ENDPOINT - assert cert_source is None - - # Test the case GOOGLE_API_USE_MTLS_ENDPOINT is "auto" and default cert doesn't exist. - with mock.patch.dict(os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": "true"}): - with mock.patch('google.auth.transport.mtls.has_default_client_cert_source', return_value=False): - api_endpoint, cert_source = client_class.get_mtls_endpoint_and_cert_source() - assert api_endpoint == client_class.DEFAULT_ENDPOINT - assert cert_source is None - - # Test the case GOOGLE_API_USE_MTLS_ENDPOINT is "auto" and default cert exists. - with mock.patch.dict(os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": "true"}): - with mock.patch('google.auth.transport.mtls.has_default_client_cert_source', return_value=True): - with mock.patch('google.auth.transport.mtls.default_client_cert_source', return_value=mock_client_cert_source): - api_endpoint, cert_source = client_class.get_mtls_endpoint_and_cert_source() - assert api_endpoint == client_class.DEFAULT_MTLS_ENDPOINT - assert cert_source == mock_client_cert_source - - -@pytest.mark.parametrize("client_class,transport_class,transport_name", [ - (CertificateAuthorityServiceClient, transports.CertificateAuthorityServiceGrpcTransport, "grpc"), - (CertificateAuthorityServiceAsyncClient, transports.CertificateAuthorityServiceGrpcAsyncIOTransport, "grpc_asyncio"), -]) -def test_certificate_authority_service_client_client_options_scopes(client_class, transport_class, transport_name): - # Check the case scopes are provided. - options = client_options.ClientOptions( - scopes=["1", "2"], - ) - with mock.patch.object(transport_class, '__init__') as patched: - patched.return_value = None - client = client_class(client_options=options, transport=transport_name) - patched.assert_called_once_with( - credentials=None, - credentials_file=None, - host=client.DEFAULT_ENDPOINT, - scopes=["1", "2"], - client_cert_source_for_mtls=None, - quota_project_id=None, - client_info=transports.base.DEFAULT_CLIENT_INFO, - always_use_jwt_access=True, - api_audience=None, - ) - -@pytest.mark.parametrize("client_class,transport_class,transport_name,grpc_helpers", [ - (CertificateAuthorityServiceClient, transports.CertificateAuthorityServiceGrpcTransport, "grpc", grpc_helpers), - (CertificateAuthorityServiceAsyncClient, transports.CertificateAuthorityServiceGrpcAsyncIOTransport, "grpc_asyncio", grpc_helpers_async), -]) -def test_certificate_authority_service_client_client_options_credentials_file(client_class, transport_class, transport_name, grpc_helpers): - # Check the case credentials file is provided. - options = client_options.ClientOptions( - credentials_file="credentials.json" - ) - - with mock.patch.object(transport_class, '__init__') as patched: - patched.return_value = None - client = client_class(client_options=options, transport=transport_name) - patched.assert_called_once_with( - credentials=None, - credentials_file="credentials.json", - host=client.DEFAULT_ENDPOINT, - scopes=None, - client_cert_source_for_mtls=None, - quota_project_id=None, - client_info=transports.base.DEFAULT_CLIENT_INFO, - always_use_jwt_access=True, - api_audience=None, - ) - -def test_certificate_authority_service_client_client_options_from_dict(): - with mock.patch('google.cloud.security.privateca_v1beta1.services.certificate_authority_service.transports.CertificateAuthorityServiceGrpcTransport.__init__') as grpc_transport: - grpc_transport.return_value = None - client = CertificateAuthorityServiceClient( - client_options={'api_endpoint': 'squid.clam.whelk'} - ) - grpc_transport.assert_called_once_with( - credentials=None, - credentials_file=None, - host="squid.clam.whelk", - scopes=None, - client_cert_source_for_mtls=None, - quota_project_id=None, - client_info=transports.base.DEFAULT_CLIENT_INFO, - always_use_jwt_access=True, - api_audience=None, - ) - - -@pytest.mark.parametrize("client_class,transport_class,transport_name,grpc_helpers", [ - (CertificateAuthorityServiceClient, transports.CertificateAuthorityServiceGrpcTransport, "grpc", grpc_helpers), - (CertificateAuthorityServiceAsyncClient, transports.CertificateAuthorityServiceGrpcAsyncIOTransport, "grpc_asyncio", grpc_helpers_async), -]) -def test_certificate_authority_service_client_create_channel_credentials_file(client_class, transport_class, transport_name, grpc_helpers): - # Check the case credentials file is provided. - options = client_options.ClientOptions( - credentials_file="credentials.json" - ) - - with mock.patch.object(transport_class, '__init__') as patched: - patched.return_value = None - client = client_class(client_options=options, transport=transport_name) - patched.assert_called_once_with( - credentials=None, - credentials_file="credentials.json", - host=client.DEFAULT_ENDPOINT, - scopes=None, - client_cert_source_for_mtls=None, - quota_project_id=None, - client_info=transports.base.DEFAULT_CLIENT_INFO, - always_use_jwt_access=True, - api_audience=None, - ) - - # test that the credentials from file are saved and used as the credentials. - with mock.patch.object( - google.auth, "load_credentials_from_file", autospec=True - ) as load_creds, mock.patch.object( - google.auth, "default", autospec=True - ) as adc, mock.patch.object( - grpc_helpers, "create_channel" - ) as create_channel: - creds = ga_credentials.AnonymousCredentials() - file_creds = ga_credentials.AnonymousCredentials() - load_creds.return_value = (file_creds, None) - adc.return_value = (creds, None) - client = client_class(client_options=options, transport=transport_name) - create_channel.assert_called_with( - "privateca.googleapis.com:443", - credentials=file_creds, - credentials_file=None, - quota_project_id=None, - default_scopes=( - 'https://www.googleapis.com/auth/cloud-platform', -), - scopes=None, - default_host="privateca.googleapis.com", - ssl_credentials=None, - options=[ - ("grpc.max_send_message_length", -1), - ("grpc.max_receive_message_length", -1), - ], - ) - - -@pytest.mark.parametrize("request_type", [ - service.CreateCertificateRequest, - dict, -]) -def test_create_certificate(request_type, transport: str = 'grpc'): - client = CertificateAuthorityServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.create_certificate), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = resources.Certificate( - name='name_value', - pem_certificate='pem_certificate_value', - 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'] - - -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=ga_credentials.AnonymousCredentials(), - transport='grpc', - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.create_certificate), - '__call__') as call: - client.create_certificate() - call.assert_called() - _, args, _ = call.mock_calls[0] - assert args[0] == service.CreateCertificateRequest() - -@pytest.mark.asyncio -async def test_create_certificate_async(transport: str = 'grpc_asyncio', request_type=service.CreateCertificateRequest): - client = CertificateAuthorityServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.create_certificate), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(resources.Certificate( - name='name_value', - pem_certificate='pem_certificate_value', - 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'] - - -@pytest.mark.asyncio -async def test_create_certificate_async_from_dict(): - await test_create_certificate_async(request_type=dict) - - -def test_create_certificate_field_headers(): - client = CertificateAuthorityServiceClient( - 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. - with mock.patch.object( - 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. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ( - 'x-goog-request-params', - 'parent=parent_value', - ) in kw['metadata'] - - -@pytest.mark.asyncio -async def test_create_certificate_field_headers_async(): - client = CertificateAuthorityServiceAsyncClient( - 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. - with mock.patch.object( - type(client.transport.create_certificate), - '__call__') as call: - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(resources.Certificate()) - 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] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ( - 'x-goog-request-params', - 'parent=parent_value', - ) in kw['metadata'] - - -def test_create_certificate_flattened(): - client = CertificateAuthorityServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.create_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.create_certificate( - parent='parent_value', - certificate=resources.Certificate(name='name_value'), - certificate_id='certificate_id_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] - arg = args[0].parent - mock_val = 'parent_value' - assert arg == mock_val - arg = args[0].certificate - mock_val = resources.Certificate(name='name_value') - assert arg == mock_val - arg = args[0].certificate_id - mock_val = 'certificate_id_value' - assert arg == mock_val - - -def test_create_certificate_flattened_error(): - client = CertificateAuthorityServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Attempting to call a method with both a request object and flattened - # fields is an error. - with pytest.raises(ValueError): - client.create_certificate( - service.CreateCertificateRequest(), - parent='parent_value', - certificate=resources.Certificate(name='name_value'), - certificate_id='certificate_id_value', - ) - -@pytest.mark.asyncio -async def test_create_certificate_flattened_async(): - client = CertificateAuthorityServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.create_certificate), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = resources.Certificate() - - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(resources.Certificate()) - # Call the method with a truthy value for each flattened field, - # using the keyword arguments to the method. - response = await client.create_certificate( - parent='parent_value', - certificate=resources.Certificate(name='name_value'), - certificate_id='certificate_id_value', - ) - - # Establish that the underlying call was made with the expected - # request object values. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - arg = args[0].parent - mock_val = 'parent_value' - assert arg == mock_val - arg = args[0].certificate - mock_val = resources.Certificate(name='name_value') - assert arg == mock_val - arg = args[0].certificate_id - mock_val = 'certificate_id_value' - assert arg == mock_val - -@pytest.mark.asyncio -async def test_create_certificate_flattened_error_async(): - client = CertificateAuthorityServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Attempting to call a method with both a request object and flattened - # fields is an error. - with pytest.raises(ValueError): - await client.create_certificate( - service.CreateCertificateRequest(), - parent='parent_value', - certificate=resources.Certificate(name='name_value'), - certificate_id='certificate_id_value', - ) - - -@pytest.mark.parametrize("request_type", [ - service.GetCertificateRequest, - dict, -]) -def test_get_certificate(request_type, transport: str = 'grpc'): - client = CertificateAuthorityServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # 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( - name='name_value', - pem_certificate='pem_certificate_value', - 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'] - - -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=ga_credentials.AnonymousCredentials(), - transport='grpc', - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.get_certificate), - '__call__') as call: - client.get_certificate() - call.assert_called() - _, args, _ = call.mock_calls[0] - assert args[0] == service.GetCertificateRequest() - -@pytest.mark.asyncio -async def test_get_certificate_async(transport: str = 'grpc_asyncio', request_type=service.GetCertificateRequest): - client = CertificateAuthorityServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # 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 =grpc_helpers_async.FakeUnaryUnaryCall(resources.Certificate( - name='name_value', - pem_certificate='pem_certificate_value', - 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'] - - -@pytest.mark.asyncio -async def test_get_certificate_async_from_dict(): - await test_get_certificate_async(request_type=dict) - - -def test_get_certificate_field_headers(): - client = CertificateAuthorityServiceClient( - 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. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ( - 'x-goog-request-params', - 'name=name_value', - ) in kw['metadata'] - - -@pytest.mark.asyncio -async def test_get_certificate_field_headers_async(): - client = CertificateAuthorityServiceAsyncClient( - 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 = grpc_helpers_async.FakeUnaryUnaryCall(resources.Certificate()) - 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] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ( - 'x-goog-request-params', - 'name=name_value', - ) in kw['metadata'] - - -def test_get_certificate_flattened(): - client = CertificateAuthorityServiceClient( - 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', - ) - - # Establish that the underlying call was made with the expected - # request object values. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - arg = args[0].name - mock_val = 'name_value' - assert arg == mock_val - - -def test_get_certificate_flattened_error(): - client = CertificateAuthorityServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Attempting to call a method with both a request object and flattened - # fields is an error. - with pytest.raises(ValueError): - client.get_certificate( - service.GetCertificateRequest(), - name='name_value', - ) - -@pytest.mark.asyncio -async def test_get_certificate_flattened_async(): - client = CertificateAuthorityServiceAsyncClient( - 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.return_value = grpc_helpers_async.FakeUnaryUnaryCall(resources.Certificate()) - # Call the method with a truthy value for each flattened field, - # using the keyword arguments to the method. - response = await client.get_certificate( - name='name_value', - ) - - # Establish that the underlying call was made with the expected - # request object values. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - arg = args[0].name - mock_val = 'name_value' - assert arg == mock_val - -@pytest.mark.asyncio -async def test_get_certificate_flattened_error_async(): - client = CertificateAuthorityServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Attempting to call a method with both a request object and flattened - # fields is an error. - with pytest.raises(ValueError): - await client.get_certificate( - service.GetCertificateRequest(), - name='name_value', - ) - - -@pytest.mark.parametrize("request_type", [ - service.ListCertificatesRequest, - dict, -]) -def test_list_certificates(request_type, transport: str = 'grpc'): - client = CertificateAuthorityServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_certificates), - '__call__') as call: - # Designate an appropriate return value for the call. - 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'] - - -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=ga_credentials.AnonymousCredentials(), - transport='grpc', - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_certificates), - '__call__') as call: - client.list_certificates() - call.assert_called() - _, args, _ = call.mock_calls[0] - assert args[0] == service.ListCertificatesRequest() - -@pytest.mark.asyncio -async def test_list_certificates_async(transport: str = 'grpc_asyncio', request_type=service.ListCertificatesRequest): - client = CertificateAuthorityServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_certificates), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(service.ListCertificatesResponse( - next_page_token='next_page_token_value', - 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'] - - -@pytest.mark.asyncio -async def test_list_certificates_async_from_dict(): - await test_list_certificates_async(request_type=dict) - - -def test_list_certificates_field_headers(): - client = CertificateAuthorityServiceClient( - 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. - with mock.patch.object( - 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. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ( - 'x-goog-request-params', - 'parent=parent_value', - ) in kw['metadata'] - - -@pytest.mark.asyncio -async def test_list_certificates_field_headers_async(): - client = CertificateAuthorityServiceAsyncClient( - 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. - with mock.patch.object( - type(client.transport.list_certificates), - '__call__') as call: - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(service.ListCertificatesResponse()) - 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] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ( - 'x-goog-request-params', - 'parent=parent_value', - ) in kw['metadata'] - - -def test_list_certificates_flattened(): - client = CertificateAuthorityServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_certificates), - '__call__') 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', - ) - - # Establish that the underlying call was made with the expected - # request object values. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - arg = args[0].parent - mock_val = 'parent_value' - assert arg == mock_val - - -def test_list_certificates_flattened_error(): - client = CertificateAuthorityServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Attempting to call a method with both a request object and flattened - # fields is an error. - with pytest.raises(ValueError): - client.list_certificates( - service.ListCertificatesRequest(), - parent='parent_value', - ) - -@pytest.mark.asyncio -async def test_list_certificates_flattened_async(): - client = CertificateAuthorityServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_certificates), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = service.ListCertificatesResponse() - - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(service.ListCertificatesResponse()) - # Call the method with a truthy value for each flattened field, - # using the keyword arguments to the method. - response = await client.list_certificates( - parent='parent_value', - ) - - # Establish that the underlying call was made with the expected - # request object values. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - arg = args[0].parent - mock_val = 'parent_value' - assert arg == mock_val - -@pytest.mark.asyncio -async def test_list_certificates_flattened_error_async(): - client = CertificateAuthorityServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Attempting to call a method with both a request object and flattened - # fields is an error. - with pytest.raises(ValueError): - await client.list_certificates( - service.ListCertificatesRequest(), - parent='parent_value', - ) - - -def test_list_certificates_pager(transport_name: str = "grpc"): - client = CertificateAuthorityServiceClient( - credentials=ga_credentials.AnonymousCredentials, - transport=transport_name, - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_certificates), - '__call__') as call: - # Set the response to a series of pages. - call.side_effect = ( - service.ListCertificatesResponse( - certificates=[ - resources.Certificate(), - resources.Certificate(), - resources.Certificate(), - ], - next_page_token='abc', - ), - service.ListCertificatesResponse( - certificates=[], - next_page_token='def', - ), - service.ListCertificatesResponse( - certificates=[ - resources.Certificate(), - ], - next_page_token='ghi', - ), - service.ListCertificatesResponse( - certificates=[ - resources.Certificate(), - resources.Certificate(), - ], - ), - RuntimeError, - ) - - metadata = () - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata(( - ('parent', ''), - )), - ) - pager = client.list_certificates(request={}) - - assert pager._metadata == metadata - - results = list(pager) - assert len(results) == 6 - assert all(isinstance(i, resources.Certificate) - for i in results) -def test_list_certificates_pages(transport_name: str = "grpc"): - client = CertificateAuthorityServiceClient( - credentials=ga_credentials.AnonymousCredentials, - transport=transport_name, - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_certificates), - '__call__') as call: - # Set the response to a series of pages. - call.side_effect = ( - service.ListCertificatesResponse( - certificates=[ - resources.Certificate(), - resources.Certificate(), - resources.Certificate(), - ], - next_page_token='abc', - ), - service.ListCertificatesResponse( - certificates=[], - next_page_token='def', - ), - service.ListCertificatesResponse( - certificates=[ - resources.Certificate(), - ], - next_page_token='ghi', - ), - service.ListCertificatesResponse( - certificates=[ - resources.Certificate(), - resources.Certificate(), - ], - ), - RuntimeError, - ) - pages = list(client.list_certificates(request={}).pages) - for page_, token in zip(pages, ['abc','def','ghi', '']): - assert page_.raw_page.next_page_token == token - -@pytest.mark.asyncio -async def test_list_certificates_async_pager(): - client = CertificateAuthorityServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials, - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_certificates), - '__call__', new_callable=mock.AsyncMock) as call: - # Set the response to a series of pages. - call.side_effect = ( - service.ListCertificatesResponse( - certificates=[ - resources.Certificate(), - resources.Certificate(), - resources.Certificate(), - ], - next_page_token='abc', - ), - service.ListCertificatesResponse( - certificates=[], - next_page_token='def', - ), - service.ListCertificatesResponse( - certificates=[ - resources.Certificate(), - ], - next_page_token='ghi', - ), - service.ListCertificatesResponse( - certificates=[ - resources.Certificate(), - resources.Certificate(), - ], - ), - RuntimeError, - ) - async_pager = await client.list_certificates(request={},) - assert async_pager.next_page_token == 'abc' - responses = [] - async for response in async_pager: # pragma: no branch - responses.append(response) - - assert len(responses) == 6 - assert all(isinstance(i, resources.Certificate) - for i in responses) - - -@pytest.mark.asyncio -async def test_list_certificates_async_pages(): - client = CertificateAuthorityServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials, - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_certificates), - '__call__', new_callable=mock.AsyncMock) as call: - # Set the response to a series of pages. - call.side_effect = ( - service.ListCertificatesResponse( - certificates=[ - resources.Certificate(), - resources.Certificate(), - resources.Certificate(), - ], - next_page_token='abc', - ), - service.ListCertificatesResponse( - certificates=[], - next_page_token='def', - ), - service.ListCertificatesResponse( - certificates=[ - resources.Certificate(), - ], - next_page_token='ghi', - ), - service.ListCertificatesResponse( - certificates=[ - resources.Certificate(), - resources.Certificate(), - ], - ), - RuntimeError, - ) - pages = [] - async for page_ in (await client.list_certificates(request={})).pages: # pragma: no branch - pages.append(page_) - for page_, token in zip(pages, ['abc','def','ghi', '']): - assert page_.raw_page.next_page_token == token - -@pytest.mark.parametrize("request_type", [ - service.RevokeCertificateRequest, - dict, -]) -def test_revoke_certificate(request_type, transport: str = 'grpc'): - client = CertificateAuthorityServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.revoke_certificate), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = resources.Certificate( - name='name_value', - pem_certificate='pem_certificate_value', - 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'] - - -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=ga_credentials.AnonymousCredentials(), - transport='grpc', - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.revoke_certificate), - '__call__') as call: - client.revoke_certificate() - call.assert_called() - _, args, _ = call.mock_calls[0] - assert args[0] == service.RevokeCertificateRequest() - -@pytest.mark.asyncio -async def test_revoke_certificate_async(transport: str = 'grpc_asyncio', request_type=service.RevokeCertificateRequest): - client = CertificateAuthorityServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.revoke_certificate), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(resources.Certificate( - name='name_value', - pem_certificate='pem_certificate_value', - 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'] - - -@pytest.mark.asyncio -async def test_revoke_certificate_async_from_dict(): - await test_revoke_certificate_async(request_type=dict) - - -def test_revoke_certificate_field_headers(): - client = CertificateAuthorityServiceClient( - 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. - with mock.patch.object( - 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. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ( - 'x-goog-request-params', - 'name=name_value', - ) in kw['metadata'] - - -@pytest.mark.asyncio -async def test_revoke_certificate_field_headers_async(): - client = CertificateAuthorityServiceAsyncClient( - 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. - with mock.patch.object( - type(client.transport.revoke_certificate), - '__call__') as call: - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(resources.Certificate()) - 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] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ( - 'x-goog-request-params', - 'name=name_value', - ) in kw['metadata'] - - -def test_revoke_certificate_flattened(): - client = CertificateAuthorityServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.revoke_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.revoke_certificate( - name='name_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] - arg = args[0].name - mock_val = 'name_value' - assert arg == mock_val - - -def test_revoke_certificate_flattened_error(): - client = CertificateAuthorityServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Attempting to call a method with both a request object and flattened - # fields is an error. - with pytest.raises(ValueError): - client.revoke_certificate( - service.RevokeCertificateRequest(), - name='name_value', - ) - -@pytest.mark.asyncio -async def test_revoke_certificate_flattened_async(): - client = CertificateAuthorityServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.revoke_certificate), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = resources.Certificate() - - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(resources.Certificate()) - # Call the method with a truthy value for each flattened field, - # using the keyword arguments to the method. - response = await client.revoke_certificate( - name='name_value', - ) - - # Establish that the underlying call was made with the expected - # request object values. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - arg = args[0].name - mock_val = 'name_value' - assert arg == mock_val - -@pytest.mark.asyncio -async def test_revoke_certificate_flattened_error_async(): - client = CertificateAuthorityServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Attempting to call a method with both a request object and flattened - # fields is an error. - with pytest.raises(ValueError): - await client.revoke_certificate( - service.RevokeCertificateRequest(), - name='name_value', - ) - - -@pytest.mark.parametrize("request_type", [ - service.UpdateCertificateRequest, - dict, -]) -def test_update_certificate(request_type, transport: str = 'grpc'): - client = CertificateAuthorityServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.update_certificate), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = resources.Certificate( - name='name_value', - pem_certificate='pem_certificate_value', - 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'] - - -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=ga_credentials.AnonymousCredentials(), - transport='grpc', - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.update_certificate), - '__call__') as call: - client.update_certificate() - call.assert_called() - _, args, _ = call.mock_calls[0] - assert args[0] == service.UpdateCertificateRequest() - -@pytest.mark.asyncio -async def test_update_certificate_async(transport: str = 'grpc_asyncio', request_type=service.UpdateCertificateRequest): - client = CertificateAuthorityServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.update_certificate), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(resources.Certificate( - name='name_value', - pem_certificate='pem_certificate_value', - 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'] - - -@pytest.mark.asyncio -async def test_update_certificate_async_from_dict(): - await test_update_certificate_async(request_type=dict) - - -def test_update_certificate_field_headers(): - client = CertificateAuthorityServiceClient( - 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 = 'name_value' - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - 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. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ( - 'x-goog-request-params', - 'certificate.name=name_value', - ) in kw['metadata'] - - -@pytest.mark.asyncio -async def test_update_certificate_field_headers_async(): - client = CertificateAuthorityServiceAsyncClient( - 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 = 'name_value' - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.update_certificate), - '__call__') as call: - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(resources.Certificate()) - 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] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ( - 'x-goog-request-params', - 'certificate.name=name_value', - ) in kw['metadata'] - - -def test_update_certificate_flattened(): - client = CertificateAuthorityServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.update_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.update_certificate( - certificate=resources.Certificate(name='name_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] - arg = args[0].certificate - mock_val = resources.Certificate(name='name_value') - assert arg == mock_val - arg = args[0].update_mask - mock_val = field_mask_pb2.FieldMask(paths=['paths_value']) - assert arg == mock_val - - -def test_update_certificate_flattened_error(): - client = CertificateAuthorityServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Attempting to call a method with both a request object and flattened - # fields is an error. - with pytest.raises(ValueError): - client.update_certificate( - service.UpdateCertificateRequest(), - certificate=resources.Certificate(name='name_value'), - update_mask=field_mask_pb2.FieldMask(paths=['paths_value']), - ) - -@pytest.mark.asyncio -async def test_update_certificate_flattened_async(): - client = CertificateAuthorityServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.update_certificate), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = resources.Certificate() - - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(resources.Certificate()) - # Call the method with a truthy value for each flattened field, - # using the keyword arguments to the method. - response = await client.update_certificate( - certificate=resources.Certificate(name='name_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] - arg = args[0].certificate - mock_val = resources.Certificate(name='name_value') - assert arg == mock_val - arg = args[0].update_mask - mock_val = field_mask_pb2.FieldMask(paths=['paths_value']) - assert arg == mock_val - -@pytest.mark.asyncio -async def test_update_certificate_flattened_error_async(): - client = CertificateAuthorityServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Attempting to call a method with both a request object and flattened - # fields is an error. - with pytest.raises(ValueError): - await client.update_certificate( - service.UpdateCertificateRequest(), - certificate=resources.Certificate(name='name_value'), - update_mask=field_mask_pb2.FieldMask(paths=['paths_value']), - ) - - -@pytest.mark.parametrize("request_type", [ - service.ActivateCertificateAuthorityRequest, - dict, -]) -def test_activate_certificate_authority(request_type, transport: str = 'grpc'): - client = CertificateAuthorityServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.activate_certificate_authority), - '__call__') 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. - assert isinstance(response, future.Future) - - -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=ga_credentials.AnonymousCredentials(), - transport='grpc', - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.activate_certificate_authority), - '__call__') as call: - client.activate_certificate_authority() - call.assert_called() - _, args, _ = call.mock_calls[0] - assert args[0] == service.ActivateCertificateAuthorityRequest() - -@pytest.mark.asyncio -async def test_activate_certificate_authority_async(transport: str = 'grpc_asyncio', request_type=service.ActivateCertificateAuthorityRequest): - client = CertificateAuthorityServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.activate_certificate_authority), - '__call__') as call: - # Designate an appropriate return value for the call. - 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. - assert isinstance(response, future.Future) - - -@pytest.mark.asyncio -async def test_activate_certificate_authority_async_from_dict(): - await test_activate_certificate_authority_async(request_type=dict) - - -def test_activate_certificate_authority_field_headers(): - client = CertificateAuthorityServiceClient( - 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. - with mock.patch.object( - 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. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ( - 'x-goog-request-params', - 'name=name_value', - ) in kw['metadata'] - - -@pytest.mark.asyncio -async def test_activate_certificate_authority_field_headers_async(): - client = CertificateAuthorityServiceAsyncClient( - 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. - with mock.patch.object( - type(client.transport.activate_certificate_authority), - '__call__') as call: - 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. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ( - 'x-goog-request-params', - 'name=name_value', - ) in kw['metadata'] - - -def test_activate_certificate_authority_flattened(): - client = CertificateAuthorityServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.activate_certificate_authority), - '__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.activate_certificate_authority( - name='name_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] - arg = args[0].name - mock_val = 'name_value' - assert arg == mock_val - - -def test_activate_certificate_authority_flattened_error(): - client = CertificateAuthorityServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Attempting to call a method with both a request object and flattened - # fields is an error. - with pytest.raises(ValueError): - client.activate_certificate_authority( - service.ActivateCertificateAuthorityRequest(), - name='name_value', - ) - -@pytest.mark.asyncio -async def test_activate_certificate_authority_flattened_async(): - client = CertificateAuthorityServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.activate_certificate_authority), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = operations_pb2.Operation(name='operations/op') - - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - operations_pb2.Operation(name='operations/spam') - ) - # Call the method with a truthy value for each flattened field, - # using the keyword arguments to the method. - response = await client.activate_certificate_authority( - name='name_value', - ) - - # Establish that the underlying call was made with the expected - # request object values. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - arg = args[0].name - mock_val = 'name_value' - assert arg == mock_val - -@pytest.mark.asyncio -async def test_activate_certificate_authority_flattened_error_async(): - client = CertificateAuthorityServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Attempting to call a method with both a request object and flattened - # fields is an error. - with pytest.raises(ValueError): - await client.activate_certificate_authority( - service.ActivateCertificateAuthorityRequest(), - name='name_value', - ) - - -@pytest.mark.parametrize("request_type", [ - service.CreateCertificateAuthorityRequest, - dict, -]) -def test_create_certificate_authority(request_type, transport: str = 'grpc'): - client = CertificateAuthorityServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.create_certificate_authority), - '__call__') 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. - assert isinstance(response, future.Future) - - -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=ga_credentials.AnonymousCredentials(), - transport='grpc', - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.create_certificate_authority), - '__call__') as call: - client.create_certificate_authority() - call.assert_called() - _, args, _ = call.mock_calls[0] - assert args[0] == service.CreateCertificateAuthorityRequest() - -@pytest.mark.asyncio -async def test_create_certificate_authority_async(transport: str = 'grpc_asyncio', request_type=service.CreateCertificateAuthorityRequest): - client = CertificateAuthorityServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.create_certificate_authority), - '__call__') as call: - # Designate an appropriate return value for the call. - 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. - assert isinstance(response, future.Future) - - -@pytest.mark.asyncio -async def test_create_certificate_authority_async_from_dict(): - await test_create_certificate_authority_async(request_type=dict) - - -def test_create_certificate_authority_field_headers(): - client = CertificateAuthorityServiceClient( - 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. - with mock.patch.object( - 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. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ( - 'x-goog-request-params', - 'parent=parent_value', - ) in kw['metadata'] - - -@pytest.mark.asyncio -async def test_create_certificate_authority_field_headers_async(): - client = CertificateAuthorityServiceAsyncClient( - 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. - with mock.patch.object( - type(client.transport.create_certificate_authority), - '__call__') as call: - 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. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ( - 'x-goog-request-params', - 'parent=parent_value', - ) in kw['metadata'] - - -def test_create_certificate_authority_flattened(): - client = CertificateAuthorityServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.create_certificate_authority), - '__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_certificate_authority( - parent='parent_value', - certificate_authority=resources.CertificateAuthority(name='name_value'), - certificate_authority_id='certificate_authority_id_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] - arg = args[0].parent - mock_val = 'parent_value' - assert arg == mock_val - arg = args[0].certificate_authority - mock_val = resources.CertificateAuthority(name='name_value') - assert arg == mock_val - arg = args[0].certificate_authority_id - mock_val = 'certificate_authority_id_value' - assert arg == mock_val - - -def test_create_certificate_authority_flattened_error(): - client = CertificateAuthorityServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Attempting to call a method with both a request object and flattened - # fields is an error. - with pytest.raises(ValueError): - client.create_certificate_authority( - service.CreateCertificateAuthorityRequest(), - parent='parent_value', - certificate_authority=resources.CertificateAuthority(name='name_value'), - certificate_authority_id='certificate_authority_id_value', - ) - -@pytest.mark.asyncio -async def test_create_certificate_authority_flattened_async(): - client = CertificateAuthorityServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.create_certificate_authority), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = operations_pb2.Operation(name='operations/op') - - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - operations_pb2.Operation(name='operations/spam') - ) - # Call the method with a truthy value for each flattened field, - # using the keyword arguments to the method. - response = await client.create_certificate_authority( - parent='parent_value', - certificate_authority=resources.CertificateAuthority(name='name_value'), - certificate_authority_id='certificate_authority_id_value', - ) - - # Establish that the underlying call was made with the expected - # request object values. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - arg = args[0].parent - mock_val = 'parent_value' - assert arg == mock_val - arg = args[0].certificate_authority - mock_val = resources.CertificateAuthority(name='name_value') - assert arg == mock_val - arg = args[0].certificate_authority_id - mock_val = 'certificate_authority_id_value' - assert arg == mock_val - -@pytest.mark.asyncio -async def test_create_certificate_authority_flattened_error_async(): - client = CertificateAuthorityServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Attempting to call a method with both a request object and flattened - # fields is an error. - with pytest.raises(ValueError): - await client.create_certificate_authority( - service.CreateCertificateAuthorityRequest(), - parent='parent_value', - certificate_authority=resources.CertificateAuthority(name='name_value'), - certificate_authority_id='certificate_authority_id_value', - ) - - -@pytest.mark.parametrize("request_type", [ - service.DisableCertificateAuthorityRequest, - dict, -]) -def test_disable_certificate_authority(request_type, transport: str = 'grpc'): - client = CertificateAuthorityServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.disable_certificate_authority), - '__call__') 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. - assert isinstance(response, future.Future) - - -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=ga_credentials.AnonymousCredentials(), - transport='grpc', - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.disable_certificate_authority), - '__call__') as call: - client.disable_certificate_authority() - call.assert_called() - _, args, _ = call.mock_calls[0] - assert args[0] == service.DisableCertificateAuthorityRequest() - -@pytest.mark.asyncio -async def test_disable_certificate_authority_async(transport: str = 'grpc_asyncio', request_type=service.DisableCertificateAuthorityRequest): - client = CertificateAuthorityServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.disable_certificate_authority), - '__call__') as call: - # Designate an appropriate return value for the call. - 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. - assert isinstance(response, future.Future) - - -@pytest.mark.asyncio -async def test_disable_certificate_authority_async_from_dict(): - await test_disable_certificate_authority_async(request_type=dict) - - -def test_disable_certificate_authority_field_headers(): - client = CertificateAuthorityServiceClient( - 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. - with mock.patch.object( - 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. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ( - 'x-goog-request-params', - 'name=name_value', - ) in kw['metadata'] - - -@pytest.mark.asyncio -async def test_disable_certificate_authority_field_headers_async(): - client = CertificateAuthorityServiceAsyncClient( - 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. - with mock.patch.object( - type(client.transport.disable_certificate_authority), - '__call__') as call: - 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. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ( - 'x-goog-request-params', - 'name=name_value', - ) in kw['metadata'] - - -def test_disable_certificate_authority_flattened(): - client = CertificateAuthorityServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.disable_certificate_authority), - '__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.disable_certificate_authority( - name='name_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] - arg = args[0].name - mock_val = 'name_value' - assert arg == mock_val - - -def test_disable_certificate_authority_flattened_error(): - client = CertificateAuthorityServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Attempting to call a method with both a request object and flattened - # fields is an error. - with pytest.raises(ValueError): - client.disable_certificate_authority( - service.DisableCertificateAuthorityRequest(), - name='name_value', - ) - -@pytest.mark.asyncio -async def test_disable_certificate_authority_flattened_async(): - client = CertificateAuthorityServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.disable_certificate_authority), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = operations_pb2.Operation(name='operations/op') - - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - operations_pb2.Operation(name='operations/spam') - ) - # Call the method with a truthy value for each flattened field, - # using the keyword arguments to the method. - response = await client.disable_certificate_authority( - name='name_value', - ) - - # Establish that the underlying call was made with the expected - # request object values. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - arg = args[0].name - mock_val = 'name_value' - assert arg == mock_val - -@pytest.mark.asyncio -async def test_disable_certificate_authority_flattened_error_async(): - client = CertificateAuthorityServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Attempting to call a method with both a request object and flattened - # fields is an error. - with pytest.raises(ValueError): - await client.disable_certificate_authority( - service.DisableCertificateAuthorityRequest(), - name='name_value', - ) - - -@pytest.mark.parametrize("request_type", [ - service.EnableCertificateAuthorityRequest, - dict, -]) -def test_enable_certificate_authority(request_type, transport: str = 'grpc'): - client = CertificateAuthorityServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.enable_certificate_authority), - '__call__') 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. - assert isinstance(response, future.Future) - - -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=ga_credentials.AnonymousCredentials(), - transport='grpc', - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.enable_certificate_authority), - '__call__') as call: - client.enable_certificate_authority() - call.assert_called() - _, args, _ = call.mock_calls[0] - assert args[0] == service.EnableCertificateAuthorityRequest() - -@pytest.mark.asyncio -async def test_enable_certificate_authority_async(transport: str = 'grpc_asyncio', request_type=service.EnableCertificateAuthorityRequest): - client = CertificateAuthorityServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.enable_certificate_authority), - '__call__') as call: - # Designate an appropriate return value for the call. - 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. - assert isinstance(response, future.Future) - - -@pytest.mark.asyncio -async def test_enable_certificate_authority_async_from_dict(): - await test_enable_certificate_authority_async(request_type=dict) - - -def test_enable_certificate_authority_field_headers(): - client = CertificateAuthorityServiceClient( - 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. - with mock.patch.object( - 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. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ( - 'x-goog-request-params', - 'name=name_value', - ) in kw['metadata'] - - -@pytest.mark.asyncio -async def test_enable_certificate_authority_field_headers_async(): - client = CertificateAuthorityServiceAsyncClient( - 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. - with mock.patch.object( - type(client.transport.enable_certificate_authority), - '__call__') as call: - 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. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ( - 'x-goog-request-params', - 'name=name_value', - ) in kw['metadata'] - - -def test_enable_certificate_authority_flattened(): - client = CertificateAuthorityServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.enable_certificate_authority), - '__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.enable_certificate_authority( - name='name_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] - arg = args[0].name - mock_val = 'name_value' - assert arg == mock_val - - -def test_enable_certificate_authority_flattened_error(): - client = CertificateAuthorityServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Attempting to call a method with both a request object and flattened - # fields is an error. - with pytest.raises(ValueError): - client.enable_certificate_authority( - service.EnableCertificateAuthorityRequest(), - name='name_value', - ) - -@pytest.mark.asyncio -async def test_enable_certificate_authority_flattened_async(): - client = CertificateAuthorityServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.enable_certificate_authority), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = operations_pb2.Operation(name='operations/op') - - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - operations_pb2.Operation(name='operations/spam') - ) - # Call the method with a truthy value for each flattened field, - # using the keyword arguments to the method. - response = await client.enable_certificate_authority( - name='name_value', - ) - - # Establish that the underlying call was made with the expected - # request object values. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - arg = args[0].name - mock_val = 'name_value' - assert arg == mock_val - -@pytest.mark.asyncio -async def test_enable_certificate_authority_flattened_error_async(): - client = CertificateAuthorityServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Attempting to call a method with both a request object and flattened - # fields is an error. - with pytest.raises(ValueError): - await client.enable_certificate_authority( - service.EnableCertificateAuthorityRequest(), - name='name_value', - ) - - -@pytest.mark.parametrize("request_type", [ - service.FetchCertificateAuthorityCsrRequest, - dict, -]) -def test_fetch_certificate_authority_csr(request_type, transport: str = 'grpc'): - client = CertificateAuthorityServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.fetch_certificate_authority_csr), - '__call__') as call: - # Designate an appropriate return value for the call. - 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' - - -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=ga_credentials.AnonymousCredentials(), - transport='grpc', - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.fetch_certificate_authority_csr), - '__call__') as call: - client.fetch_certificate_authority_csr() - call.assert_called() - _, args, _ = call.mock_calls[0] - assert args[0] == service.FetchCertificateAuthorityCsrRequest() - -@pytest.mark.asyncio -async def test_fetch_certificate_authority_csr_async(transport: str = 'grpc_asyncio', request_type=service.FetchCertificateAuthorityCsrRequest): - client = CertificateAuthorityServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.fetch_certificate_authority_csr), - '__call__') as call: - # Designate an appropriate return value for the call. - 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' - - -@pytest.mark.asyncio -async def test_fetch_certificate_authority_csr_async_from_dict(): - await test_fetch_certificate_authority_csr_async(request_type=dict) - - -def test_fetch_certificate_authority_csr_field_headers(): - client = CertificateAuthorityServiceClient( - 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. - with mock.patch.object( - 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. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ( - 'x-goog-request-params', - 'name=name_value', - ) in kw['metadata'] - - -@pytest.mark.asyncio -async def test_fetch_certificate_authority_csr_field_headers_async(): - client = CertificateAuthorityServiceAsyncClient( - 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. - with mock.patch.object( - type(client.transport.fetch_certificate_authority_csr), - '__call__') as call: - 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. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ( - 'x-goog-request-params', - 'name=name_value', - ) in kw['metadata'] - - -def test_fetch_certificate_authority_csr_flattened(): - client = CertificateAuthorityServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.fetch_certificate_authority_csr), - '__call__') 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', - ) - - # Establish that the underlying call was made with the expected - # request object values. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - arg = args[0].name - mock_val = 'name_value' - assert arg == mock_val - - -def test_fetch_certificate_authority_csr_flattened_error(): - client = CertificateAuthorityServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Attempting to call a method with both a request object and flattened - # fields is an error. - with pytest.raises(ValueError): - client.fetch_certificate_authority_csr( - service.FetchCertificateAuthorityCsrRequest(), - name='name_value', - ) - -@pytest.mark.asyncio -async def test_fetch_certificate_authority_csr_flattened_async(): - client = CertificateAuthorityServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.fetch_certificate_authority_csr), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = service.FetchCertificateAuthorityCsrResponse() - - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(service.FetchCertificateAuthorityCsrResponse()) - # Call the method with a truthy value for each flattened field, - # using the keyword arguments to the method. - response = await client.fetch_certificate_authority_csr( - name='name_value', - ) - - # Establish that the underlying call was made with the expected - # request object values. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - arg = args[0].name - mock_val = 'name_value' - assert arg == mock_val - -@pytest.mark.asyncio -async def test_fetch_certificate_authority_csr_flattened_error_async(): - client = CertificateAuthorityServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Attempting to call a method with both a request object and flattened - # fields is an error. - with pytest.raises(ValueError): - await client.fetch_certificate_authority_csr( - service.FetchCertificateAuthorityCsrRequest(), - name='name_value', - ) - - -@pytest.mark.parametrize("request_type", [ - service.GetCertificateAuthorityRequest, - dict, -]) -def test_get_certificate_authority(request_type, transport: str = 'grpc'): - client = CertificateAuthorityServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.get_certificate_authority), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = resources.CertificateAuthority( - name='name_value', - type_=resources.CertificateAuthority.Type.SELF_SIGNED, - tier=resources.CertificateAuthority.Tier.ENTERPRISE, - state=resources.CertificateAuthority.State.ENABLED, - 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' - - -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=ga_credentials.AnonymousCredentials(), - transport='grpc', - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.get_certificate_authority), - '__call__') as call: - client.get_certificate_authority() - call.assert_called() - _, args, _ = call.mock_calls[0] - assert args[0] == service.GetCertificateAuthorityRequest() - -@pytest.mark.asyncio -async def test_get_certificate_authority_async(transport: str = 'grpc_asyncio', request_type=service.GetCertificateAuthorityRequest): - client = CertificateAuthorityServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.get_certificate_authority), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(resources.CertificateAuthority( - name='name_value', - type_=resources.CertificateAuthority.Type.SELF_SIGNED, - tier=resources.CertificateAuthority.Tier.ENTERPRISE, - state=resources.CertificateAuthority.State.ENABLED, - pem_ca_certificates=['pem_ca_certificates_value'], - 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' - - -@pytest.mark.asyncio -async def test_get_certificate_authority_async_from_dict(): - await test_get_certificate_authority_async(request_type=dict) - - -def test_get_certificate_authority_field_headers(): - client = CertificateAuthorityServiceClient( - 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. - with mock.patch.object( - 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. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ( - 'x-goog-request-params', - 'name=name_value', - ) in kw['metadata'] - - -@pytest.mark.asyncio -async def test_get_certificate_authority_field_headers_async(): - client = CertificateAuthorityServiceAsyncClient( - 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. - with mock.patch.object( - type(client.transport.get_certificate_authority), - '__call__') as call: - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(resources.CertificateAuthority()) - 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] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ( - 'x-goog-request-params', - 'name=name_value', - ) in kw['metadata'] - - -def test_get_certificate_authority_flattened(): - client = CertificateAuthorityServiceClient( - 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_authority), - '__call__') 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', - ) - - # Establish that the underlying call was made with the expected - # request object values. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - arg = args[0].name - mock_val = 'name_value' - assert arg == mock_val - - -def test_get_certificate_authority_flattened_error(): - client = CertificateAuthorityServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Attempting to call a method with both a request object and flattened - # fields is an error. - with pytest.raises(ValueError): - client.get_certificate_authority( - service.GetCertificateAuthorityRequest(), - name='name_value', - ) - -@pytest.mark.asyncio -async def test_get_certificate_authority_flattened_async(): - client = CertificateAuthorityServiceAsyncClient( - 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_authority), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = resources.CertificateAuthority() - - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(resources.CertificateAuthority()) - # Call the method with a truthy value for each flattened field, - # using the keyword arguments to the method. - response = await client.get_certificate_authority( - name='name_value', - ) - - # Establish that the underlying call was made with the expected - # request object values. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - arg = args[0].name - mock_val = 'name_value' - assert arg == mock_val - -@pytest.mark.asyncio -async def test_get_certificate_authority_flattened_error_async(): - client = CertificateAuthorityServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Attempting to call a method with both a request object and flattened - # fields is an error. - with pytest.raises(ValueError): - await client.get_certificate_authority( - service.GetCertificateAuthorityRequest(), - name='name_value', - ) - - -@pytest.mark.parametrize("request_type", [ - service.ListCertificateAuthoritiesRequest, - dict, -]) -def test_list_certificate_authorities(request_type, transport: str = 'grpc'): - client = CertificateAuthorityServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_certificate_authorities), - '__call__') as call: - # Designate an appropriate return value for the call. - 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'] - - -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=ga_credentials.AnonymousCredentials(), - transport='grpc', - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_certificate_authorities), - '__call__') as call: - client.list_certificate_authorities() - call.assert_called() - _, args, _ = call.mock_calls[0] - assert args[0] == service.ListCertificateAuthoritiesRequest() - -@pytest.mark.asyncio -async def test_list_certificate_authorities_async(transport: str = 'grpc_asyncio', request_type=service.ListCertificateAuthoritiesRequest): - client = CertificateAuthorityServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_certificate_authorities), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(service.ListCertificateAuthoritiesResponse( - next_page_token='next_page_token_value', - 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'] - - -@pytest.mark.asyncio -async def test_list_certificate_authorities_async_from_dict(): - await test_list_certificate_authorities_async(request_type=dict) - - -def test_list_certificate_authorities_field_headers(): - client = CertificateAuthorityServiceClient( - 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. - with mock.patch.object( - 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. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ( - 'x-goog-request-params', - 'parent=parent_value', - ) in kw['metadata'] - - -@pytest.mark.asyncio -async def test_list_certificate_authorities_field_headers_async(): - client = CertificateAuthorityServiceAsyncClient( - 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. - with mock.patch.object( - type(client.transport.list_certificate_authorities), - '__call__') as call: - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(service.ListCertificateAuthoritiesResponse()) - 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] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ( - 'x-goog-request-params', - 'parent=parent_value', - ) in kw['metadata'] - - -def test_list_certificate_authorities_flattened(): - client = CertificateAuthorityServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_certificate_authorities), - '__call__') 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', - ) - - # Establish that the underlying call was made with the expected - # request object values. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - arg = args[0].parent - mock_val = 'parent_value' - assert arg == mock_val - - -def test_list_certificate_authorities_flattened_error(): - client = CertificateAuthorityServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Attempting to call a method with both a request object and flattened - # fields is an error. - with pytest.raises(ValueError): - client.list_certificate_authorities( - service.ListCertificateAuthoritiesRequest(), - parent='parent_value', - ) - -@pytest.mark.asyncio -async def test_list_certificate_authorities_flattened_async(): - client = CertificateAuthorityServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_certificate_authorities), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = service.ListCertificateAuthoritiesResponse() - - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(service.ListCertificateAuthoritiesResponse()) - # Call the method with a truthy value for each flattened field, - # using the keyword arguments to the method. - response = await client.list_certificate_authorities( - parent='parent_value', - ) - - # Establish that the underlying call was made with the expected - # request object values. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - arg = args[0].parent - mock_val = 'parent_value' - assert arg == mock_val - -@pytest.mark.asyncio -async def test_list_certificate_authorities_flattened_error_async(): - client = CertificateAuthorityServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Attempting to call a method with both a request object and flattened - # fields is an error. - with pytest.raises(ValueError): - await client.list_certificate_authorities( - service.ListCertificateAuthoritiesRequest(), - parent='parent_value', - ) - - -def test_list_certificate_authorities_pager(transport_name: str = "grpc"): - client = CertificateAuthorityServiceClient( - credentials=ga_credentials.AnonymousCredentials, - transport=transport_name, - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_certificate_authorities), - '__call__') as call: - # Set the response to a series of pages. - call.side_effect = ( - service.ListCertificateAuthoritiesResponse( - certificate_authorities=[ - resources.CertificateAuthority(), - resources.CertificateAuthority(), - resources.CertificateAuthority(), - ], - next_page_token='abc', - ), - service.ListCertificateAuthoritiesResponse( - certificate_authorities=[], - next_page_token='def', - ), - service.ListCertificateAuthoritiesResponse( - certificate_authorities=[ - resources.CertificateAuthority(), - ], - next_page_token='ghi', - ), - service.ListCertificateAuthoritiesResponse( - certificate_authorities=[ - resources.CertificateAuthority(), - resources.CertificateAuthority(), - ], - ), - RuntimeError, - ) - - metadata = () - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata(( - ('parent', ''), - )), - ) - pager = client.list_certificate_authorities(request={}) - - assert pager._metadata == metadata - - results = list(pager) - assert len(results) == 6 - assert all(isinstance(i, resources.CertificateAuthority) - for i in results) -def test_list_certificate_authorities_pages(transport_name: str = "grpc"): - client = CertificateAuthorityServiceClient( - credentials=ga_credentials.AnonymousCredentials, - transport=transport_name, - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_certificate_authorities), - '__call__') as call: - # Set the response to a series of pages. - call.side_effect = ( - service.ListCertificateAuthoritiesResponse( - certificate_authorities=[ - resources.CertificateAuthority(), - resources.CertificateAuthority(), - resources.CertificateAuthority(), - ], - next_page_token='abc', - ), - service.ListCertificateAuthoritiesResponse( - certificate_authorities=[], - next_page_token='def', - ), - service.ListCertificateAuthoritiesResponse( - certificate_authorities=[ - resources.CertificateAuthority(), - ], - next_page_token='ghi', - ), - service.ListCertificateAuthoritiesResponse( - certificate_authorities=[ - resources.CertificateAuthority(), - resources.CertificateAuthority(), - ], - ), - RuntimeError, - ) - pages = list(client.list_certificate_authorities(request={}).pages) - for page_, token in zip(pages, ['abc','def','ghi', '']): - assert page_.raw_page.next_page_token == token - -@pytest.mark.asyncio -async def test_list_certificate_authorities_async_pager(): - client = CertificateAuthorityServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials, - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_certificate_authorities), - '__call__', new_callable=mock.AsyncMock) as call: - # Set the response to a series of pages. - call.side_effect = ( - service.ListCertificateAuthoritiesResponse( - certificate_authorities=[ - resources.CertificateAuthority(), - resources.CertificateAuthority(), - resources.CertificateAuthority(), - ], - next_page_token='abc', - ), - service.ListCertificateAuthoritiesResponse( - certificate_authorities=[], - next_page_token='def', - ), - service.ListCertificateAuthoritiesResponse( - certificate_authorities=[ - resources.CertificateAuthority(), - ], - next_page_token='ghi', - ), - service.ListCertificateAuthoritiesResponse( - certificate_authorities=[ - resources.CertificateAuthority(), - resources.CertificateAuthority(), - ], - ), - RuntimeError, - ) - async_pager = await client.list_certificate_authorities(request={},) - assert async_pager.next_page_token == 'abc' - responses = [] - async for response in async_pager: # pragma: no branch - responses.append(response) - - assert len(responses) == 6 - assert all(isinstance(i, resources.CertificateAuthority) - for i in responses) - - -@pytest.mark.asyncio -async def test_list_certificate_authorities_async_pages(): - client = CertificateAuthorityServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials, - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_certificate_authorities), - '__call__', new_callable=mock.AsyncMock) as call: - # Set the response to a series of pages. - call.side_effect = ( - service.ListCertificateAuthoritiesResponse( - certificate_authorities=[ - resources.CertificateAuthority(), - resources.CertificateAuthority(), - resources.CertificateAuthority(), - ], - next_page_token='abc', - ), - service.ListCertificateAuthoritiesResponse( - certificate_authorities=[], - next_page_token='def', - ), - service.ListCertificateAuthoritiesResponse( - certificate_authorities=[ - resources.CertificateAuthority(), - ], - next_page_token='ghi', - ), - service.ListCertificateAuthoritiesResponse( - certificate_authorities=[ - resources.CertificateAuthority(), - resources.CertificateAuthority(), - ], - ), - RuntimeError, - ) - pages = [] - async for page_ in (await client.list_certificate_authorities(request={})).pages: # pragma: no branch - pages.append(page_) - for page_, token in zip(pages, ['abc','def','ghi', '']): - assert page_.raw_page.next_page_token == token - -@pytest.mark.parametrize("request_type", [ - service.RestoreCertificateAuthorityRequest, - dict, -]) -def test_restore_certificate_authority(request_type, transport: str = 'grpc'): - client = CertificateAuthorityServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.restore_certificate_authority), - '__call__') 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. - assert isinstance(response, future.Future) - - -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=ga_credentials.AnonymousCredentials(), - transport='grpc', - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.restore_certificate_authority), - '__call__') as call: - client.restore_certificate_authority() - call.assert_called() - _, args, _ = call.mock_calls[0] - assert args[0] == service.RestoreCertificateAuthorityRequest() - -@pytest.mark.asyncio -async def test_restore_certificate_authority_async(transport: str = 'grpc_asyncio', request_type=service.RestoreCertificateAuthorityRequest): - client = CertificateAuthorityServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.restore_certificate_authority), - '__call__') as call: - # Designate an appropriate return value for the call. - 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. - assert isinstance(response, future.Future) - - -@pytest.mark.asyncio -async def test_restore_certificate_authority_async_from_dict(): - await test_restore_certificate_authority_async(request_type=dict) - - -def test_restore_certificate_authority_field_headers(): - client = CertificateAuthorityServiceClient( - 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. - with mock.patch.object( - 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. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ( - 'x-goog-request-params', - 'name=name_value', - ) in kw['metadata'] - - -@pytest.mark.asyncio -async def test_restore_certificate_authority_field_headers_async(): - client = CertificateAuthorityServiceAsyncClient( - 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. - with mock.patch.object( - type(client.transport.restore_certificate_authority), - '__call__') as call: - 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. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ( - 'x-goog-request-params', - 'name=name_value', - ) in kw['metadata'] - - -def test_restore_certificate_authority_flattened(): - client = CertificateAuthorityServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.restore_certificate_authority), - '__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.restore_certificate_authority( - name='name_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] - arg = args[0].name - mock_val = 'name_value' - assert arg == mock_val - - -def test_restore_certificate_authority_flattened_error(): - client = CertificateAuthorityServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Attempting to call a method with both a request object and flattened - # fields is an error. - with pytest.raises(ValueError): - client.restore_certificate_authority( - service.RestoreCertificateAuthorityRequest(), - name='name_value', - ) - -@pytest.mark.asyncio -async def test_restore_certificate_authority_flattened_async(): - client = CertificateAuthorityServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.restore_certificate_authority), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = operations_pb2.Operation(name='operations/op') - - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - operations_pb2.Operation(name='operations/spam') - ) - # Call the method with a truthy value for each flattened field, - # using the keyword arguments to the method. - response = await client.restore_certificate_authority( - name='name_value', - ) - - # Establish that the underlying call was made with the expected - # request object values. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - arg = args[0].name - mock_val = 'name_value' - assert arg == mock_val - -@pytest.mark.asyncio -async def test_restore_certificate_authority_flattened_error_async(): - client = CertificateAuthorityServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Attempting to call a method with both a request object and flattened - # fields is an error. - with pytest.raises(ValueError): - await client.restore_certificate_authority( - service.RestoreCertificateAuthorityRequest(), - name='name_value', - ) - - -@pytest.mark.parametrize("request_type", [ - service.ScheduleDeleteCertificateAuthorityRequest, - dict, -]) -def test_schedule_delete_certificate_authority(request_type, transport: str = 'grpc'): - client = CertificateAuthorityServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.schedule_delete_certificate_authority), - '__call__') 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. - assert isinstance(response, future.Future) - - -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=ga_credentials.AnonymousCredentials(), - transport='grpc', - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.schedule_delete_certificate_authority), - '__call__') as call: - client.schedule_delete_certificate_authority() - call.assert_called() - _, args, _ = call.mock_calls[0] - assert args[0] == service.ScheduleDeleteCertificateAuthorityRequest() - -@pytest.mark.asyncio -async def test_schedule_delete_certificate_authority_async(transport: str = 'grpc_asyncio', request_type=service.ScheduleDeleteCertificateAuthorityRequest): - client = CertificateAuthorityServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.schedule_delete_certificate_authority), - '__call__') as call: - # Designate an appropriate return value for the call. - 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. - assert isinstance(response, future.Future) - - -@pytest.mark.asyncio -async def test_schedule_delete_certificate_authority_async_from_dict(): - await test_schedule_delete_certificate_authority_async(request_type=dict) - - -def test_schedule_delete_certificate_authority_field_headers(): - client = CertificateAuthorityServiceClient( - 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. - with mock.patch.object( - 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. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ( - 'x-goog-request-params', - 'name=name_value', - ) in kw['metadata'] - - -@pytest.mark.asyncio -async def test_schedule_delete_certificate_authority_field_headers_async(): - client = CertificateAuthorityServiceAsyncClient( - 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. - with mock.patch.object( - type(client.transport.schedule_delete_certificate_authority), - '__call__') as call: - 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. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ( - 'x-goog-request-params', - 'name=name_value', - ) in kw['metadata'] - - -def test_schedule_delete_certificate_authority_flattened(): - client = CertificateAuthorityServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.schedule_delete_certificate_authority), - '__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.schedule_delete_certificate_authority( - name='name_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] - arg = args[0].name - mock_val = 'name_value' - assert arg == mock_val - - -def test_schedule_delete_certificate_authority_flattened_error(): - client = CertificateAuthorityServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Attempting to call a method with both a request object and flattened - # fields is an error. - with pytest.raises(ValueError): - client.schedule_delete_certificate_authority( - service.ScheduleDeleteCertificateAuthorityRequest(), - name='name_value', - ) - -@pytest.mark.asyncio -async def test_schedule_delete_certificate_authority_flattened_async(): - client = CertificateAuthorityServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.schedule_delete_certificate_authority), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = operations_pb2.Operation(name='operations/op') - - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - operations_pb2.Operation(name='operations/spam') - ) - # Call the method with a truthy value for each flattened field, - # using the keyword arguments to the method. - response = await client.schedule_delete_certificate_authority( - name='name_value', - ) - - # Establish that the underlying call was made with the expected - # request object values. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - arg = args[0].name - mock_val = 'name_value' - assert arg == mock_val - -@pytest.mark.asyncio -async def test_schedule_delete_certificate_authority_flattened_error_async(): - client = CertificateAuthorityServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Attempting to call a method with both a request object and flattened - # fields is an error. - with pytest.raises(ValueError): - await client.schedule_delete_certificate_authority( - service.ScheduleDeleteCertificateAuthorityRequest(), - name='name_value', - ) - - -@pytest.mark.parametrize("request_type", [ - service.UpdateCertificateAuthorityRequest, - dict, -]) -def test_update_certificate_authority(request_type, transport: str = 'grpc'): - client = CertificateAuthorityServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.update_certificate_authority), - '__call__') 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. - assert isinstance(response, future.Future) - - -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=ga_credentials.AnonymousCredentials(), - transport='grpc', - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.update_certificate_authority), - '__call__') as call: - client.update_certificate_authority() - call.assert_called() - _, args, _ = call.mock_calls[0] - assert args[0] == service.UpdateCertificateAuthorityRequest() - -@pytest.mark.asyncio -async def test_update_certificate_authority_async(transport: str = 'grpc_asyncio', request_type=service.UpdateCertificateAuthorityRequest): - client = CertificateAuthorityServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.update_certificate_authority), - '__call__') as call: - # Designate an appropriate return value for the call. - 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. - assert isinstance(response, future.Future) - - -@pytest.mark.asyncio -async def test_update_certificate_authority_async_from_dict(): - await test_update_certificate_authority_async(request_type=dict) - - -def test_update_certificate_authority_field_headers(): - client = CertificateAuthorityServiceClient( - 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 = 'name_value' - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - 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. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ( - 'x-goog-request-params', - 'certificate_authority.name=name_value', - ) in kw['metadata'] - - -@pytest.mark.asyncio -async def test_update_certificate_authority_field_headers_async(): - client = CertificateAuthorityServiceAsyncClient( - 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 = 'name_value' - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.update_certificate_authority), - '__call__') as call: - 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. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ( - 'x-goog-request-params', - 'certificate_authority.name=name_value', - ) in kw['metadata'] - - -def test_update_certificate_authority_flattened(): - client = CertificateAuthorityServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.update_certificate_authority), - '__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_certificate_authority( - certificate_authority=resources.CertificateAuthority(name='name_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] - arg = args[0].certificate_authority - mock_val = resources.CertificateAuthority(name='name_value') - assert arg == mock_val - arg = args[0].update_mask - mock_val = field_mask_pb2.FieldMask(paths=['paths_value']) - assert arg == mock_val - - -def test_update_certificate_authority_flattened_error(): - client = CertificateAuthorityServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Attempting to call a method with both a request object and flattened - # fields is an error. - with pytest.raises(ValueError): - client.update_certificate_authority( - service.UpdateCertificateAuthorityRequest(), - certificate_authority=resources.CertificateAuthority(name='name_value'), - update_mask=field_mask_pb2.FieldMask(paths=['paths_value']), - ) - -@pytest.mark.asyncio -async def test_update_certificate_authority_flattened_async(): - client = CertificateAuthorityServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.update_certificate_authority), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = operations_pb2.Operation(name='operations/op') - - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - operations_pb2.Operation(name='operations/spam') - ) - # Call the method with a truthy value for each flattened field, - # using the keyword arguments to the method. - response = await client.update_certificate_authority( - certificate_authority=resources.CertificateAuthority(name='name_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] - arg = args[0].certificate_authority - mock_val = resources.CertificateAuthority(name='name_value') - assert arg == mock_val - arg = args[0].update_mask - mock_val = field_mask_pb2.FieldMask(paths=['paths_value']) - assert arg == mock_val - -@pytest.mark.asyncio -async def test_update_certificate_authority_flattened_error_async(): - client = CertificateAuthorityServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Attempting to call a method with both a request object and flattened - # fields is an error. - with pytest.raises(ValueError): - await client.update_certificate_authority( - service.UpdateCertificateAuthorityRequest(), - certificate_authority=resources.CertificateAuthority(name='name_value'), - update_mask=field_mask_pb2.FieldMask(paths=['paths_value']), - ) - - -@pytest.mark.parametrize("request_type", [ - service.GetCertificateRevocationListRequest, - dict, -]) -def test_get_certificate_revocation_list(request_type, transport: str = 'grpc'): - client = CertificateAuthorityServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.get_certificate_revocation_list), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = resources.CertificateRevocationList( - name='name_value', - sequence_number=1601, - pem_crl='pem_crl_value', - 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 - - -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=ga_credentials.AnonymousCredentials(), - transport='grpc', - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.get_certificate_revocation_list), - '__call__') as call: - client.get_certificate_revocation_list() - call.assert_called() - _, args, _ = call.mock_calls[0] - assert args[0] == service.GetCertificateRevocationListRequest() - -@pytest.mark.asyncio -async def test_get_certificate_revocation_list_async(transport: str = 'grpc_asyncio', request_type=service.GetCertificateRevocationListRequest): - client = CertificateAuthorityServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.get_certificate_revocation_list), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(resources.CertificateRevocationList( - name='name_value', - sequence_number=1601, - pem_crl='pem_crl_value', - access_url='access_url_value', - 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 - - -@pytest.mark.asyncio -async def test_get_certificate_revocation_list_async_from_dict(): - await test_get_certificate_revocation_list_async(request_type=dict) - - -def test_get_certificate_revocation_list_field_headers(): - client = CertificateAuthorityServiceClient( - 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. - with mock.patch.object( - 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. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ( - 'x-goog-request-params', - 'name=name_value', - ) in kw['metadata'] - - -@pytest.mark.asyncio -async def test_get_certificate_revocation_list_field_headers_async(): - client = CertificateAuthorityServiceAsyncClient( - 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. - with mock.patch.object( - type(client.transport.get_certificate_revocation_list), - '__call__') as call: - 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. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ( - 'x-goog-request-params', - 'name=name_value', - ) in kw['metadata'] - - -def test_get_certificate_revocation_list_flattened(): - client = CertificateAuthorityServiceClient( - 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_revocation_list), - '__call__') 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', - ) - - # Establish that the underlying call was made with the expected - # request object values. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - arg = args[0].name - mock_val = 'name_value' - assert arg == mock_val - - -def test_get_certificate_revocation_list_flattened_error(): - client = CertificateAuthorityServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Attempting to call a method with both a request object and flattened - # fields is an error. - with pytest.raises(ValueError): - client.get_certificate_revocation_list( - service.GetCertificateRevocationListRequest(), - name='name_value', - ) - -@pytest.mark.asyncio -async def test_get_certificate_revocation_list_flattened_async(): - client = CertificateAuthorityServiceAsyncClient( - 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_revocation_list), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = resources.CertificateRevocationList() - - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(resources.CertificateRevocationList()) - # Call the method with a truthy value for each flattened field, - # using the keyword arguments to the method. - response = await client.get_certificate_revocation_list( - name='name_value', - ) - - # Establish that the underlying call was made with the expected - # request object values. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - arg = args[0].name - mock_val = 'name_value' - assert arg == mock_val - -@pytest.mark.asyncio -async def test_get_certificate_revocation_list_flattened_error_async(): - client = CertificateAuthorityServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Attempting to call a method with both a request object and flattened - # fields is an error. - with pytest.raises(ValueError): - await client.get_certificate_revocation_list( - service.GetCertificateRevocationListRequest(), - name='name_value', - ) - - -@pytest.mark.parametrize("request_type", [ - service.ListCertificateRevocationListsRequest, - dict, -]) -def test_list_certificate_revocation_lists(request_type, transport: str = 'grpc'): - client = CertificateAuthorityServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_certificate_revocation_lists), - '__call__') as call: - # Designate an appropriate return value for the call. - 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'] - - -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=ga_credentials.AnonymousCredentials(), - transport='grpc', - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_certificate_revocation_lists), - '__call__') as call: - client.list_certificate_revocation_lists() - call.assert_called() - _, args, _ = call.mock_calls[0] - assert args[0] == service.ListCertificateRevocationListsRequest() - -@pytest.mark.asyncio -async def test_list_certificate_revocation_lists_async(transport: str = 'grpc_asyncio', request_type=service.ListCertificateRevocationListsRequest): - client = CertificateAuthorityServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_certificate_revocation_lists), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(service.ListCertificateRevocationListsResponse( - next_page_token='next_page_token_value', - 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'] - - -@pytest.mark.asyncio -async def test_list_certificate_revocation_lists_async_from_dict(): - await test_list_certificate_revocation_lists_async(request_type=dict) - - -def test_list_certificate_revocation_lists_field_headers(): - client = CertificateAuthorityServiceClient( - 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. - with mock.patch.object( - 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. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ( - 'x-goog-request-params', - 'parent=parent_value', - ) in kw['metadata'] - - -@pytest.mark.asyncio -async def test_list_certificate_revocation_lists_field_headers_async(): - client = CertificateAuthorityServiceAsyncClient( - 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. - with mock.patch.object( - type(client.transport.list_certificate_revocation_lists), - '__call__') as call: - 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. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ( - 'x-goog-request-params', - 'parent=parent_value', - ) in kw['metadata'] - - -def test_list_certificate_revocation_lists_flattened(): - client = CertificateAuthorityServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_certificate_revocation_lists), - '__call__') 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', - ) - - # Establish that the underlying call was made with the expected - # request object values. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - arg = args[0].parent - mock_val = 'parent_value' - assert arg == mock_val - - -def test_list_certificate_revocation_lists_flattened_error(): - client = CertificateAuthorityServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Attempting to call a method with both a request object and flattened - # fields is an error. - with pytest.raises(ValueError): - client.list_certificate_revocation_lists( - service.ListCertificateRevocationListsRequest(), - parent='parent_value', - ) - -@pytest.mark.asyncio -async def test_list_certificate_revocation_lists_flattened_async(): - client = CertificateAuthorityServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_certificate_revocation_lists), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = service.ListCertificateRevocationListsResponse() - - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(service.ListCertificateRevocationListsResponse()) - # Call the method with a truthy value for each flattened field, - # using the keyword arguments to the method. - response = await client.list_certificate_revocation_lists( - parent='parent_value', - ) - - # Establish that the underlying call was made with the expected - # request object values. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - arg = args[0].parent - mock_val = 'parent_value' - assert arg == mock_val - -@pytest.mark.asyncio -async def test_list_certificate_revocation_lists_flattened_error_async(): - client = CertificateAuthorityServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Attempting to call a method with both a request object and flattened - # fields is an error. - with pytest.raises(ValueError): - await client.list_certificate_revocation_lists( - service.ListCertificateRevocationListsRequest(), - parent='parent_value', - ) - - -def test_list_certificate_revocation_lists_pager(transport_name: str = "grpc"): - client = CertificateAuthorityServiceClient( - credentials=ga_credentials.AnonymousCredentials, - transport=transport_name, - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_certificate_revocation_lists), - '__call__') as call: - # Set the response to a series of pages. - call.side_effect = ( - service.ListCertificateRevocationListsResponse( - certificate_revocation_lists=[ - resources.CertificateRevocationList(), - resources.CertificateRevocationList(), - resources.CertificateRevocationList(), - ], - next_page_token='abc', - ), - service.ListCertificateRevocationListsResponse( - certificate_revocation_lists=[], - next_page_token='def', - ), - service.ListCertificateRevocationListsResponse( - certificate_revocation_lists=[ - resources.CertificateRevocationList(), - ], - next_page_token='ghi', - ), - service.ListCertificateRevocationListsResponse( - certificate_revocation_lists=[ - resources.CertificateRevocationList(), - resources.CertificateRevocationList(), - ], - ), - RuntimeError, - ) - - metadata = () - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata(( - ('parent', ''), - )), - ) - pager = client.list_certificate_revocation_lists(request={}) - - assert pager._metadata == metadata - - results = list(pager) - assert len(results) == 6 - assert all(isinstance(i, resources.CertificateRevocationList) - for i in results) -def test_list_certificate_revocation_lists_pages(transport_name: str = "grpc"): - client = CertificateAuthorityServiceClient( - credentials=ga_credentials.AnonymousCredentials, - transport=transport_name, - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_certificate_revocation_lists), - '__call__') as call: - # Set the response to a series of pages. - call.side_effect = ( - service.ListCertificateRevocationListsResponse( - certificate_revocation_lists=[ - resources.CertificateRevocationList(), - resources.CertificateRevocationList(), - resources.CertificateRevocationList(), - ], - next_page_token='abc', - ), - service.ListCertificateRevocationListsResponse( - certificate_revocation_lists=[], - next_page_token='def', - ), - service.ListCertificateRevocationListsResponse( - certificate_revocation_lists=[ - resources.CertificateRevocationList(), - ], - next_page_token='ghi', - ), - service.ListCertificateRevocationListsResponse( - certificate_revocation_lists=[ - resources.CertificateRevocationList(), - resources.CertificateRevocationList(), - ], - ), - RuntimeError, - ) - pages = list(client.list_certificate_revocation_lists(request={}).pages) - for page_, token in zip(pages, ['abc','def','ghi', '']): - assert page_.raw_page.next_page_token == token - -@pytest.mark.asyncio -async def test_list_certificate_revocation_lists_async_pager(): - client = CertificateAuthorityServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials, - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_certificate_revocation_lists), - '__call__', new_callable=mock.AsyncMock) as call: - # Set the response to a series of pages. - call.side_effect = ( - service.ListCertificateRevocationListsResponse( - certificate_revocation_lists=[ - resources.CertificateRevocationList(), - resources.CertificateRevocationList(), - resources.CertificateRevocationList(), - ], - next_page_token='abc', - ), - service.ListCertificateRevocationListsResponse( - certificate_revocation_lists=[], - next_page_token='def', - ), - service.ListCertificateRevocationListsResponse( - certificate_revocation_lists=[ - resources.CertificateRevocationList(), - ], - next_page_token='ghi', - ), - service.ListCertificateRevocationListsResponse( - certificate_revocation_lists=[ - resources.CertificateRevocationList(), - resources.CertificateRevocationList(), - ], - ), - RuntimeError, - ) - async_pager = await client.list_certificate_revocation_lists(request={},) - assert async_pager.next_page_token == 'abc' - responses = [] - async for response in async_pager: # pragma: no branch - responses.append(response) - - assert len(responses) == 6 - assert all(isinstance(i, resources.CertificateRevocationList) - for i in responses) - - -@pytest.mark.asyncio -async def test_list_certificate_revocation_lists_async_pages(): - client = CertificateAuthorityServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials, - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_certificate_revocation_lists), - '__call__', new_callable=mock.AsyncMock) as call: - # Set the response to a series of pages. - call.side_effect = ( - service.ListCertificateRevocationListsResponse( - certificate_revocation_lists=[ - resources.CertificateRevocationList(), - resources.CertificateRevocationList(), - resources.CertificateRevocationList(), - ], - next_page_token='abc', - ), - service.ListCertificateRevocationListsResponse( - certificate_revocation_lists=[], - next_page_token='def', - ), - service.ListCertificateRevocationListsResponse( - certificate_revocation_lists=[ - resources.CertificateRevocationList(), - ], - next_page_token='ghi', - ), - service.ListCertificateRevocationListsResponse( - certificate_revocation_lists=[ - resources.CertificateRevocationList(), - resources.CertificateRevocationList(), - ], - ), - RuntimeError, - ) - pages = [] - async for page_ in (await client.list_certificate_revocation_lists(request={})).pages: # pragma: no branch - pages.append(page_) - for page_, token in zip(pages, ['abc','def','ghi', '']): - assert page_.raw_page.next_page_token == token - -@pytest.mark.parametrize("request_type", [ - service.UpdateCertificateRevocationListRequest, - dict, -]) -def test_update_certificate_revocation_list(request_type, transport: str = 'grpc'): - client = CertificateAuthorityServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.update_certificate_revocation_list), - '__call__') 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. - assert isinstance(response, future.Future) - - -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=ga_credentials.AnonymousCredentials(), - transport='grpc', - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.update_certificate_revocation_list), - '__call__') as call: - client.update_certificate_revocation_list() - call.assert_called() - _, args, _ = call.mock_calls[0] - assert args[0] == service.UpdateCertificateRevocationListRequest() - -@pytest.mark.asyncio -async def test_update_certificate_revocation_list_async(transport: str = 'grpc_asyncio', request_type=service.UpdateCertificateRevocationListRequest): - client = CertificateAuthorityServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.update_certificate_revocation_list), - '__call__') as call: - # Designate an appropriate return value for the call. - 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. - assert isinstance(response, future.Future) - - -@pytest.mark.asyncio -async def test_update_certificate_revocation_list_async_from_dict(): - await test_update_certificate_revocation_list_async(request_type=dict) - - -def test_update_certificate_revocation_list_field_headers(): - client = CertificateAuthorityServiceClient( - 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 = 'name_value' - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - 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. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ( - 'x-goog-request-params', - 'certificate_revocation_list.name=name_value', - ) in kw['metadata'] - - -@pytest.mark.asyncio -async def test_update_certificate_revocation_list_field_headers_async(): - client = CertificateAuthorityServiceAsyncClient( - 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 = 'name_value' - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.update_certificate_revocation_list), - '__call__') as call: - 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. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ( - 'x-goog-request-params', - 'certificate_revocation_list.name=name_value', - ) in kw['metadata'] - - -def test_update_certificate_revocation_list_flattened(): - client = CertificateAuthorityServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.update_certificate_revocation_list), - '__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_certificate_revocation_list( - certificate_revocation_list=resources.CertificateRevocationList(name='name_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] - arg = args[0].certificate_revocation_list - mock_val = resources.CertificateRevocationList(name='name_value') - assert arg == mock_val - arg = args[0].update_mask - mock_val = field_mask_pb2.FieldMask(paths=['paths_value']) - assert arg == mock_val - - -def test_update_certificate_revocation_list_flattened_error(): - client = CertificateAuthorityServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Attempting to call a method with both a request object and flattened - # fields is an error. - with pytest.raises(ValueError): - client.update_certificate_revocation_list( - service.UpdateCertificateRevocationListRequest(), - certificate_revocation_list=resources.CertificateRevocationList(name='name_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=ga_credentials.AnonymousCredentials(), - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.update_certificate_revocation_list), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = operations_pb2.Operation(name='operations/op') - - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - operations_pb2.Operation(name='operations/spam') - ) - # Call the method with a truthy value for each flattened field, - # using the keyword arguments to the method. - response = await client.update_certificate_revocation_list( - certificate_revocation_list=resources.CertificateRevocationList(name='name_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] - arg = args[0].certificate_revocation_list - mock_val = resources.CertificateRevocationList(name='name_value') - assert arg == mock_val - arg = args[0].update_mask - mock_val = field_mask_pb2.FieldMask(paths=['paths_value']) - assert arg == mock_val - -@pytest.mark.asyncio -async def test_update_certificate_revocation_list_flattened_error_async(): - client = CertificateAuthorityServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Attempting to call a method with both a request object and flattened - # fields is an error. - with pytest.raises(ValueError): - await client.update_certificate_revocation_list( - service.UpdateCertificateRevocationListRequest(), - certificate_revocation_list=resources.CertificateRevocationList(name='name_value'), - update_mask=field_mask_pb2.FieldMask(paths=['paths_value']), - ) - - -@pytest.mark.parametrize("request_type", [ - service.GetReusableConfigRequest, - dict, -]) -def test_get_reusable_config(request_type, transport: str = 'grpc'): - client = CertificateAuthorityServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.get_reusable_config), - '__call__') as call: - # Designate an appropriate return value for the call. - 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' - - -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=ga_credentials.AnonymousCredentials(), - transport='grpc', - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.get_reusable_config), - '__call__') as call: - client.get_reusable_config() - call.assert_called() - _, args, _ = call.mock_calls[0] - assert args[0] == service.GetReusableConfigRequest() - -@pytest.mark.asyncio -async def test_get_reusable_config_async(transport: str = 'grpc_asyncio', request_type=service.GetReusableConfigRequest): - client = CertificateAuthorityServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.get_reusable_config), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(resources.ReusableConfig( - 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' - - -@pytest.mark.asyncio -async def test_get_reusable_config_async_from_dict(): - await test_get_reusable_config_async(request_type=dict) - - -def test_get_reusable_config_field_headers(): - client = CertificateAuthorityServiceClient( - 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. - with mock.patch.object( - 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. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ( - 'x-goog-request-params', - 'name=name_value', - ) in kw['metadata'] - - -@pytest.mark.asyncio -async def test_get_reusable_config_field_headers_async(): - client = CertificateAuthorityServiceAsyncClient( - 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. - with mock.patch.object( - type(client.transport.get_reusable_config), - '__call__') as call: - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(resources.ReusableConfig()) - 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] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ( - 'x-goog-request-params', - 'name=name_value', - ) in kw['metadata'] - - -def test_get_reusable_config_flattened(): - client = CertificateAuthorityServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.get_reusable_config), - '__call__') 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', - ) - - # Establish that the underlying call was made with the expected - # request object values. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - arg = args[0].name - mock_val = 'name_value' - assert arg == mock_val - - -def test_get_reusable_config_flattened_error(): - client = CertificateAuthorityServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Attempting to call a method with both a request object and flattened - # fields is an error. - with pytest.raises(ValueError): - client.get_reusable_config( - service.GetReusableConfigRequest(), - name='name_value', - ) - -@pytest.mark.asyncio -async def test_get_reusable_config_flattened_async(): - client = CertificateAuthorityServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.get_reusable_config), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = resources.ReusableConfig() - - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(resources.ReusableConfig()) - # Call the method with a truthy value for each flattened field, - # using the keyword arguments to the method. - response = await client.get_reusable_config( - name='name_value', - ) - - # Establish that the underlying call was made with the expected - # request object values. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - arg = args[0].name - mock_val = 'name_value' - assert arg == mock_val - -@pytest.mark.asyncio -async def test_get_reusable_config_flattened_error_async(): - client = CertificateAuthorityServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Attempting to call a method with both a request object and flattened - # fields is an error. - with pytest.raises(ValueError): - await client.get_reusable_config( - service.GetReusableConfigRequest(), - name='name_value', - ) - - -@pytest.mark.parametrize("request_type", [ - service.ListReusableConfigsRequest, - dict, -]) -def test_list_reusable_configs(request_type, transport: str = 'grpc'): - client = CertificateAuthorityServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_reusable_configs), - '__call__') as call: - # Designate an appropriate return value for the call. - 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'] - - -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=ga_credentials.AnonymousCredentials(), - transport='grpc', - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_reusable_configs), - '__call__') as call: - client.list_reusable_configs() - call.assert_called() - _, args, _ = call.mock_calls[0] - assert args[0] == service.ListReusableConfigsRequest() - -@pytest.mark.asyncio -async def test_list_reusable_configs_async(transport: str = 'grpc_asyncio', request_type=service.ListReusableConfigsRequest): - client = CertificateAuthorityServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_reusable_configs), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value =grpc_helpers_async.FakeUnaryUnaryCall(service.ListReusableConfigsResponse( - next_page_token='next_page_token_value', - 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'] - - -@pytest.mark.asyncio -async def test_list_reusable_configs_async_from_dict(): - await test_list_reusable_configs_async(request_type=dict) - - -def test_list_reusable_configs_field_headers(): - client = CertificateAuthorityServiceClient( - 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. - with mock.patch.object( - 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. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ( - 'x-goog-request-params', - 'parent=parent_value', - ) in kw['metadata'] - - -@pytest.mark.asyncio -async def test_list_reusable_configs_field_headers_async(): - client = CertificateAuthorityServiceAsyncClient( - 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. - with mock.patch.object( - type(client.transport.list_reusable_configs), - '__call__') as call: - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(service.ListReusableConfigsResponse()) - 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] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ( - 'x-goog-request-params', - 'parent=parent_value', - ) in kw['metadata'] - - -def test_list_reusable_configs_flattened(): - client = CertificateAuthorityServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_reusable_configs), - '__call__') 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', - ) - - # Establish that the underlying call was made with the expected - # request object values. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - arg = args[0].parent - mock_val = 'parent_value' - assert arg == mock_val - - -def test_list_reusable_configs_flattened_error(): - client = CertificateAuthorityServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Attempting to call a method with both a request object and flattened - # fields is an error. - with pytest.raises(ValueError): - client.list_reusable_configs( - service.ListReusableConfigsRequest(), - parent='parent_value', - ) - -@pytest.mark.asyncio -async def test_list_reusable_configs_flattened_async(): - client = CertificateAuthorityServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_reusable_configs), - '__call__') as call: - # Designate an appropriate return value for the call. - call.return_value = service.ListReusableConfigsResponse() - - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(service.ListReusableConfigsResponse()) - # Call the method with a truthy value for each flattened field, - # using the keyword arguments to the method. - response = await client.list_reusable_configs( - parent='parent_value', - ) - - # Establish that the underlying call was made with the expected - # request object values. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - arg = args[0].parent - mock_val = 'parent_value' - assert arg == mock_val - -@pytest.mark.asyncio -async def test_list_reusable_configs_flattened_error_async(): - client = CertificateAuthorityServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Attempting to call a method with both a request object and flattened - # fields is an error. - with pytest.raises(ValueError): - await client.list_reusable_configs( - service.ListReusableConfigsRequest(), - parent='parent_value', - ) - - -def test_list_reusable_configs_pager(transport_name: str = "grpc"): - client = CertificateAuthorityServiceClient( - credentials=ga_credentials.AnonymousCredentials, - transport=transport_name, - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_reusable_configs), - '__call__') as call: - # Set the response to a series of pages. - call.side_effect = ( - service.ListReusableConfigsResponse( - reusable_configs=[ - resources.ReusableConfig(), - resources.ReusableConfig(), - resources.ReusableConfig(), - ], - next_page_token='abc', - ), - service.ListReusableConfigsResponse( - reusable_configs=[], - next_page_token='def', - ), - service.ListReusableConfigsResponse( - reusable_configs=[ - resources.ReusableConfig(), - ], - next_page_token='ghi', - ), - service.ListReusableConfigsResponse( - reusable_configs=[ - resources.ReusableConfig(), - resources.ReusableConfig(), - ], - ), - RuntimeError, - ) - - metadata = () - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata(( - ('parent', ''), - )), - ) - pager = client.list_reusable_configs(request={}) - - assert pager._metadata == metadata - - results = list(pager) - assert len(results) == 6 - assert all(isinstance(i, resources.ReusableConfig) - for i in results) -def test_list_reusable_configs_pages(transport_name: str = "grpc"): - client = CertificateAuthorityServiceClient( - credentials=ga_credentials.AnonymousCredentials, - transport=transport_name, - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_reusable_configs), - '__call__') as call: - # Set the response to a series of pages. - call.side_effect = ( - service.ListReusableConfigsResponse( - reusable_configs=[ - resources.ReusableConfig(), - resources.ReusableConfig(), - resources.ReusableConfig(), - ], - next_page_token='abc', - ), - service.ListReusableConfigsResponse( - reusable_configs=[], - next_page_token='def', - ), - service.ListReusableConfigsResponse( - reusable_configs=[ - resources.ReusableConfig(), - ], - next_page_token='ghi', - ), - service.ListReusableConfigsResponse( - reusable_configs=[ - resources.ReusableConfig(), - resources.ReusableConfig(), - ], - ), - RuntimeError, - ) - pages = list(client.list_reusable_configs(request={}).pages) - for page_, token in zip(pages, ['abc','def','ghi', '']): - assert page_.raw_page.next_page_token == token - -@pytest.mark.asyncio -async def test_list_reusable_configs_async_pager(): - client = CertificateAuthorityServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials, - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_reusable_configs), - '__call__', new_callable=mock.AsyncMock) as call: - # Set the response to a series of pages. - call.side_effect = ( - service.ListReusableConfigsResponse( - reusable_configs=[ - resources.ReusableConfig(), - resources.ReusableConfig(), - resources.ReusableConfig(), - ], - next_page_token='abc', - ), - service.ListReusableConfigsResponse( - reusable_configs=[], - next_page_token='def', - ), - service.ListReusableConfigsResponse( - reusable_configs=[ - resources.ReusableConfig(), - ], - next_page_token='ghi', - ), - service.ListReusableConfigsResponse( - reusable_configs=[ - resources.ReusableConfig(), - resources.ReusableConfig(), - ], - ), - RuntimeError, - ) - async_pager = await client.list_reusable_configs(request={},) - assert async_pager.next_page_token == 'abc' - responses = [] - async for response in async_pager: # pragma: no branch - responses.append(response) - - assert len(responses) == 6 - assert all(isinstance(i, resources.ReusableConfig) - for i in responses) - - -@pytest.mark.asyncio -async def test_list_reusable_configs_async_pages(): - client = CertificateAuthorityServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials, - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_reusable_configs), - '__call__', new_callable=mock.AsyncMock) as call: - # Set the response to a series of pages. - call.side_effect = ( - service.ListReusableConfigsResponse( - reusable_configs=[ - resources.ReusableConfig(), - resources.ReusableConfig(), - resources.ReusableConfig(), - ], - next_page_token='abc', - ), - service.ListReusableConfigsResponse( - reusable_configs=[], - next_page_token='def', - ), - service.ListReusableConfigsResponse( - reusable_configs=[ - resources.ReusableConfig(), - ], - next_page_token='ghi', - ), - service.ListReusableConfigsResponse( - reusable_configs=[ - resources.ReusableConfig(), - resources.ReusableConfig(), - ], - ), - RuntimeError, - ) - pages = [] - async for page_ in (await client.list_reusable_configs(request={})).pages: # pragma: no branch - pages.append(page_) - for page_, token in zip(pages, ['abc','def','ghi', '']): - assert page_.raw_page.next_page_token == token - - -def test_credentials_transport_error(): - # It is an error to provide credentials and a transport instance. - transport = transports.CertificateAuthorityServiceGrpcTransport( - credentials=ga_credentials.AnonymousCredentials(), - ) - with pytest.raises(ValueError): - client = CertificateAuthorityServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # It is an error to provide a credentials file and a transport instance. - transport = transports.CertificateAuthorityServiceGrpcTransport( - credentials=ga_credentials.AnonymousCredentials(), - ) - with pytest.raises(ValueError): - client = CertificateAuthorityServiceClient( - client_options={"credentials_file": "credentials.json"}, - transport=transport, - ) - - # It is an error to provide an api_key and a transport instance. - transport = transports.CertificateAuthorityServiceGrpcTransport( - credentials=ga_credentials.AnonymousCredentials(), - ) - options = client_options.ClientOptions() - options.api_key = "api_key" - with pytest.raises(ValueError): - client = CertificateAuthorityServiceClient( - client_options=options, - transport=transport, - ) - - # It is an error to provide an api_key and a credential. - options = mock.Mock() - options.api_key = "api_key" - with pytest.raises(ValueError): - client = CertificateAuthorityServiceClient( - client_options=options, - credentials=ga_credentials.AnonymousCredentials() - ) - - # It is an error to provide scopes and a transport instance. - transport = transports.CertificateAuthorityServiceGrpcTransport( - credentials=ga_credentials.AnonymousCredentials(), - ) - with pytest.raises(ValueError): - client = CertificateAuthorityServiceClient( - client_options={"scopes": ["1", "2"]}, - transport=transport, - ) - - -def test_transport_instance(): - # A client may be instantiated with a custom transport instance. - transport = transports.CertificateAuthorityServiceGrpcTransport( - credentials=ga_credentials.AnonymousCredentials(), - ) - client = CertificateAuthorityServiceClient(transport=transport) - assert client.transport is transport - -def test_transport_get_channel(): - # A client may be instantiated with a custom transport instance. - transport = transports.CertificateAuthorityServiceGrpcTransport( - credentials=ga_credentials.AnonymousCredentials(), - ) - channel = transport.grpc_channel - assert channel - - transport = transports.CertificateAuthorityServiceGrpcAsyncIOTransport( - credentials=ga_credentials.AnonymousCredentials(), - ) - channel = transport.grpc_channel - assert channel - -@pytest.mark.parametrize("transport_class", [ - transports.CertificateAuthorityServiceGrpcTransport, - transports.CertificateAuthorityServiceGrpcAsyncIOTransport, -]) -def test_transport_adc(transport_class): - # Test default credentials are used if not provided. - with mock.patch.object(google.auth, 'default') as adc: - adc.return_value = (ga_credentials.AnonymousCredentials(), None) - transport_class() - adc.assert_called_once() - -@pytest.mark.parametrize("transport_name", [ - "grpc", -]) -def test_transport_kind(transport_name): - transport = CertificateAuthorityServiceClient.get_transport_class(transport_name)( - credentials=ga_credentials.AnonymousCredentials(), - ) - assert transport.kind == transport_name - -def test_transport_grpc_default(): - # A client should use the gRPC transport by default. - client = CertificateAuthorityServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - assert isinstance( - client.transport, - transports.CertificateAuthorityServiceGrpcTransport, - ) - -def test_certificate_authority_service_base_transport_error(): - # Passing both a credentials object and credentials_file should raise an error - with pytest.raises(core_exceptions.DuplicateCredentialArgs): - transport = transports.CertificateAuthorityServiceTransport( - credentials=ga_credentials.AnonymousCredentials(), - credentials_file="credentials.json" - ) - - -def test_certificate_authority_service_base_transport(): - # Instantiate the base transport. - with mock.patch('google.cloud.security.privateca_v1beta1.services.certificate_authority_service.transports.CertificateAuthorityServiceTransport.__init__') as Transport: - Transport.return_value = None - transport = transports.CertificateAuthorityServiceTransport( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Every method on the transport should just blindly - # raise NotImplementedError. - methods = ( - 'create_certificate', - 'get_certificate', - 'list_certificates', - 'revoke_certificate', - 'update_certificate', - 'activate_certificate_authority', - 'create_certificate_authority', - 'disable_certificate_authority', - 'enable_certificate_authority', - 'fetch_certificate_authority_csr', - 'get_certificate_authority', - 'list_certificate_authorities', - 'restore_certificate_authority', - 'schedule_delete_certificate_authority', - 'update_certificate_authority', - 'get_certificate_revocation_list', - 'list_certificate_revocation_lists', - 'update_certificate_revocation_list', - 'get_reusable_config', - 'list_reusable_configs', - ) - for method in methods: - with pytest.raises(NotImplementedError): - getattr(transport, method)(request=object()) - - with pytest.raises(NotImplementedError): - transport.close() - - # Additionally, the LRO client (a property) should - # also raise NotImplementedError - with pytest.raises(NotImplementedError): - transport.operations_client - - # Catch all for all remaining methods and properties - remainder = [ - 'kind', - ] - for r in remainder: - with pytest.raises(NotImplementedError): - getattr(transport, r)() - - -def test_certificate_authority_service_base_transport_with_credentials_file(): - # 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", - ) - load_creds.assert_called_once_with("credentials.json", - scopes=None, - default_scopes=( - 'https://www.googleapis.com/auth/cloud-platform', -), - quota_project_id="octopus", - ) - - -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(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 = (ga_credentials.AnonymousCredentials(), None) - transport = transports.CertificateAuthorityServiceTransport() - adc.assert_called_once() - - -def test_certificate_authority_service_auth_adc(): - # 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=None, - default_scopes=( - 'https://www.googleapis.com/auth/cloud-platform', -), - quota_project_id=None, - ) - - -@pytest.mark.parametrize( - "transport_class", - [ - transports.CertificateAuthorityServiceGrpcTransport, - transports.CertificateAuthorityServiceGrpcAsyncIOTransport, - ], -) -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(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, - ], -) -def test_certificate_authority_service_transport_auth_gdch_credentials(transport_class): - host = 'https://language.com' - api_audience_tests = [None, 'https://language2.com'] - api_audience_expect = [host, 'https://language2.com'] - for t, e in zip(api_audience_tests, api_audience_expect): - with mock.patch.object(google.auth, 'default', autospec=True) as adc: - gdch_mock = mock.MagicMock() - type(gdch_mock).with_gdch_audience = mock.PropertyMock(return_value=gdch_mock) - adc.return_value = (gdch_mock, None) - transport_class(host=host, api_audience=t) - gdch_mock.with_gdch_audience.assert_called_once_with( - e - ) - - -@pytest.mark.parametrize( - "transport_class,grpc_helpers", - [ - (transports.CertificateAuthorityServiceGrpcTransport, grpc_helpers), - (transports.CertificateAuthorityServiceGrpcAsyncIOTransport, grpc_helpers_async) - ], -) -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", [transports.CertificateAuthorityServiceGrpcTransport, transports.CertificateAuthorityServiceGrpcAsyncIOTransport]) -def test_certificate_authority_service_grpc_transport_client_cert_source_for_mtls( - transport_class -): - cred = ga_credentials.AnonymousCredentials() - - # Check ssl_channel_credentials is used if provided. - with mock.patch.object(transport_class, "create_channel") as mock_create_channel: - mock_ssl_channel_creds = mock.Mock() - transport_class( - host="squid.clam.whelk", - credentials=cred, - ssl_channel_credentials=mock_ssl_channel_creds - ) - mock_create_channel.assert_called_once_with( - "squid.clam.whelk:443", - credentials=cred, - credentials_file=None, - scopes=None, - ssl_credentials=mock_ssl_channel_creds, - quota_project_id=None, - options=[ - ("grpc.max_send_message_length", -1), - ("grpc.max_receive_message_length", -1), - ], - ) - - # Check if ssl_channel_credentials is not provided, then client_cert_source_for_mtls - # is used. - with mock.patch.object(transport_class, "create_channel", return_value=mock.Mock()): - with mock.patch("grpc.ssl_channel_credentials") as mock_ssl_cred: - transport_class( - credentials=cred, - client_cert_source_for_mtls=client_cert_source_callback - ) - expected_cert, expected_key = client_cert_source_callback() - mock_ssl_cred.assert_called_once_with( - certificate_chain=expected_cert, - private_key=expected_key - ) - - -@pytest.mark.parametrize("transport_name", [ - "grpc", - "grpc_asyncio", -]) -def test_certificate_authority_service_host_no_port(transport_name): - client = CertificateAuthorityServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - client_options=client_options.ClientOptions(api_endpoint='privateca.googleapis.com'), - transport=transport_name, - ) - assert client.transport._host == ( - 'privateca.googleapis.com:443' - ) - -@pytest.mark.parametrize("transport_name", [ - "grpc", - "grpc_asyncio", -]) -def test_certificate_authority_service_host_with_port(transport_name): - client = CertificateAuthorityServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - client_options=client_options.ClientOptions(api_endpoint='privateca.googleapis.com:8000'), - transport=transport_name, - ) - assert client.transport._host == ( - 'privateca.googleapis.com:8000' - ) - -def test_certificate_authority_service_grpc_transport_channel(): - channel = grpc.secure_channel('http://localhost/', grpc.local_channel_credentials()) - - # Check that channel is used if provided. - transport = transports.CertificateAuthorityServiceGrpcTransport( - host="squid.clam.whelk", - channel=channel, - ) - assert transport.grpc_channel == channel - assert transport._host == "squid.clam.whelk:443" - assert transport._ssl_channel_credentials == None - - -def test_certificate_authority_service_grpc_asyncio_transport_channel(): - channel = aio.secure_channel('http://localhost/', grpc.local_channel_credentials()) - - # Check that channel is used if provided. - transport = transports.CertificateAuthorityServiceGrpcAsyncIOTransport( - host="squid.clam.whelk", - channel=channel, - ) - assert transport.grpc_channel == channel - assert transport._host == "squid.clam.whelk:443" - assert transport._ssl_channel_credentials == None - - -# Remove this test when deprecated arguments (api_mtls_endpoint, client_cert_source) are -# removed from grpc/grpc_asyncio transport constructor. -@pytest.mark.parametrize("transport_class", [transports.CertificateAuthorityServiceGrpcTransport, transports.CertificateAuthorityServiceGrpcAsyncIOTransport]) -def test_certificate_authority_service_transport_channel_mtls_with_client_cert_source( - transport_class -): - with mock.patch("grpc.ssl_channel_credentials", autospec=True) as grpc_ssl_channel_cred: - with mock.patch.object(transport_class, "create_channel") as grpc_create_channel: - mock_ssl_cred = mock.Mock() - grpc_ssl_channel_cred.return_value = mock_ssl_cred - - mock_grpc_channel = mock.Mock() - grpc_create_channel.return_value = mock_grpc_channel - - cred = ga_credentials.AnonymousCredentials() - with pytest.warns(DeprecationWarning): - with mock.patch.object(google.auth, 'default') as adc: - adc.return_value = (cred, None) - transport = transport_class( - host="squid.clam.whelk", - api_mtls_endpoint="mtls.squid.clam.whelk", - client_cert_source=client_cert_source_callback, - ) - adc.assert_called_once() - - grpc_ssl_channel_cred.assert_called_once_with( - certificate_chain=b"cert bytes", private_key=b"key bytes" - ) - grpc_create_channel.assert_called_once_with( - "mtls.squid.clam.whelk:443", - credentials=cred, - credentials_file=None, - scopes=None, - ssl_credentials=mock_ssl_cred, - quota_project_id=None, - options=[ - ("grpc.max_send_message_length", -1), - ("grpc.max_receive_message_length", -1), - ], - ) - assert transport.grpc_channel == mock_grpc_channel - assert transport._ssl_channel_credentials == mock_ssl_cred - - -# Remove this test when deprecated arguments (api_mtls_endpoint, client_cert_source) are -# removed from grpc/grpc_asyncio transport constructor. -@pytest.mark.parametrize("transport_class", [transports.CertificateAuthorityServiceGrpcTransport, transports.CertificateAuthorityServiceGrpcAsyncIOTransport]) -def test_certificate_authority_service_transport_channel_mtls_with_adc( - transport_class -): - mock_ssl_cred = mock.Mock() - with mock.patch.multiple( - "google.auth.transport.grpc.SslCredentials", - __init__=mock.Mock(return_value=None), - ssl_credentials=mock.PropertyMock(return_value=mock_ssl_cred), - ): - with mock.patch.object(transport_class, "create_channel") as grpc_create_channel: - mock_grpc_channel = mock.Mock() - grpc_create_channel.return_value = mock_grpc_channel - mock_cred = mock.Mock() - - with pytest.warns(DeprecationWarning): - transport = transport_class( - host="squid.clam.whelk", - credentials=mock_cred, - api_mtls_endpoint="mtls.squid.clam.whelk", - client_cert_source=None, - ) - - grpc_create_channel.assert_called_once_with( - "mtls.squid.clam.whelk:443", - credentials=mock_cred, - credentials_file=None, - scopes=None, - ssl_credentials=mock_ssl_cred, - quota_project_id=None, - options=[ - ("grpc.max_send_message_length", -1), - ("grpc.max_receive_message_length", -1), - ], - ) - assert transport.grpc_channel == mock_grpc_channel - - -def test_certificate_authority_service_grpc_lro_client(): - client = CertificateAuthorityServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - transport='grpc', - ) - transport = client.transport - - # Ensure that we have a api-core operations client. - assert isinstance( - transport.operations_client, - operations_v1.OperationsClient, - ) - - # Ensure that subsequent calls to the property send the exact same object. - assert transport.operations_client is transport.operations_client - - -def test_certificate_authority_service_grpc_lro_async_client(): - client = CertificateAuthorityServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - transport='grpc_asyncio', - ) - transport = client.transport - - # Ensure that we have a api-core operations client. - assert isinstance( - transport.operations_client, - operations_v1.OperationsAsyncClient, - ) - - # Ensure that subsequent calls to the property send the exact same object. - assert transport.operations_client is transport.operations_client - - -def test_certificate_path(): - project = "squid" - location = "clam" - certificate_authority = "whelk" - certificate = "octopus" - expected = "projects/{project}/locations/{location}/certificateAuthorities/{certificate_authority}/certificates/{certificate}".format(project=project, location=location, certificate_authority=certificate_authority, certificate=certificate, ) - actual = CertificateAuthorityServiceClient.certificate_path(project, location, certificate_authority, certificate) - assert expected == actual - - -def test_parse_certificate_path(): - expected = { - "project": "oyster", - "location": "nudibranch", - "certificate_authority": "cuttlefish", - "certificate": "mussel", - } - path = CertificateAuthorityServiceClient.certificate_path(**expected) - - # Check that the path construction is reversible. - actual = CertificateAuthorityServiceClient.parse_certificate_path(path) - assert expected == actual - -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, ) - actual = CertificateAuthorityServiceClient.certificate_authority_path(project, location, certificate_authority) - assert expected == actual - - -def test_parse_certificate_authority_path(): - expected = { - "project": "abalone", - "location": "squid", - "certificate_authority": "clam", - } - path = CertificateAuthorityServiceClient.certificate_authority_path(**expected) - - # Check that the path construction is reversible. - actual = CertificateAuthorityServiceClient.parse_certificate_authority_path(path) - assert expected == actual - -def test_certificate_revocation_list_path(): - project = "whelk" - 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, certificate_authority=certificate_authority, certificate_revocation_list=certificate_revocation_list, ) - actual = CertificateAuthorityServiceClient.certificate_revocation_list_path(project, location, certificate_authority, certificate_revocation_list) - assert expected == actual - - -def test_parse_certificate_revocation_list_path(): - expected = { - "project": "cuttlefish", - "location": "mussel", - "certificate_authority": "winkle", - "certificate_revocation_list": "nautilus", - } - path = CertificateAuthorityServiceClient.certificate_revocation_list_path(**expected) - - # Check that the path construction is reversible. - actual = CertificateAuthorityServiceClient.parse_certificate_revocation_list_path(path) - assert expected == actual - -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, ) - actual = CertificateAuthorityServiceClient.reusable_config_path(project, location, reusable_config) - assert expected == actual - - -def test_parse_reusable_config_path(): - expected = { - "project": "clam", - "location": "whelk", - "reusable_config": "octopus", - } - path = CertificateAuthorityServiceClient.reusable_config_path(**expected) - - # Check that the path construction is reversible. - actual = CertificateAuthorityServiceClient.parse_reusable_config_path(path) - assert expected == actual - -def test_common_billing_account_path(): - billing_account = "oyster" - expected = "billingAccounts/{billing_account}".format(billing_account=billing_account, ) - actual = CertificateAuthorityServiceClient.common_billing_account_path(billing_account) - assert expected == actual - - -def test_parse_common_billing_account_path(): - expected = { - "billing_account": "nudibranch", - } - path = CertificateAuthorityServiceClient.common_billing_account_path(**expected) - - # Check that the path construction is reversible. - actual = CertificateAuthorityServiceClient.parse_common_billing_account_path(path) - assert expected == actual - -def test_common_folder_path(): - folder = "cuttlefish" - expected = "folders/{folder}".format(folder=folder, ) - actual = CertificateAuthorityServiceClient.common_folder_path(folder) - assert expected == actual - - -def test_parse_common_folder_path(): - expected = { - "folder": "mussel", - } - path = CertificateAuthorityServiceClient.common_folder_path(**expected) - - # Check that the path construction is reversible. - actual = CertificateAuthorityServiceClient.parse_common_folder_path(path) - assert expected == actual - -def test_common_organization_path(): - organization = "winkle" - expected = "organizations/{organization}".format(organization=organization, ) - actual = CertificateAuthorityServiceClient.common_organization_path(organization) - assert expected == actual - - -def test_parse_common_organization_path(): - expected = { - "organization": "nautilus", - } - path = CertificateAuthorityServiceClient.common_organization_path(**expected) - - # Check that the path construction is reversible. - actual = CertificateAuthorityServiceClient.parse_common_organization_path(path) - assert expected == actual - -def test_common_project_path(): - project = "scallop" - expected = "projects/{project}".format(project=project, ) - actual = CertificateAuthorityServiceClient.common_project_path(project) - assert expected == actual - - -def test_parse_common_project_path(): - expected = { - "project": "abalone", - } - path = CertificateAuthorityServiceClient.common_project_path(**expected) - - # Check that the path construction is reversible. - actual = CertificateAuthorityServiceClient.parse_common_project_path(path) - assert expected == actual - -def test_common_location_path(): - project = "squid" - location = "clam" - expected = "projects/{project}/locations/{location}".format(project=project, location=location, ) - actual = CertificateAuthorityServiceClient.common_location_path(project, location) - assert expected == actual - - -def test_parse_common_location_path(): - expected = { - "project": "whelk", - "location": "octopus", - } - path = CertificateAuthorityServiceClient.common_location_path(**expected) - - # Check that the path construction is reversible. - actual = CertificateAuthorityServiceClient.parse_common_location_path(path) - assert expected == actual - - -def test_client_with_default_client_info(): - client_info = gapic_v1.client_info.ClientInfo() - - with mock.patch.object(transports.CertificateAuthorityServiceTransport, '_prep_wrapped_messages') as prep: - client = CertificateAuthorityServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - client_info=client_info, - ) - prep.assert_called_once_with(client_info) - - with mock.patch.object(transports.CertificateAuthorityServiceTransport, '_prep_wrapped_messages') as prep: - transport_class = CertificateAuthorityServiceClient.get_transport_class() - transport = transport_class( - credentials=ga_credentials.AnonymousCredentials(), - client_info=client_info, - ) - prep.assert_called_once_with(client_info) - -@pytest.mark.asyncio -async def test_transport_close_async(): - client = CertificateAuthorityServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="grpc_asyncio", - ) - with mock.patch.object(type(getattr(client.transport, "grpc_channel")), "close") as close: - async with client: - close.assert_not_called() - close.assert_called_once() - - -def test_transport_close(): - transports = { - "grpc": "_grpc_channel", - } - - for transport, close_name in transports.items(): - client = CertificateAuthorityServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport - ) - with mock.patch.object(type(getattr(client.transport, close_name)), "close") as close: - with client: - close.assert_not_called() - close.assert_called_once() - -def test_client_ctx(): - transports = [ - 'grpc', - ] - for transport in transports: - client = CertificateAuthorityServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport - ) - # Test client calls underlying transport. - with mock.patch.object(type(client.transport), "close") as close: - close.assert_not_called() - with client: - pass - close.assert_called() - -@pytest.mark.parametrize("client_class,transport_class", [ - (CertificateAuthorityServiceClient, transports.CertificateAuthorityServiceGrpcTransport), - (CertificateAuthorityServiceAsyncClient, transports.CertificateAuthorityServiceGrpcAsyncIOTransport), -]) -def test_api_key_credentials(client_class, transport_class): - with mock.patch.object( - google.auth._default, "get_api_key_credentials", create=True - ) as get_api_key_credentials: - mock_cred = mock.Mock() - get_api_key_credentials.return_value = mock_cred - options = client_options.ClientOptions() - options.api_key = "api_key" - with mock.patch.object(transport_class, "__init__") as patched: - patched.return_value = None - client = client_class(client_options=options) - patched.assert_called_once_with( - credentials=mock_cred, - credentials_file=None, - host=client.DEFAULT_ENDPOINT, - scopes=None, - client_cert_source_for_mtls=None, - quota_project_id=None, - client_info=transports.base.DEFAULT_CLIENT_INFO, - always_use_jwt_access=True, - api_audience=None, - ) diff --git a/samples/generated_samples/snippet_metadata_google.cloud.security.privateca.v1.json b/samples/generated_samples/snippet_metadata_google.cloud.security.privateca.v1.json index 4c49e54..2ae53b3 100644 --- a/samples/generated_samples/snippet_metadata_google.cloud.security.privateca.v1.json +++ b/samples/generated_samples/snippet_metadata_google.cloud.security.privateca.v1.json @@ -8,7 +8,7 @@ ], "language": "PYTHON", "name": "google-cloud-private-ca", - "version": "1.6.1" + "version": "0.1.0" }, "snippets": [ { diff --git a/samples/generated_samples/snippet_metadata_google.cloud.security.privateca.v1beta1.json b/samples/generated_samples/snippet_metadata_google.cloud.security.privateca.v1beta1.json index 98e5b66..d9af1f5 100644 --- a/samples/generated_samples/snippet_metadata_google.cloud.security.privateca.v1beta1.json +++ b/samples/generated_samples/snippet_metadata_google.cloud.security.privateca.v1beta1.json @@ -8,7 +8,7 @@ ], "language": "PYTHON", "name": "google-cloud-private-ca", - "version": "1.6.1" + "version": "0.1.0" }, "snippets": [ {